From: Stefan Kangas Date: Fri, 29 Jan 2021 23:10:10 +0000 (+0100) Subject: Use lexical-binding in handwrite.el X-Git-Tag: emacs-28.0.90~4037 X-Git-Url: http://git.eshelyaron.com/gitweb/?a=commitdiff_plain;h=1a4bb1e2f28ec20aff23bab335ba949a0f2b75a1;p=emacs.git Use lexical-binding in handwrite.el * lisp/play/handwrite.el: Use lexical-binding. Remove redundant :group args. Minor cleanups. (handwrite): Minor cleanups. (handwrite-set-pagenumber-off, handwrite-set-pagenumber-on): Make comments into docstrings. --- diff --git a/lisp/play/handwrite.el b/lisp/play/handwrite.el index 7ad3de6fb64..98da26c2e6c 100644 --- a/lisp/play/handwrite.el +++ b/lisp/play/handwrite.el @@ -1,8 +1,9 @@ -;;; handwrite.el --- turns your emacs buffer into a handwritten document +;;; handwrite.el --- turns your emacs buffer into a handwritten document -*- lexical-binding: t -*- ;; Copyright (C) 1996, 2001-2021 Free Software Foundation, Inc. ;; Author: Danny Roozendaal (was: ) +;; Maintainer: emacs-devel@gnu.org ;; Created: October 21 1996 ;; Keywords: wp, print, postscript, cursive writing @@ -22,11 +23,11 @@ ;; along with GNU Emacs. If not, see . ;;; Commentary: + +;; The function `handwrite' creates PostScript output containing a +;; handwritten version of the current buffer. ;; -;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; -;; The function handwrite creates PostScript output containing a -;; handwritten version of the current buffer.. -;; Other functions that may be useful are +;; Other functions that may be useful are: ;; ;; handwrite-10pt: sets the font size to 10 and finds corresponding ;; values for the line spacing and the number of lines @@ -54,8 +55,6 @@ ;; unknown characters. ;; ;; Thanks to anyone who emailed me suggestions! -;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; - ;;; Code: @@ -64,7 +63,6 @@ (defvar ps-lpr-command) (defvar ps-lpr-switches) - ;; Variables (defgroup handwrite nil @@ -98,44 +96,43 @@ (defcustom handwrite-numlines 60 "The number of lines on a page of the PostScript output from `handwrite'." - :type 'integer - :group 'handwrite) + :type 'integer) + (defcustom handwrite-fontsize 11 "The size of the font for the PostScript output from `handwrite'." - :type 'integer - :group 'handwrite) + :type 'integer) + (defcustom handwrite-linespace 12 "The spacing for the PostScript output from `handwrite'." - :type 'integer - :group 'handwrite) + :type 'integer) + (defcustom handwrite-xstart 30 "X-axis translation in the PostScript output from `handwrite'." - :type 'integer - :group 'handwrite) + :type 'integer) + (defcustom handwrite-ystart 810 "Y-axis translation in the PostScript output from `handwrite'." - :type 'integer - :group 'handwrite) + :type 'integer) + (defcustom handwrite-pagenumbering nil "If non-nil, number each page of the PostScript output from `handwrite'." - :type 'boolean - :group 'handwrite) + :type 'boolean) + (defcustom handwrite-10pt-numlines 65 "The number of lines on a page for the function `handwrite-10pt'." - :type 'integer - :group 'handwrite) + :type 'integer) + (defcustom handwrite-11pt-numlines 60 "The number of lines on a page for the function `handwrite-11pt'." - :type 'integer - :group 'handwrite) + :type 'integer) + (defcustom handwrite-12pt-numlines 55 "The number of lines on a page for the function `handwrite-12pt'." - :type 'integer - :group 'handwrite) + :type 'integer) + (defcustom handwrite-13pt-numlines 50 "The number of lines on a page for the function `handwrite-13pt'." - :type 'integer - :group 'handwrite) + :type 'integer) ;; Interactive functions @@ -150,17 +147,17 @@ Variables: `handwrite-linespace' (default 12) `handwrite-numlines' (default 60) `handwrite-pagenumbering' (default nil)" (interactive) + (setq handwrite-psindex (1+ handwrite-psindex)) (let - (;(pmin) ; thanks, Havard - (cur-buf (current-buffer)) + ((cur-buf (current-buffer)) (tpoint (point)) (ps-ypos 63) (lcount 0) (ipage 1) - (nlan next-line-add-newlines) ;remember the old value + (next-line-add-newlines t) (buf-name (buffer-name) ) (textp) - (ps-buf-name) ;name of the PostScript buffer + (ps-buf-name (format "*handwritten%d.ps*" handwrite-psindex)) (trans-table '(("ÿ" . "264") ("á" . "207") ("à" . "210") ("â" . "211") ("ä" . "212") ("ã" . "213") ("å" . "214") ("é" . "216") @@ -175,10 +172,6 @@ Variables: `handwrite-linespace' (default 12) ; on inserted backslashes line) (goto-char (point-min)) ;start at beginning - (setq handwrite-psindex (1+ handwrite-psindex)) - (setq ps-buf-name - (format "*handwritten%d.ps*" handwrite-psindex)) - (setq next-line-add-newlines t) (switch-to-buffer ps-buf-name) (handwrite-insert-header buf-name) (insert "%%Creator: GNU Emacs's handwrite version " emacs-version "\n") @@ -258,9 +251,7 @@ Variables: `handwrite-linespace' (default 12) (message "") (bury-buffer ()) (switch-to-buffer cur-buf) - (goto-char tpoint) - (setq next-line-add-newlines nlan) - )) + (goto-char tpoint))) (defun handwrite-set-pagenumber () @@ -280,7 +271,6 @@ values for `handwrite-linespace' and `handwrite-numlines'." (setq handwrite-numlines handwrite-10pt-numlines) (message "Handwrite output size set to 10 points")) - (defun handwrite-11pt () "Specify 11-point output for `handwrite'. This sets `handwrite-fontsize' to 11 and finds correct @@ -1238,28 +1228,16 @@ end /Joepie Hwfdict definefont %%EndFont Joepie\n\n")) -;;Sets page numbering off (defun handwrite-set-pagenumber-off () + "Set page numbering off." (setq handwrite-pagenumbering nil) (message "page numbering off")) -;;Sets page numbering on (defun handwrite-set-pagenumber-on () + "Set page numbering on." (setq handwrite-pagenumbering t) (message "page numbering on" )) - -;; Key bindings - -;; I'd rather not fill up the menu bar menus with -;; lots of random miscellaneous features. -- rms. -;;;(define-key-after -;;; (lookup-key global-map [menu-bar edit]) -;;; [handwrite] -;;; '("Write by hand" . menu-bar-handwrite-map) -;;; 'spell) - (provide 'handwrite) - ;;; handwrite.el ends here