;;; handwrite.el --- turns your emacs buffer into a handwritten document -*- coding: iso-latin-1; -*-
-;; Copyright (C) 1996, 2001, 2002, 2003, 2004, 2005,
-;; 2006, 2007, 2008 Free Software Foundation, Inc.
+;; Copyright (C) 1996, 2001-2011 Free Software Foundation, Inc.
;; Author: Danny Roozendaal (was: <danny@tvs.kun.nl>)
;; Created: October 21 1996
;;; 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
(defcustom handwrite-numlines 60
- "*The number of lines on a page of the PostScript output from `handwrite'."
+ "The number of lines on a page of the PostScript output from `handwrite'."
:type 'integer
:group 'handwrite)
(defcustom handwrite-fontsize 11
- "*The size of the font for the PostScript output from `handwrite'."
+ "The size of the font for the PostScript output from `handwrite'."
:type 'integer
:group 'handwrite)
(defcustom handwrite-linespace 12
- "*The spacing for the PostScript output from `handwrite'."
+ "The spacing for the PostScript output from `handwrite'."
:type 'integer
:group 'handwrite)
(defcustom handwrite-xstart 30
- "*X-axis translation in the PostScript output from `handwrite'."
+ "X-axis translation in the PostScript output from `handwrite'."
:type 'integer
:group 'handwrite)
(defcustom handwrite-ystart 810
- "*Y-axis translation in the PostScript output from `handwrite'."
+ "Y-axis translation in the PostScript output from `handwrite'."
:type 'integer
:group 'handwrite)
(defcustom handwrite-pagenumbering nil
- "*If non-nil, number each page of the PostScript output from `handwrite'."
+ "If non-nil, number each page of the PostScript output from `handwrite'."
:type 'boolean
:group 'handwrite)
(defcustom handwrite-10pt-numlines 65
- "*The number of lines on a page for the function `handwrite-10pt'."
+ "The number of lines on a page for the function `handwrite-10pt'."
:type 'integer
:group 'handwrite)
(defcustom handwrite-11pt-numlines 60
- "*The number of lines on a page for the function `handwrite-11pt'."
+ "The number of lines on a page for the function `handwrite-11pt'."
:type 'integer
:group 'handwrite)
(defcustom handwrite-12pt-numlines 55
- "*The number of lines on a page for the function `handwrite-12pt'."
+ "The number of lines on a page for the function `handwrite-12pt'."
:type 'integer
:group 'handwrite)
(defcustom handwrite-13pt-numlines 50
- "*The number of lines on a page for the function `handwrite-13pt'."
+ "The number of lines on a page for the function `handwrite-13pt'."
:type 'integer
:group 'handwrite)
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)
"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.
(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"))
(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 ()
(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 ()
(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"))
;;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