diff options
Diffstat (limited to 'lisp/printing.el')
-rw-r--r-- | lisp/printing.el | 344 |
1 files changed, 163 insertions, 181 deletions
diff --git a/lisp/printing.el b/lisp/printing.el index 2f234b7b052..e7aab901d53 100644 --- a/lisp/printing.el +++ b/lisp/printing.el @@ -103,14 +103,14 @@ Please send all bug fixes and enhancements to ;; For example, after previewing a PostScript file, *Printing Command Output* ;; will have the following entry: ;; -;; /usr/X11R6/bin/gv ("/home/user/example/file.ps") +;; /usr/bin/gv ("/home/user/example/file.ps") ;; Exit status: 0 ;; ;; In the example above, the previewing was successful. If during previewing, ;; you quit gv execution (by typing C-g during Emacs session), the log entry ;; would be: ;; -;; /usr/X11R6/bin/gv ("/home/user/example/file.ps") +;; /usr/bin/gv ("/home/user/example/file.ps") ;; Exit status: Quit ;; ;; So, if something goes wrong, a good place to take a look is the buffer @@ -264,7 +264,7 @@ Please send all bug fixes and enhancements to ;; Also the gsprint utility comes together with gsview distribution. ;; ;; For more information about gsprint see -;; `http://www.cs.wisc.edu/~ghost/gsview/gsprint.htm'. +;; `https://www.cs.wisc.edu/~ghost/gsview/gsprint.htm'. ;; ;; As an example of gsprint declaration: ;; @@ -950,18 +950,18 @@ Please send all bug fixes and enhancements to ;; * For GNU or Unix system: ;; ;; gs, gv `https://www.gnu.org/software/ghostscript/ghostscript.html' -;; enscript `http://people.ssh.fi/mtr/genscript/' +;; enscript `https://people.ssh.fi/mtr/genscript/' ;; psnup `http://www.knackered.org/angus/psutils/' -;; mpage `http://www.mesa.nl/pub/mpage/' +;; mpage `https://www.mesa.nl/pub/mpage/' ;; ;; * For Windows system: ;; ;; gswin32, gsview32 ;; `https://www.gnu.org/software/ghostscript/ghostscript.html' -;; gsprint `http://www.cs.wisc.edu/~ghost/gsview/gsprint.htm'. -;; enscript `http://people.ssh.fi/mtr/genscript/' +;; gsprint `https://www.cs.wisc.edu/~ghost/gsview/gsprint.htm'. +;; enscript `https://people.ssh.fi/mtr/genscript/' ;; psnup `http://gnuwin32.sourceforge.net/packages/psutils.htm' -;; redmon `http://www.cs.wisc.edu/~ghost/redmon/' +;; redmon `http://www.ghostgum.com.au/software/redmon.htm' ;; ;; ;; Acknowledgments @@ -1014,7 +1014,6 @@ Please send all bug fixes and enhancements to (require 'lpr) (require 'ps-print) -(require 'easymenu) (and (string< ps-print-version "6.6.4") (error "`printing' requires `ps-print' package version 6.6.4 or later")) @@ -1082,24 +1081,15 @@ Used by `pr-menu-bind' and `pr-update-menus'.") "Specify Printing menu-bar entry.") (defun pr-global-menubar (menu-spec) - (let ((menu-file '("menu-bar" "file"))) - (cond - (pr-menu-print-item - (easy-menu-add-item global-map menu-file - (easy-menu-create-menu "Print" menu-spec) - "print-buffer") - (dolist (item '("print-buffer" "print-region" - "ps-print-buffer-faces" "ps-print-region-faces" - "ps-print-buffer" "ps-print-region")) - (easy-menu-remove-item global-map menu-file item)) - (setq pr-menu-print-item nil - pr-menu-bar (vector 'menu-bar - (easy-menu-intern (nth 1 menu-file)) - (easy-menu-intern "Print")))) - (t - (easy-menu-add-item global-map menu-file - (easy-menu-create-menu "Print" menu-spec))) - ))) + (let ((menu-file '("menu-bar" "file")) + (submenu-path [menu-bar file Print]) + (submenu (easy-menu-create-menu "Print" menu-spec))) + (cond (pr-menu-print-item + (easy-menu-add-item global-map menu-file submenu "Print") + (easy-menu-remove-item global-map menu-file "print") + (setq pr-menu-print-item nil + pr-menu-bar submenu-path)) + (t (easy-menu-add-item global-map menu-file submenu))))) (defun pr-menu-position (entry index horizontal) (let ((pos (cdr (mouse-pixel-position)))) @@ -1521,22 +1511,19 @@ Examples: Useful links: * Information about the print command (print.exe) - `http://www.computerhope.com/printhlp.htm' + `https://www.computerhope.com/printhlp.htm' * RedMon - Redirection Port Monitor (redpr.exe) - `http://www.cs.wisc.edu/~ghost/redmon/index.htm' + `http://www.ghostgum.com.au/software/redmon.htm' * Redirection Port Monitor (redpr.exe on-line help) - `http://www.cs.wisc.edu/~ghost/redmon/en/redmon.htm' + `https://www.cs.wisc.edu/~ghost/redmon/en/redmon.htm' * UNIX man pages: lpr (or type `man lpr') - `http://bama.ua.edu/cgi-bin/man-cgi?lpr' - `http://www.mediacollege.com/cgi-bin/man/page.cgi?section=all&topic=lpr' + `https://linux.die.net/man/1/lpr-cups' * UNIX man pages: lp (or type `man lp') - `http://bama.ua.edu/cgi-bin/man-cgi?lp' - `http://www.mediacollege.com/cgi-bin/man/page.cgi?section=all&topic=lp' -" + `https://linux.die.net/man/1/lp'" :type '(repeat (list :tag "Text Printer" (symbol :tag "Printer Symbol Name") @@ -1761,30 +1748,28 @@ are not printed. Useful links: * GSPRINT - Ghostscript print to Windows printer - `http://www.cs.wisc.edu/~ghost/gsview/gsprint.htm' + `https://www.cs.wisc.edu/~ghost/gsview/gsprint.htm' * Introduction to Ghostscript - `http://www.cs.wisc.edu/~ghost/doc/intro.htm' + `https://www.cs.wisc.edu/~ghost/doc/intro.htm' * How to use Ghostscript - `http://www.cs.wisc.edu/~ghost/doc/cvs/Use.htm' + `https://www.cs.wisc.edu/~ghost/doc/cvs/Use.htm' * Information about the print command (print.exe) - `http://www.computerhope.com/printhlp.htm' + `https://www.computerhope.com/printhlp.htm' * RedMon - Redirection Port Monitor (redpr.exe) - `http://www.cs.wisc.edu/~ghost/redmon/index.htm' + `http://www.ghostgum.com.au/software/redmon.htm' * Redirection Port Monitor (redpr.exe on-line help) - `http://www.cs.wisc.edu/~ghost/redmon/en/redmon.htm' + `https://www.cs.wisc.edu/~ghost/redmon/en/redmon.htm' * UNIX man pages: lpr (or type `man lpr') - `http://bama.ua.edu/cgi-bin/man-cgi?lpr' - `http://www.mediacollege.com/cgi-bin/man/page.cgi?section=all&topic=lpr' + `https://linux.die.net/man/1/lpr-cups' * UNIX man pages: lp (or type `man lp') - `http://bama.ua.edu/cgi-bin/man-cgi?lp' - `http://www.mediacollege.com/cgi-bin/man/page.cgi?section=all&topic=lp' + `https://linux.die.net/man/1/lp' * GNU utilities for w32 (cp.exe) `http://unxutils.sourceforge.net/' @@ -1874,28 +1859,28 @@ Useful links: `https://www.gnu.org/software/gv/manual/gv.html' * GSview Help - `http://www.cs.wisc.edu/~ghost/gsview/gsviewen.htm' + `https://www.cs.wisc.edu/~ghost/gsview/gsviewen.htm' * GSview Help - Common Problems - `http://www.cs.wisc.edu/~ghost/gsview/gsviewen.htm#Common_Problems' + `https://www.cs.wisc.edu/~ghost/gsview/gsviewen.htm#Common_Problems' * GSview Readme (compilation & installation) - `http://www.cs.wisc.edu/~ghost/gsview/Readme.htm' + `https://www.cs.wisc.edu/~ghost/gsview/Readme.htm' * GSview (main site) - `http://www.cs.wisc.edu/~ghost/gsview/index.htm' + `https://www.cs.wisc.edu/~ghost/gsview/index.htm' * Ghostscript, Ghostview and GSview - `http://www.cs.wisc.edu/~ghost/' + `https://www.cs.wisc.edu/~ghost/' * Ghostview - `http://www.cs.wisc.edu/~ghost/gv/index.htm' + `https://www.cs.wisc.edu/~ghost/gv/index.htm' * gv 3.5, June 1997 - `http://www.cs.wisc.edu/~ghost/gv/gv_doc/gv.html' + `http://pages.cs.wisc.edu/~ghost/gv/gv_doc/gv.html' * MacGSView (Mac OS) - `http://www.cs.wisc.edu/~ghost/macos/index.htm' + `http://pages.cs.wisc.edu/~ghost/macos/index.htm' " :type '(string :tag "Ghostview Utility")) @@ -1911,16 +1896,16 @@ See also `pr-path-alist'. Useful links: * Ghostscript, Ghostview and GSview - `http://www.cs.wisc.edu/~ghost/' + `https://www.cs.wisc.edu/~ghost/' * Introduction to Ghostscript - `http://www.cs.wisc.edu/~ghost/doc/intro.htm' + `https://www.cs.wisc.edu/~ghost/doc/intro.htm' * How to use Ghostscript - `http://www.cs.wisc.edu/~ghost/doc/cvs/Use.htm' + `https://www.cs.wisc.edu/~ghost/doc/cvs/Use.htm' * Printer compatibility - `http://www.cs.wisc.edu/~ghost/doc/printer.htm' + `https://www.cs.wisc.edu/~ghost/doc/printer.htm' " :type '(string :tag "Ghostscript Utility")) @@ -1955,13 +1940,13 @@ To see ghostscript documentation for more information: Useful links: * Introduction to Ghostscript - `http://www.cs.wisc.edu/~ghost/doc/intro.htm' + `https://www.cs.wisc.edu/~ghost/doc/intro.htm' * How to use Ghostscript - `http://www.cs.wisc.edu/~ghost/doc/cvs/Use.htm' + `https://www.cs.wisc.edu/~ghost/doc/cvs/Use.htm' * Printer compatibility - `http://www.cs.wisc.edu/~ghost/doc/printer.htm' + `https://www.cs.wisc.edu/~ghost/doc/printer.htm' " :type '(repeat (string :tag "Ghostscript Switch"))) @@ -2408,11 +2393,10 @@ Examples: Useful links: * mpage download (GNU or Unix) - `http://www.mesa.nl/pub/mpage/' + `https://www.mesa.nl/pub/mpage/' * mpage documentation (GNU or Unix - or type `man mpage') - `http://www.cs.umd.edu/faq/guides/manual_unix/node48.html' - `http://www.rt.com/man/mpage.1.html' + `https://linux.die.net/man/1/mpage' * psnup (Windows, GNU or Unix) `http://www.knackered.org/angus/psutils/' @@ -2422,14 +2406,13 @@ Useful links: `http://gnuwin32.sourceforge.net/packages/psutils.htm' * psnup documentation (GNU or Unix - or type `man psnup') - `http://linux.about.com/library/cmd/blcmdl1_psnup.htm' - `http://amath.colorado.edu/computing/software/man/psnup.html' + `https://linux.die.net/man/1/psnup' * GNU Enscript (Windows, GNU or Unix) - `http://people.ssh.com/mtr/genscript/' + `https://people.ssh.com/mtr/genscript/' * GNU Enscript documentation (Windows, GNU or Unix) - `http://people.ssh.com/mtr/genscript/enscript.man.html' + `https://people.ssh.com/mtr/genscript/enscript.man.html' (on GNU or Unix, type `man enscript') " :type '(repeat @@ -4783,13 +4766,13 @@ If menu binding was not done, calls `pr-menu-bind'." (defun pr-menu-create (name alist var-sym fun entry index) (cons name (mapcar - #'(lambda (elt) - (let ((sym (car elt))) - (vector - (symbol-name sym) - `(,fun ',sym nil ',entry ',index) - :style 'radio - :selected `(eq ,var-sym ',sym)))) + (lambda (elt) + (let ((sym (car elt))) + (vector + (symbol-name sym) + `(,fun ',sym nil ',entry ',index) + :style 'radio + :selected `(eq ,var-sym ',sym)))) alist))) @@ -4891,23 +4874,23 @@ If menu binding was not done, calls `pr-menu-bind'." (cons inherits old))))) (mapc (cond ((not local) ; global settings - #'(lambda (option) - (let ((var-sym (car option))) - (or (eq var-sym 'inherits-from:) - (set var-sym (eval (cdr option))))))) + (lambda (option) + (let ((var-sym (car option))) + (or (eq var-sym 'inherits-from:) + (set var-sym (eval (cdr option))))))) (kill ; local settings with killing - #'(lambda (option) - (let ((var-sym (car option))) - (unless (eq var-sym 'inherits-from:) - (setq local-list (cons var-sym local-list)) - (set (make-local-variable var-sym) - (eval (cdr option))))))) + (lambda (option) + (let ((var-sym (car option))) + (unless (eq var-sym 'inherits-from:) + (setq local-list (cons var-sym local-list)) + (set (make-local-variable var-sym) + (eval (cdr option))))))) (t ; local settings without killing - #'(lambda (option) - (let ((var-sym (car option))) - (or (eq var-sym 'inherits-from:) - (set (make-local-variable var-sym) - (eval (cdr option)))))))) + (lambda (option) + (let ((var-sym (car option))) + (or (eq var-sym 'inherits-from:) + (set (make-local-variable var-sym) + (eval (cdr option)))))))) (nthcdr 3 setting)) local-list)))) @@ -5085,9 +5068,9 @@ If menu binding was not done, calls `pr-menu-bind'." (defun pr-complete-alist (prompt alist default) - (let ((collection (mapcar #'(lambda (elt) - (setq elt (car elt)) - (cons (symbol-name elt) elt)) + (let ((collection (mapcar (lambda (elt) + (setq elt (car elt)) + (cons (symbol-name elt) elt)) alist))) (cdr (assoc (completing-read (concat prompt ": ") collection nil t @@ -5421,19 +5404,19 @@ If menu binding was not done, calls `pr-menu-bind'." (defun pr-file-list (dir file-regexp fun) - (mapcar #'(lambda (file) - (and (or pr-list-directory - (not (file-directory-p file))) - (let ((buffer (pr-find-buffer-visiting file)) - pop-up-windows - pop-up-frames) - (and (or buffer - (file-readable-p file)) - (with-current-buffer (or buffer - (find-file-noselect file)) - (funcall fun) - (or buffer - (kill-buffer (current-buffer)))))))) + (mapcar (lambda (file) + (and (or pr-list-directory + (not (file-directory-p file))) + (let ((buffer (pr-find-buffer-visiting file)) + pop-up-windows + pop-up-frames) + (and (or buffer + (file-readable-p file)) + (with-current-buffer (or buffer + (find-file-noselect file)) + (funcall fun) + (or buffer + (kill-buffer (current-buffer)))))))) (directory-files dir t file-regexp))) @@ -5446,10 +5429,10 @@ If menu binding was not done, calls `pr-menu-bind'." (pr-delete-file-if-exists (setq filename (expand-file-name filename))) (let ((pr-spool-p t)) (pr-file-list dir file-regexp - #'(lambda () - (if (pr-auto-mode-p) - (pr-ps-mode n-up filename) - (pr-text2ps 'buffer n-up filename))))) + (lambda () + (if (pr-auto-mode-p) + (pr-ps-mode n-up filename) + (pr-text2ps 'buffer n-up filename))))) (or pr-spool-p (pr-despool-print filename))) @@ -5680,44 +5663,44 @@ COMMAND.exe, COMMAND.bat and COMMAND.com in this order." (pr-insert-checkbox "\n " 'pr-i-region - #'(lambda (widget &rest _ignore) - (let ((region-p (pr-interface-save - (ps-mark-active-p)))) - (cond ((null (widget-value widget)) ; widget is nil - (setq pr-i-region nil)) - (region-p ; widget is true and there is a region - (setq pr-i-region t) - (widget-value-set widget t) - (widget-setup)) ; MUST be called after widget-value-set - (t ; widget is true and there is no region - (ding) - (message "There is no region active") - (setq pr-i-region nil) - (widget-value-set widget nil) - (widget-setup))))) ; MUST be called after widget-value-set + (lambda (widget &rest _ignore) + (let ((region-p (pr-interface-save + (ps-mark-active-p)))) + (cond ((null (widget-value widget)) ; widget is nil + (setq pr-i-region nil)) + (region-p ; widget is true and there is a region + (setq pr-i-region t) + (widget-value-set widget t) + (widget-setup)) ; MUST be called after widget-value-set + (t ; widget is true and there is no region + (ding) + (message "There is no region active") + (setq pr-i-region nil) + (widget-value-set widget nil) + (widget-setup))))) ; MUST be called after widget-value-set " Region")) ;; 1a. Buffer: Mode (put 'pr-i-mode 'pr-widget (pr-insert-checkbox " " 'pr-i-mode - #'(lambda (widget &rest _ignore) - (let ((mode-p (pr-interface-save - (pr-mode-alist-p)))) - (cond - ((null (widget-value widget)) ; widget is nil - (setq pr-i-mode nil)) - (mode-p ; widget is true and there is a `mode' - (setq pr-i-mode t) - (widget-value-set widget t) - (widget-setup)) ; MUST be called after widget-value-set - (t ; widget is true and there is no `mode' - (ding) - (message - "This buffer isn't in a mode that printing treats specially.") - (setq pr-i-mode nil) - (widget-value-set widget nil) - (widget-setup))))) ; MUST be called after widget-value-set + (lambda (widget &rest _ignore) + (let ((mode-p (pr-interface-save + (pr-mode-alist-p)))) + (cond + ((null (widget-value widget)) ; widget is nil + (setq pr-i-mode nil)) + (mode-p ; widget is true and there is a `mode' + (setq pr-i-mode t) + (widget-value-set widget t) + (widget-setup)) ; MUST be called after widget-value-set + (t ; widget is true and there is no `mode' + (ding) + (message + "This buffer isn't in a mode that printing treats specially.") + (setq pr-i-mode nil) + (widget-value-set widget nil) + (widget-setup))))) ; MUST be called after widget-value-set " Mode\n")) ;; 1b. Directory: @@ -5777,14 +5760,14 @@ COMMAND.exe, COMMAND.bat and COMMAND.com in this order." (pr-insert-checkbox " " 'pr-i-despool - #'(lambda (widget &rest _ignore) - (if pr-spool-p - (setq pr-i-despool (not pr-i-despool)) - (ding) - (message "Can despool only when spooling is actually selected") - (setq pr-i-despool nil)) - (widget-value-set widget pr-i-despool) - (widget-setup)) ; MUST be called after widget-value-set + (lambda (widget &rest _ignore) + (if pr-spool-p + (setq pr-i-despool (not pr-i-despool)) + (ding) + (message "Can despool only when spooling is actually selected") + (setq pr-i-despool nil)) + (widget-value-set widget pr-i-despool) + (widget-setup)) ; MUST be called after widget-value-set " Despool ")) ;; 2. PostScript Printer: Preview Print Quit (pr-insert-button 'pr-interface-preview "Preview" " ") @@ -5843,9 +5826,9 @@ COMMAND.exe, COMMAND.bat and COMMAND.com in this order." ;; 4. Settings: ;; 4. Settings: Landscape Auto Region Verbose (pr-insert-checkbox "\n\n " 'ps-landscape-mode - #'(lambda (&rest _ignore) - (setq ps-landscape-mode (not ps-landscape-mode) - pr-file-landscape ps-landscape-mode)) + (lambda (&rest _ignore) + (setq ps-landscape-mode (not ps-landscape-mode) + pr-file-landscape ps-landscape-mode)) " Landscape ") (pr-insert-toggle 'pr-auto-region " Auto Region ") (pr-insert-toggle 'pr-buffer-verbose " Verbose\n ") @@ -5865,28 +5848,28 @@ COMMAND.exe, COMMAND.bat and COMMAND.com in this order." (pr-insert-toggle 'ps-zebra-stripes " Zebra Stripes") (pr-insert-checkbox " " 'pr-spool-p - #'(lambda (&rest _ignore) - (setq pr-spool-p (not pr-spool-p)) - (unless pr-spool-p - (setq pr-i-despool nil) - (pr-update-checkbox 'pr-i-despool))) + (lambda (&rest _ignore) + (setq pr-spool-p (not pr-spool-p)) + (unless pr-spool-p + (setq pr-i-despool nil) + (pr-update-checkbox 'pr-i-despool))) " Spool Buffer") ;; 4. Settings: Duplex Print with faces (pr-insert-checkbox "\n " 'ps-spool-duplex - #'(lambda (&rest _ignore) - (setq ps-spool-duplex (not ps-spool-duplex) - pr-file-duplex ps-spool-duplex)) + (lambda (&rest _ignore) + (setq ps-spool-duplex (not ps-spool-duplex) + pr-file-duplex ps-spool-duplex)) " Duplex ") (pr-insert-toggle 'pr-faces-p " Print with faces") ;; 4. Settings: Tumble Print via Ghostscript (pr-insert-checkbox "\n " 'ps-spool-tumble - #'(lambda (&rest _ignore) - (setq ps-spool-tumble (not ps-spool-tumble) - pr-file-tumble ps-spool-tumble)) + (lambda (&rest _ignore) + (setq ps-spool-tumble (not ps-spool-tumble) + pr-file-tumble ps-spool-tumble)) " Tumble ") (pr-insert-toggle 'pr-print-using-ghostscript " Print via Ghostscript\n ") @@ -5894,11 +5877,11 @@ COMMAND.exe, COMMAND.bat and COMMAND.com in this order." (pr-insert-toggle 'ps-print-upside-down " Upside-Down") (pr-insert-italic "\n\nSelect Pages : " 2 14) (pr-insert-menu "Page Parity" 'ps-even-or-odd-pages - (mapcar #'(lambda (alist) - (list 'choice-item - :format "%[%t%]" - :tag (cdr alist) - :value (car alist))) + (mapcar (lambda (alist) + (list 'choice-item + :format "%[%t%]" + :tag (cdr alist) + :value (car alist))) pr-even-or-odd-alist))) @@ -5906,7 +5889,7 @@ COMMAND.exe, COMMAND.bat and COMMAND.com in this order." ;; 5. Customize: (pr-insert-italic "\n\nCustomize : " 2 11) (pr-insert-button 'pr-customize "printing" " ") - (pr-insert-button #'(lambda (&rest _ignore) (ps-print-customize)) + (pr-insert-button (lambda (&rest _ignore) (ps-print-customize)) "ps-print" " ") (pr-insert-button 'lpr-customize "lpr")) @@ -6215,18 +6198,18 @@ COMMAND.exe, COMMAND.bat and COMMAND.com in this order." (defun pr-choice-alist (alist) - (let ((max (apply #'max (mapcar #'(lambda (alist) - (length (symbol-name (car alist)))) + (let ((max (apply #'max (mapcar (lambda (alist) + (length (symbol-name (car alist)))) alist)))) - (mapcar #'(lambda (alist) - (let* ((sym (car alist)) - (name (symbol-name sym))) - (list - 'choice-item - :format "%[%t%]" - :tag (concat name - (make-string (- max (length name)) ?_)) - :value sym))) + (mapcar (lambda (alist) + (let* ((sym (car alist)) + (name (symbol-name sym))) + (list + 'choice-item + :format "%[%t%]" + :tag (concat name + (make-string (- max (length name)) ?_)) + :value sym))) alist))) @@ -6235,5 +6218,4 @@ COMMAND.exe, COMMAND.bat and COMMAND.com in this order." (provide 'printing) - ;;; printing.el ends here |