diff options
author | Stefan Monnier <monnier@iro.umontreal.ca> | 2013-07-24 00:37:11 -0400 |
---|---|---|
committer | Stefan Monnier <monnier@iro.umontreal.ca> | 2013-07-24 00:37:11 -0400 |
commit | 2cdeb903c57126d3ad5f0cbd72e182584b76ee29 (patch) | |
tree | 2475b4233da4f4e9cd8e54dab9cea3779349767a /lisp/dos-w32.el | |
parent | 73600831f34b22ea82c02b2f2005c1ab6004f39c (diff) | |
download | emacs-2cdeb903c57126d3ad5f0cbd72e182584b76ee29.tar.gz emacs-2cdeb903c57126d3ad5f0cbd72e182584b76ee29.tar.bz2 emacs-2cdeb903c57126d3ad5f0cbd72e182584b76ee29.zip |
* lisp/lpr.el: Signal print errors more prominently.
(print-region-function): Don't default to nil.
(lpr-print-region): New function, extracted from print-region-1.
Check lpr's return value and signal an error in case of problem.
(print-region-1): Use it.
* lisp/ps-print.el (ps-windows-system, ps-lp-system): Remove. Use the lpr-*
versions instead.
(ps-printer-name): Default to nil.
(ps-printer-name-option): Default to lpr-printer-switch.
(ps-print-region-function): Don't default to nil.
(ps-postscript-code-directory): Simplify default.
(ps-do-despool): Use lpr-print-region to properly check the outcome.
(ps-string-list, ps-eval-switch, ps-flatten-list)
(ps-flatten-list-1): Remove.
(ps-multibyte-buffer): Avoid setq.
* lisp/dos-w32.el (direct-print-region-helper): Use proper regexp operators.
(print-region-function, ps-print-region-function): Don't set them here.
Diffstat (limited to 'lisp/dos-w32.el')
-rw-r--r-- | lisp/dos-w32.el | 21 |
1 files changed, 9 insertions, 12 deletions
diff --git a/lisp/dos-w32.el b/lisp/dos-w32.el index ff4a3ad66f0..0573caa6c23 100644 --- a/lisp/dos-w32.el +++ b/lisp/dos-w32.el @@ -257,10 +257,10 @@ filesystem mounted on drive Z:, FILESYSTEM could be \"Z:\"." ;; Function to actually send data to the printer port. ;; Supports writing directly, and using various programs. (defun direct-print-region-helper (printer - start end - lpr-prog - _delete-text _buf _display - rest) + start end + lpr-prog + _delete-text _buf _display + rest) (let* (;; Ignore case when matching known external program names. (case-fold-search t) ;; Convert / to \ in printer name, for sake of external programs. @@ -295,12 +295,14 @@ filesystem mounted on drive Z:, FILESYSTEM could be \"Z:\"." (unwind-protect (cond ;; nprint.exe is the standard print command on Netware - ((string-match-p "^nprint\\(\\.exe\\)?$" (file-name-nondirectory lpr-prog)) + ((string-match-p "\\`nprint\\(\\.exe\\)?\\'" + (file-name-nondirectory lpr-prog)) (write-region start end tempfile nil 0) (call-process lpr-prog nil errbuf nil tempfile (concat "P=" printer))) ;; print.exe is a standard command on NT - ((string-match-p "^print\\(\\.exe\\)?$" (file-name-nondirectory lpr-prog)) + ((string-match-p "\\`print\\(\\.exe\\)?\\'" + (file-name-nondirectory lpr-prog)) ;; Be careful not to invoke print.exe on MS-DOS or Windows 9x ;; though, because it is a TSR program there (hangs Emacs). (or (and (eq system-type 'windows-nt) @@ -369,7 +371,7 @@ indicates a specific program should be invoked." (write-region-annotate-functions (cons (lambda (_start end) - (if (not (char-equal (char-before end) ?\C-l)) + (if (not (char-equal (char-before end) ?\f)) `((,end . "\f")))) write-region-annotate-functions)) (printer (or (and (boundp 'dos-printer) @@ -383,9 +385,7 @@ indicates a specific program should be invoked." (direct-print-region-helper printer start end lpr-prog delete-text buf display rest))) -(defvar print-region-function) (defvar lpr-headers-switches) -(setq print-region-function 'direct-print-region-function) ;; Set this to nil if you have a port of the `pr' program ;; (e.g., from GNU Textutils), or if you have an `lpr' @@ -416,9 +416,6 @@ indicates a specific program should be invoked." (direct-print-region-helper printer start end lpr-prog delete-text buf display rest))) -(defvar ps-print-region-function) -(setq ps-print-region-function 'direct-ps-print-region-function) - ;(setq ps-lpr-command "gs") ;(setq ps-lpr-switches '("-q" "-dNOPAUSE" "-sDEVICE=epson" "-r240x60" |