]> code.delx.au - gnu-emacs/blobdiff - lisp/play/handwrite.el
Update copyright year to 2015
[gnu-emacs] / lisp / play / handwrite.el
index 21e3d912fe58673157b9cee206f2e8d7e0134605..32ea66307173e8ce1005ddc4d232ee81d3be0b85 100644 (file)
@@ -1,7 +1,6 @@
-;;; handwrite.el --- turns your emacs buffer into a handwritten document -*- coding: iso-latin-1; -*-
+;;; handwrite.el --- turns your emacs buffer into a handwritten document -*- coding: utf-8; -*-
 
-;; Copyright (C) 1996, 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008,
-;;   2009, 2010, 2011  Free Software Foundation, Inc.
+;; Copyright (C) 1996, 2001-2015 Free Software Foundation, Inc.
 
 ;; Author: Danny Roozendaal (was: <danny@tvs.kun.nl>)
 ;; Created: October 21 1996
@@ -46,7 +45,7 @@
 ;;  Installation
 ;;
 ;; type at your prompt "emacs -l handwrite.el" or put this file on your
-;; Emacs-Lisp load path,  add the following into your ~/.emacs startup file
+;; Emacs-Lisp load path, add the following into your init file:
 ;;
 ;;                (require 'handwrite)
 ;;
 
 ;;; Code:
 
+;; From ps-print.el
 (defvar ps-printer-name)
 (defvar ps-lpr-command)
+(defvar ps-lpr-switches)
 
 
 ;; Variables
 
 (defvar handwrite-psindex 0
   "The index of the PostScript buffer.")
-(defvar menu-bar-handwrite-map (make-sparse-keymap "Handwrite functions."))
-(fset 'menu-bar-handwrite-map (symbol-value 'menu-bar-handwrite-map))
+(defvar menu-bar-handwrite-map
+  (let ((map (make-sparse-keymap "Handwrite functions.")))
+    (define-key map [numbering]
+      '(menu-item "Page numbering" handwrite-set-pagenumber
+        :button (:toggle . handwrite-pagenumbering)))
+    (define-key map [handwrite-separator2] '("----" . nil))
+    (define-key map [10pt] '(menu-item "10 pt" handwrite-10pt
+                             :button (:radio . (eq handwrite-fontsize 10))))
+    (define-key map [11pt] '(menu-item "11 pt" handwrite-11pt
+                             :button (:radio . (eq handwrite-fontsize 11))))
+    (define-key map [12pt] '(menu-item "12 pt" handwrite-12pt
+                             :button (:radio . (eq handwrite-fontsize 12))))
+    (define-key map [13pt] '(menu-item "13 pt" handwrite-13pt
+                             :button (:radio . (eq handwrite-fontsize 13))))
+    (define-key map [handwrite-separator1] '("----" . nil))
+    (define-key map [handwrite] '("Write by hand" . handwrite))
+    map))
+(fset 'menu-bar-handwrite-map menu-bar-handwrite-map)
 
 
 ;; User definable variables
 The functions `handwrite-10pt', `handwrite-11pt', `handwrite-12pt'
 and `handwrite-13pt' set up for various sizes of output.
 
-Variables: handwrite-linespace     (default 12)
-           handwrite-fontsize      (default 11)
-           handwrite-numlines      (default 60)
-           handwrite-pagenumbering (default nil)"
+Variables: `handwrite-linespace'     (default 12)
+           `handwrite-fontsize'      (default 11)
+           `handwrite-numlines'      (default 60)
+           `handwrite-pagenumbering' (default nil)"
   (interactive)
   (let
-      ((pmin)                          ; thanks, Havard
-       (lastp)
+      (;(pmin)                         ; thanks, Havard
        (cur-buf (current-buffer))
        (tpoint (point))
        (ps-ypos 63)
@@ -154,15 +170,15 @@ Variables: handwrite-linespace     (default 12)
        (textp)
        (ps-buf-name)                   ;name of the PostScript buffer
        (trans-table
-       '(("ÿ" . "264") ("á" . "207") ("à" . "210") ("â" . "211")
-         ("ä" . "212") ("ã" . "213") ("å" . "214") ("é" . "216")
-         ("è" . "217") ("ê" . "220") ("ë" . "221") ("í" . "222")
-         ("ì" . "223") ("î" . "224") ("ï" . "225") ("ó" . "227")
-         ("ò" . "230") ("ô" . "231") ("ö" . "232") ("õ" . "233")
-         ("ú" . "234") ("ù" . "235") ("û" . "236") ("ü" . "237")
-         ("ß" . "247") ("°" . "241") ("®" . "250") ("©" . "251")
-         ("ij" . "264") ("ç" . "215") ("§" . "244") ("ñ" . "226")
-         ("£" . "243")))
+       '(("ÿ" . "264") ("á" . "207") ("à" . "210") ("â" . "211")
+         ("ä" . "212") ("ã" . "213") ("å" . "214") ("é" . "216")
+         ("è" . "217") ("ê" . "220") ("ë" . "221") ("í" . "222")
+         ("ì" . "223") ("î" . "224") ("ï" . "225") ("ó" . "227")
+         ("ò" . "230") ("ô" . "231") ("ö" . "232") ("õ" . "233")
+         ("ú" . "234") ("ù" . "235") ("û" . "236") ("ü" . "237")
+         ("Ã\9f" . "247") ("°" . "241") ("®" . "250") ("©" . "251")
+         ("ij" . "264") ("ç" . "215") ("§" . "244") ("ñ" . "226")
+         ("£" . "243")))
        (escape-table '("\\\\" "(" ")")) ; \\ comes first to not work
                                        ; on inserted backslashes
        line)
@@ -173,7 +189,7 @@ Variables: handwrite-linespace     (default 12)
     (setq next-line-add-newlines t)
     (switch-to-buffer ps-buf-name)
     (handwrite-insert-header buf-name)
-    (insert "%%Creator: GNU Emacs' handwrite version " emacs-version  "\n")
+    (insert "%%Creator: GNU Emacs's handwrite version " emacs-version  "\n")
     (handwrite-insert-preamble)
     (handwrite-insert-info)
     (handwrite-insert-font)
@@ -228,7 +244,7 @@ Variables: handwrite-linespace     (default 12)
     (insert "showpage exec Hwsave restore\n\n")
     (insert "%%Pages " (number-to-string ipage) " 0\n")
     (insert "%%EOF\n")
-    ;;To avoid cumbersome code we simply ignore pagefeeds
+    ;;To avoid cumbersome code we simply ignore formfeeds
     (goto-char textp)
     (while (search-forward "\f" nil t)
       (replace-match "" nil t) )
@@ -259,7 +275,8 @@ Variables: handwrite-linespace     (default 12)
   "Toggle the value of `handwrite-pagenumbering'."
   (interactive)
   (if handwrite-pagenumbering
-      (handwrite-set-pagenumber-off)(handwrite-set-pagenumber-on)))
+      (handwrite-set-pagenumber-off)
+    (handwrite-set-pagenumber-on)))
 
 (defun handwrite-10pt ()
   "Specify 10-point output for `handwrite.
@@ -269,14 +286,6 @@ values for `handwrite-linespace' and `handwrite-numlines'."
   (setq handwrite-fontsize 10)
   (setq handwrite-linespace 11)
   (setq handwrite-numlines handwrite-10pt-numlines)
-  (define-key menu-bar-handwrite-map [10pt]
-    '("10 pt *" . handwrite-10pt))
-  (define-key menu-bar-handwrite-map [11pt]
-    '("11 pt" . handwrite-11pt))
-  (define-key menu-bar-handwrite-map [12pt]
-    '("12 pt" . handwrite-12pt))
-  (define-key menu-bar-handwrite-map [13pt]
-    '("13 pt" . handwrite-13pt))
   (message "Handwrite output size set to 10 points"))
 
 
@@ -288,14 +297,6 @@ values for `handwrite-linespace' and `handwrite-numlines'."
   (setq handwrite-fontsize 11)
   (setq handwrite-linespace 12)
   (setq handwrite-numlines handwrite-11pt-numlines)
-  (define-key menu-bar-handwrite-map [10pt]
-    '("10 pt" . handwrite-10pt))
-  (define-key menu-bar-handwrite-map [11pt]
-    '("11 pt *" . handwrite-11pt))
-  (define-key menu-bar-handwrite-map [12pt]
-    '("12 pt" . handwrite-12pt))
-  (define-key menu-bar-handwrite-map [13pt]
-    '("13 pt" . handwrite-13pt))
   (message "Handwrite output size set to 11 points"))
 
 (defun handwrite-12pt ()
@@ -306,14 +307,6 @@ values for `handwrite-linespace' and `handwrite-numlines'."
   (setq handwrite-fontsize 12)
   (setq handwrite-linespace 13)
   (setq handwrite-numlines handwrite-12pt-numlines)
-  (define-key menu-bar-handwrite-map [10pt]
-    '("10 pt" . handwrite-10pt))
-  (define-key menu-bar-handwrite-map [11pt]
-    '("11 pt" . handwrite-11pt))
-  (define-key menu-bar-handwrite-map [12pt]
-    '("12 pt *" . handwrite-12pt))
-  (define-key menu-bar-handwrite-map [13pt]
-    '("13 pt" . handwrite-13pt))
   (message "Handwrite output size set to 12 points"))
 
 (defun handwrite-13pt ()
@@ -324,14 +317,6 @@ values for `handwrite-linespace' and `handwrite-numlines'."
   (setq handwrite-fontsize 13)
   (setq handwrite-linespace 14)
   (setq handwrite-numlines handwrite-13pt-numlines)
-  (define-key menu-bar-handwrite-map [10pt]
-    '("10 pt" . handwrite-10pt))
-  (define-key menu-bar-handwrite-map [11pt]
-    '("11 pt" . handwrite-11pt))
-  (define-key menu-bar-handwrite-map [12pt]
-    '("12 pt" . handwrite-12pt))
-  (define-key menu-bar-handwrite-map [13pt]
-    '("13 pt *" . handwrite-13pt))
   (message "Handwrite output size set to 13 points"))
 
 
@@ -1264,64 +1249,25 @@ end
 ;;Sets page numbering off
 (defun handwrite-set-pagenumber-off ()
   (setq handwrite-pagenumbering nil)
-  (define-key menu-bar-handwrite-map
-    [numbering]
-    '("Page numbering Off" . handwrite-set-pagenumber))
   (message "page numbering off"))
 
 ;;Sets page numbering on
 (defun handwrite-set-pagenumber-on ()
   (setq handwrite-pagenumbering t)
-  (define-key menu-bar-handwrite-map
-    [numbering]
-    '("Page numbering On" . handwrite-set-pagenumber))
   (message "page numbering on" ))
 
 
 ;; Key bindings
 
-
-;;; I'd rather not fill up the menu bar menus with
-;;; lots of random miscellaneous features. -- rms.
+;; 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)
 
-(define-key menu-bar-handwrite-map [numbering]
-  '("Page numbering Off" . handwrite-set-pagenumber))
-
-(define-key menu-bar-handwrite-map [10pt]
-  '("10 pt" . handwrite-10pt))
-
-(define-key menu-bar-handwrite-map [11pt]
-  '("11 pt *" . handwrite-11pt))
-
-(define-key menu-bar-handwrite-map [12pt]
-  '("12 pt" . handwrite-12pt))
-
-(define-key menu-bar-handwrite-map [13pt]
-  '("13 pt" . handwrite-13pt))
-
-(define-key menu-bar-handwrite-map [handwrite]
-  '("Write by hand" . handwrite))
-
-(define-key-after
-  (lookup-key menu-bar-handwrite-map [ ])
-  [handwrite-separator1]
-  '("----" . nil)
-  'handwrite)
-
-(define-key-after
-  (lookup-key menu-bar-handwrite-map [ ])
-  [handwrite-separator2]
-  '("----" . nil)
-  '10pt)
-
-
 (provide 'handwrite)
 
 
-;; arch-tag: f2285ae9-e41b-4c96-8343-87dce41e44b7
 ;;; handwrite.el ends here