aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorXue Fuqiao2013-07-24 16:04:39 +0800
committerXue Fuqiao2013-07-24 16:04:39 +0800
commita61dba1c5a5f32827eeda649c9421fc92d742a3d (patch)
tree16c9e74645fc045c08bb2570826e60f57462e4f4
parent0e55c076ae7e22b1fecd6bbfca1356d5b2a9223e (diff)
parentff65ca0d81d219b326fa2a95cf77875c0e4b5eb6 (diff)
downloademacs-a61dba1c5a5f32827eeda649c9421fc92d742a3d.tar.gz
emacs-a61dba1c5a5f32827eeda649c9421fc92d742a3d.zip
Merge from mainline.
-rw-r--r--doc/lispref/ChangeLog6
-rw-r--r--doc/lispref/eval.texi11
-rw-r--r--etc/NEWS8
-rw-r--r--lisp/ChangeLog36
-rw-r--r--lisp/dos-w32.el21
-rw-r--r--lisp/emacs-lisp/pcase.el14
-rw-r--r--lisp/files.el224
-rw-r--r--lisp/lpr.el116
-rw-r--r--lisp/printing.el48
-rw-r--r--lisp/ps-mule.el1
-rw-r--r--lisp/ps-print.el138
-rw-r--r--src/ChangeLog7
-rw-r--r--src/eval.c6
13 files changed, 312 insertions, 324 deletions
diff --git a/doc/lispref/ChangeLog b/doc/lispref/ChangeLog
index 342c7c57175..08ec4c2fef8 100644
--- a/doc/lispref/ChangeLog
+++ b/doc/lispref/ChangeLog
@@ -1,3 +1,9 @@
12013-07-24 Paul Eggert <eggert@cs.ucla.edu>
2
3 * eval.texi (Special Forms): Mention 'lambda'. Also, say that
4 non-well-formed expressions result in unspecified behavior, though
5 Emacs will not crash.
6
12013-07-22 Michael Albinus <michael.albinus@gmx.de> 72013-07-22 Michael Albinus <michael.albinus@gmx.de>
2 8
3 * files.texi (Magic File Names): Add file-notify-add-watch, 9 * files.texi (Magic File Names): Add file-notify-add-watch,
diff --git a/doc/lispref/eval.texi b/doc/lispref/eval.texi
index 4b5ef187383..4b83d575fef 100644
--- a/doc/lispref/eval.texi
+++ b/doc/lispref/eval.texi
@@ -432,6 +432,14 @@ do.
432and which are used without evaluation. Whether a particular argument is 432and which are used without evaluation. Whether a particular argument is
433evaluated may depend on the results of evaluating other arguments. 433evaluated may depend on the results of evaluating other arguments.
434 434
435 If an expression's first symbol is that of a special form, the
436expression should follow the rules of that special form; otherwise,
437Emacs's behavior is not well-defined (though it will not crash). For
438example, @code{((lambda (x) x . 3) 4)} contains a subexpression that
439begins with @code{lambda} but is not a well-formed @code{lambda}
440expression, so Emacs may signal an error, or may return 3 or 4 or
441@code{nil}, or may behave in other ways.
442
435 Here is a list, in alphabetical order, of all of the special forms in 443 Here is a list, in alphabetical order, of all of the special forms in
436Emacs Lisp with a reference to where each is described. 444Emacs Lisp with a reference to where each is described.
437 445
@@ -463,6 +471,9 @@ Emacs Lisp with a reference to where each is described.
463@item interactive 471@item interactive
464@pxref{Interactive Call} 472@pxref{Interactive Call}
465 473
474@item lambda
475@pxref{Lambda Expressions}
476
466@item let 477@item let
467@itemx let* 478@itemx let*
468@pxref{Local Variables} 479@pxref{Local Variables}
diff --git a/etc/NEWS b/etc/NEWS
index e7d51a4033a..facadac5c1c 100644
--- a/etc/NEWS
+++ b/etc/NEWS
@@ -538,14 +538,6 @@ file using `set-file-extended-attributes'.
538** `visited-file-modtime' now returns -1 for nonexistent files. 538** `visited-file-modtime' now returns -1 for nonexistent files.
539Formerly it returned a list (-1 LOW USEC PSEC), but this was ambiguous 539Formerly it returned a list (-1 LOW USEC PSEC), but this was ambiguous
540in the presence of files with negative time stamps. 540in the presence of files with negative time stamps.
541
542** Special forms with implied progn now check for proper lists.
543Starting in Emacs 21.4, a special form with an implied progn of an
544improper list ignored the trailing value, treating it as nil. For
545example, (cond (t (message "hello") . "there")) ignored the "there".
546This inadvertent change to Emacs's behavior has been reverted, and
547Emacs now signals an error for these improper forms, as it did in
548version 21.3 and earlier.
549 541
550* Lisp Changes in Emacs 24.4 542* Lisp Changes in Emacs 24.4
551 543
diff --git a/lisp/ChangeLog b/lisp/ChangeLog
index 2ff5a50e171..886c3075653 100644
--- a/lisp/ChangeLog
+++ b/lisp/ChangeLog
@@ -1,3 +1,39 @@
12013-07-24 Glenn Morris <rgm@gnu.org>
2
3 * printing.el: Replace all uses of deleted ps-windows-system,
4 ps-lp-system, ps-flatten-list with lpr- versions.
5
62013-07-24 Stefan Monnier <monnier@iro.umontreal.ca>
7
8 * emacs-lisp/pcase.el (pcase--u1): Verify if self-quoting values can be
9 checked with memq (bug#14935).
10
11 * files.el (revert-buffer-function): Use a non-nil default.
12 (revert-buffer-preserve-modes): Declare var to
13 provide access to the `preserve-modes' argument.
14 (revert-buffer): Let-bind it.
15 (revert-buffer--default): New function, extracted from revert-buffer.
16
172013-07-24 Stefan Monnier <monnier@iro.umontreal.ca>
18
19 * lpr.el: Signal print errors more prominently.
20 (print-region-function): Don't default to nil.
21 (lpr-print-region): New function, extracted from print-region-1.
22 Check lpr's return value and signal an error in case of problem.
23 (print-region-1): Use it.
24 * ps-print.el (ps-windows-system, ps-lp-system): Remove. Use the lpr-*
25 versions instead.
26 (ps-printer-name): Default to nil.
27 (ps-printer-name-option): Default to lpr-printer-switch.
28 (ps-print-region-function): Don't default to nil.
29 (ps-postscript-code-directory): Simplify default.
30 (ps-do-despool): Use lpr-print-region to properly check the outcome.
31 (ps-string-list, ps-eval-switch, ps-flatten-list)
32 (ps-flatten-list-1): Remove.
33 (ps-multibyte-buffer): Avoid setq.
34 * dos-w32.el (direct-print-region-helper): Use proper regexp operators.
35 (print-region-function, ps-print-region-function): Don't set them here.
36
12013-07-24 Xue Fuqiao <xfq.free@gmail.com> 372013-07-24 Xue Fuqiao <xfq.free@gmail.com>
2 38
3 * ido.el (ido-fractionp): 39 * ido.el (ido-fractionp):
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:\"."
257;; Function to actually send data to the printer port. 257;; Function to actually send data to the printer port.
258;; Supports writing directly, and using various programs. 258;; Supports writing directly, and using various programs.
259(defun direct-print-region-helper (printer 259(defun direct-print-region-helper (printer
260 start end 260 start end
261 lpr-prog 261 lpr-prog
262 _delete-text _buf _display 262 _delete-text _buf _display
263 rest) 263 rest)
264 (let* (;; Ignore case when matching known external program names. 264 (let* (;; Ignore case when matching known external program names.
265 (case-fold-search t) 265 (case-fold-search t)
266 ;; Convert / to \ in printer name, for sake of external programs. 266 ;; Convert / to \ in printer name, for sake of external programs.
@@ -295,12 +295,14 @@ filesystem mounted on drive Z:, FILESYSTEM could be \"Z:\"."
295 (unwind-protect 295 (unwind-protect
296 (cond 296 (cond
297 ;; nprint.exe is the standard print command on Netware 297 ;; nprint.exe is the standard print command on Netware
298 ((string-match-p "^nprint\\(\\.exe\\)?$" (file-name-nondirectory lpr-prog)) 298 ((string-match-p "\\`nprint\\(\\.exe\\)?\\'"
299 (file-name-nondirectory lpr-prog))
299 (write-region start end tempfile nil 0) 300 (write-region start end tempfile nil 0)
300 (call-process lpr-prog nil errbuf nil 301 (call-process lpr-prog nil errbuf nil
301 tempfile (concat "P=" printer))) 302 tempfile (concat "P=" printer)))
302 ;; print.exe is a standard command on NT 303 ;; print.exe is a standard command on NT
303 ((string-match-p "^print\\(\\.exe\\)?$" (file-name-nondirectory lpr-prog)) 304 ((string-match-p "\\`print\\(\\.exe\\)?\\'"
305 (file-name-nondirectory lpr-prog))
304 ;; Be careful not to invoke print.exe on MS-DOS or Windows 9x 306 ;; Be careful not to invoke print.exe on MS-DOS or Windows 9x
305 ;; though, because it is a TSR program there (hangs Emacs). 307 ;; though, because it is a TSR program there (hangs Emacs).
306 (or (and (eq system-type 'windows-nt) 308 (or (and (eq system-type 'windows-nt)
@@ -369,7 +371,7 @@ indicates a specific program should be invoked."
369 (write-region-annotate-functions 371 (write-region-annotate-functions
370 (cons 372 (cons
371 (lambda (_start end) 373 (lambda (_start end)
372 (if (not (char-equal (char-before end) ?\C-l)) 374 (if (not (char-equal (char-before end) ?\f))
373 `((,end . "\f")))) 375 `((,end . "\f"))))
374 write-region-annotate-functions)) 376 write-region-annotate-functions))
375 (printer (or (and (boundp 'dos-printer) 377 (printer (or (and (boundp 'dos-printer)
@@ -383,9 +385,7 @@ indicates a specific program should be invoked."
383 (direct-print-region-helper printer start end lpr-prog 385 (direct-print-region-helper printer start end lpr-prog
384 delete-text buf display rest))) 386 delete-text buf display rest)))
385 387
386(defvar print-region-function)
387(defvar lpr-headers-switches) 388(defvar lpr-headers-switches)
388(setq print-region-function 'direct-print-region-function)
389 389
390;; Set this to nil if you have a port of the `pr' program 390;; Set this to nil if you have a port of the `pr' program
391;; (e.g., from GNU Textutils), or if you have an `lpr' 391;; (e.g., from GNU Textutils), or if you have an `lpr'
@@ -416,9 +416,6 @@ indicates a specific program should be invoked."
416 (direct-print-region-helper printer start end lpr-prog 416 (direct-print-region-helper printer start end lpr-prog
417 delete-text buf display rest))) 417 delete-text buf display rest)))
418 418
419(defvar ps-print-region-function)
420(setq ps-print-region-function 'direct-ps-print-region-function)
421
422;(setq ps-lpr-command "gs") 419;(setq ps-lpr-command "gs")
423 420
424;(setq ps-lpr-switches '("-q" "-dNOPAUSE" "-sDEVICE=epson" "-r240x60" 421;(setq ps-lpr-switches '("-q" "-dNOPAUSE" "-sDEVICE=epson" "-r240x60"
diff --git a/lisp/emacs-lisp/pcase.el b/lisp/emacs-lisp/pcase.el
index 511f1480099..50c92518b02 100644
--- a/lisp/emacs-lisp/pcase.el
+++ b/lisp/emacs-lisp/pcase.el
@@ -659,11 +659,15 @@ Otherwise, it defers to REST which is a list of branches of the form
659 (memq-fine t)) 659 (memq-fine t))
660 (when all 660 (when all
661 (dolist (alt (cdr upat)) 661 (dolist (alt (cdr upat))
662 (unless (or (pcase--self-quoting-p alt) 662 (unless (if (pcase--self-quoting-p alt)
663 (and (eq (car-safe alt) '\`) 663 (progn
664 (or (symbolp (cadr alt)) (integerp (cadr alt)) 664 (unless (or (symbolp alt) (integerp alt))
665 (setq memq-fine nil) 665 (setq memq-fine nil))
666 (stringp (cadr alt))))) 666 t)
667 (and (eq (car-safe alt) '\`)
668 (or (symbolp (cadr alt)) (integerp (cadr alt))
669 (setq memq-fine nil)
670 (stringp (cadr alt)))))
667 (setq all nil)))) 671 (setq all nil))))
668 (if all 672 (if all
669 ;; Use memq for (or `a `b `c `d) rather than a big tree. 673 ;; Use memq for (or `a `b `c `d) rather than a big tree.
diff --git a/lisp/files.el b/lisp/files.el
index ff4ccec2279..10d66e0b2e0 100644
--- a/lisp/files.el
+++ b/lisp/files.el
@@ -5246,10 +5246,12 @@ comparison."
5246 5246
5247 5247
5248(put 'revert-buffer-function 'permanent-local t) 5248(put 'revert-buffer-function 'permanent-local t)
5249(defvar revert-buffer-function nil 5249(defvar revert-buffer-function #'revert-buffer--default
5250 "Function to use to revert this buffer, or nil to do the default. 5250 "Function to use to revert this buffer, or nil to do the default.
5251The function receives two arguments IGNORE-AUTO and NOCONFIRM, 5251The function receives two arguments IGNORE-AUTO and NOCONFIRM,
5252which are the arguments that `revert-buffer' received.") 5252which are the arguments that `revert-buffer' received.
5253It also has access to the `preserve-modes' argument of `revert-buffer'
5254via the `revert-buffer-preserve-modes' dynamic variable.")
5253 5255
5254(put 'revert-buffer-insert-file-contents-function 'permanent-local t) 5256(put 'revert-buffer-insert-file-contents-function 'permanent-local t)
5255(defvar revert-buffer-insert-file-contents-function nil 5257(defvar revert-buffer-insert-file-contents-function nil
@@ -5296,6 +5298,11 @@ This is true even if a `revert-buffer-function' is being used.")
5296 5298
5297(defvar revert-buffer-internal-hook) 5299(defvar revert-buffer-internal-hook)
5298 5300
5301;; `revert-buffer-function' was defined long ago to be a function of only
5302;; 2 arguments, so we have to use a dynbind variable to pass the
5303;; `preserve-modes' argument of `revert-buffer'.
5304(defvar revert-buffer-preserve-modes)
5305
5299(defun revert-buffer (&optional ignore-auto noconfirm preserve-modes) 5306(defun revert-buffer (&optional ignore-auto noconfirm preserve-modes)
5300 "Replace current buffer text with the text of the visited file on disk. 5307 "Replace current buffer text with the text of the visited file on disk.
5301This undoes all changes since the file was visited or saved. 5308This undoes all changes since the file was visited or saved.
@@ -5337,112 +5344,113 @@ non-nil, it is called instead of rereading visited file contents."
5337 ;; reversal of the argument sense. So I'm just changing the user 5344 ;; reversal of the argument sense. So I'm just changing the user
5338 ;; interface, but leaving the programmatic interface the same. 5345 ;; interface, but leaving the programmatic interface the same.
5339 (interactive (list (not current-prefix-arg))) 5346 (interactive (list (not current-prefix-arg)))
5340 (if revert-buffer-function 5347 (let ((revert-buffer-in-progress-p t)
5341 (let ((revert-buffer-in-progress-p t)) 5348 (revert-buffer-preserve-modes preserve-modes))
5342 (funcall revert-buffer-function ignore-auto noconfirm)) 5349 (funcall (or revert-buffer-function #'revert-buffer--default)
5343 (with-current-buffer (or (buffer-base-buffer (current-buffer)) 5350 ignore-auto noconfirm)))
5344 (current-buffer)) 5351(defun revert-buffer--default (ignore-auto noconfirm)
5345 (let* ((revert-buffer-in-progress-p t) 5352 (with-current-buffer (or (buffer-base-buffer (current-buffer))
5346 (auto-save-p (and (not ignore-auto) 5353 (current-buffer))
5347 (recent-auto-save-p) 5354 (let* ((auto-save-p (and (not ignore-auto)
5348 buffer-auto-save-file-name 5355 (recent-auto-save-p)
5349 (file-readable-p buffer-auto-save-file-name) 5356 buffer-auto-save-file-name
5350 (y-or-n-p 5357 (file-readable-p buffer-auto-save-file-name)
5351 "Buffer has been auto-saved recently. Revert from auto-save file? "))) 5358 (y-or-n-p
5352 (file-name (if auto-save-p 5359 "Buffer has been auto-saved recently. Revert from auto-save file? ")))
5353 buffer-auto-save-file-name 5360 (file-name (if auto-save-p
5354 buffer-file-name))) 5361 buffer-auto-save-file-name
5355 (cond ((null file-name) 5362 buffer-file-name)))
5356 (error "Buffer does not seem to be associated with any file")) 5363 (cond ((null file-name)
5357 ((or noconfirm 5364 (error "Buffer does not seem to be associated with any file"))
5358 (and (not (buffer-modified-p)) 5365 ((or noconfirm
5359 (catch 'found 5366 (and (not (buffer-modified-p))
5360 (dolist (regexp revert-without-query) 5367 (catch 'found
5361 (when (string-match regexp file-name) 5368 (dolist (regexp revert-without-query)
5362 (throw 'found t))))) 5369 (when (string-match regexp file-name)
5363 (yes-or-no-p (format "Revert buffer from file %s? " 5370 (throw 'found t)))))
5364 file-name))) 5371 (yes-or-no-p (format "Revert buffer from file %s? "
5365 (run-hooks 'before-revert-hook) 5372 file-name)))
5366 ;; If file was backed up but has changed since, 5373 (run-hooks 'before-revert-hook)
5367 ;; we should make another backup. 5374 ;; If file was backed up but has changed since,
5368 (and (not auto-save-p) 5375 ;; we should make another backup.
5369 (not (verify-visited-file-modtime (current-buffer))) 5376 (and (not auto-save-p)
5370 (setq buffer-backed-up nil)) 5377 (not (verify-visited-file-modtime (current-buffer)))
5371 ;; Effectively copy the after-revert-hook status, 5378 (setq buffer-backed-up nil))
5372 ;; since after-find-file will clobber it. 5379 ;; Effectively copy the after-revert-hook status,
5373 (let ((global-hook (default-value 'after-revert-hook)) 5380 ;; since after-find-file will clobber it.
5374 (local-hook (when (local-variable-p 'after-revert-hook) 5381 (let ((global-hook (default-value 'after-revert-hook))
5375 after-revert-hook)) 5382 (local-hook (when (local-variable-p 'after-revert-hook)
5376 (inhibit-read-only t)) 5383 after-revert-hook))
5377 (cond 5384 (inhibit-read-only t))
5378 (revert-buffer-insert-file-contents-function 5385 (cond
5379 (unless (eq buffer-undo-list t) 5386 (revert-buffer-insert-file-contents-function
5380 ;; Get rid of all undo records for this buffer. 5387 (unless (eq buffer-undo-list t)
5381 (setq buffer-undo-list nil)) 5388 ;; Get rid of all undo records for this buffer.
5382 ;; Don't make undo records for the reversion. 5389 (setq buffer-undo-list nil))
5383 (let ((buffer-undo-list t)) 5390 ;; Don't make undo records for the reversion.
5384 (funcall revert-buffer-insert-file-contents-function 5391 (let ((buffer-undo-list t))
5385 file-name auto-save-p))) 5392 (funcall revert-buffer-insert-file-contents-function
5386 ((not (file-exists-p file-name)) 5393 file-name auto-save-p)))
5387 (error (if buffer-file-number 5394 ((not (file-exists-p file-name))
5388 "File %s no longer exists!" 5395 (error (if buffer-file-number
5389 "Cannot revert nonexistent file %s") 5396 "File %s no longer exists!"
5390 file-name)) 5397 "Cannot revert nonexistent file %s")
5391 ((not (file-readable-p file-name)) 5398 file-name))
5392 (error (if buffer-file-number 5399 ((not (file-readable-p file-name))
5393 "File %s no longer readable!" 5400 (error (if buffer-file-number
5394 "Cannot revert unreadable file %s") 5401 "File %s no longer readable!"
5395 file-name)) 5402 "Cannot revert unreadable file %s")
5396 (t 5403 file-name))
5397 ;; Bind buffer-file-name to nil 5404 (t
5398 ;; so that we don't try to lock the file. 5405 ;; Bind buffer-file-name to nil
5399 (let ((buffer-file-name nil)) 5406 ;; so that we don't try to lock the file.
5400 (or auto-save-p 5407 (let ((buffer-file-name nil))
5401 (unlock-buffer))) 5408 (or auto-save-p
5402 (widen) 5409 (unlock-buffer)))
5403 (let ((coding-system-for-read 5410 (widen)
5404 ;; Auto-saved file should be read by Emacs's 5411 (let ((coding-system-for-read
5405 ;; internal coding. 5412 ;; Auto-saved file should be read by Emacs's
5406 (if auto-save-p 'auto-save-coding 5413 ;; internal coding.
5407 (or coding-system-for-read 5414 (if auto-save-p 'auto-save-coding
5408 (and 5415 (or coding-system-for-read
5409 buffer-file-coding-system-explicit 5416 (and
5410 (car buffer-file-coding-system-explicit)))))) 5417 buffer-file-coding-system-explicit
5411 (if (and (not enable-multibyte-characters) 5418 (car buffer-file-coding-system-explicit))))))
5412 coding-system-for-read 5419 (if (and (not enable-multibyte-characters)
5413 (not (memq (coding-system-base 5420 coding-system-for-read
5414 coding-system-for-read) 5421 (not (memq (coding-system-base
5415 '(no-conversion raw-text)))) 5422 coding-system-for-read)
5416 ;; As a coding system suitable for multibyte 5423 '(no-conversion raw-text))))
5417 ;; buffer is specified, make the current 5424 ;; As a coding system suitable for multibyte
5418 ;; buffer multibyte. 5425 ;; buffer is specified, make the current
5419 (set-buffer-multibyte t)) 5426 ;; buffer multibyte.
5420 5427 (set-buffer-multibyte t))
5421 ;; This force after-insert-file-set-coding 5428
5422 ;; (called from insert-file-contents) to set 5429 ;; This force after-insert-file-set-coding
5423 ;; buffer-file-coding-system to a proper value. 5430 ;; (called from insert-file-contents) to set
5424 (kill-local-variable 'buffer-file-coding-system) 5431 ;; buffer-file-coding-system to a proper value.
5425 5432 (kill-local-variable 'buffer-file-coding-system)
5426 ;; Note that this preserves point in an intelligent way. 5433
5427 (if preserve-modes 5434 ;; Note that this preserves point in an intelligent way.
5428 (let ((buffer-file-format buffer-file-format)) 5435 (if revert-buffer-preserve-modes
5429 (insert-file-contents file-name (not auto-save-p) 5436 (let ((buffer-file-format buffer-file-format))
5430 nil nil t)) 5437 (insert-file-contents file-name (not auto-save-p)
5431 (insert-file-contents file-name (not auto-save-p) 5438 nil nil t))
5432 nil nil t))))) 5439 (insert-file-contents file-name (not auto-save-p)
5433 ;; Recompute the truename in case changes in symlinks 5440 nil nil t)))))
5434 ;; have changed the truename. 5441 ;; Recompute the truename in case changes in symlinks
5435 (setq buffer-file-truename 5442 ;; have changed the truename.
5436 (abbreviate-file-name (file-truename buffer-file-name))) 5443 (setq buffer-file-truename
5437 (after-find-file nil nil t nil preserve-modes) 5444 (abbreviate-file-name (file-truename buffer-file-name)))
5438 ;; Run after-revert-hook as it was before we reverted. 5445 (after-find-file nil nil t nil revert-buffer-preserve-modes)
5439 (setq-default revert-buffer-internal-hook global-hook) 5446 ;; Run after-revert-hook as it was before we reverted.
5440 (if local-hook 5447 (setq-default revert-buffer-internal-hook global-hook)
5441 (set (make-local-variable 'revert-buffer-internal-hook) 5448 (if local-hook
5442 local-hook) 5449 (set (make-local-variable 'revert-buffer-internal-hook)
5443 (kill-local-variable 'revert-buffer-internal-hook)) 5450 local-hook)
5444 (run-hooks 'revert-buffer-internal-hook)) 5451 (kill-local-variable 'revert-buffer-internal-hook))
5445 t)))))) 5452 (run-hooks 'revert-buffer-internal-hook))
5453 t)))))
5446 5454
5447(defun recover-this-file () 5455(defun recover-this-file ()
5448 "Recover the visited file--get contents from its last auto-save file." 5456 "Recover the visited file--get contents from its last auto-save file."
diff --git a/lisp/lpr.el b/lisp/lpr.el
index 0b860ed07f1..5aed3bcc484 100644
--- a/lisp/lpr.el
+++ b/lisp/lpr.el
@@ -130,10 +130,13 @@ and print the result."
130 (repeat :tag "Multiple arguments" (string :tag "Argument"))) 130 (repeat :tag "Multiple arguments" (string :tag "Argument")))
131 :group 'lpr) 131 :group 'lpr)
132 132
133(defcustom print-region-function nil 133(defcustom print-region-function
134 (if (memq system-type '(ms-dos windows-nt))
135 #'direct-print-region-function
136 #'call-process-region)
134 "Function to call to print the region on a printer. 137 "Function to call to print the region on a printer.
135See definition of `print-region-1' for calling conventions." 138See definition of `print-region-1' for calling conventions."
136 :type '(choice (const nil) function) 139 :type 'function
137 :group 'lpr) 140 :group 'lpr)
138 141
139(defcustom lpr-page-header-program "pr" 142(defcustom lpr-page-header-program "pr"
@@ -212,35 +215,24 @@ for further customization of the printer command."
212 (print-region-1 start end lpr-switches t)) 215 (print-region-1 start end lpr-switches t))
213 216
214(defun print-region-1 (start end switches page-headers) 217(defun print-region-1 (start end switches page-headers)
218 (and page-headers lpr-headers-switches
219 ;; It's possible to use an lpr option to get page headers.
220 (setq switches (append (if (stringp lpr-headers-switches)
221 (list lpr-headers-switches)
222 lpr-headers-switches)
223 switches)))
215 ;; On some MIPS system, having a space in the job name 224 ;; On some MIPS system, having a space in the job name
216 ;; crashes the printer demon. But using dashes looks ugly 225 ;; crashes the printer demon. But using dashes looks ugly
217 ;; and it seems to annoying to do for that MIPS system. 226 ;; and it seems to annoying to do for that MIPS system.
218 (let ((name (concat (buffer-name) " Emacs buffer")) 227 (save-excursion
219 (title (concat (buffer-name) " Emacs buffer")) 228 (let ((name (concat (buffer-name) " Emacs buffer"))
220 ;; Make pipes use the same coding system as 229 ;; Make pipes use the same coding system as
221 ;; writing the buffer to a file would. 230 ;; writing the buffer to a file would.
222 (coding-system-for-write (or coding-system-for-write 231 (coding-system-for-write (or coding-system-for-write
223 buffer-file-coding-system)) 232 buffer-file-coding-system))
224 (coding-system-for-read (or coding-system-for-read 233 (coding-system-for-read (or coding-system-for-read
225 buffer-file-coding-system)) 234 buffer-file-coding-system))
226 (width tab-width) 235 (width tab-width))
227 nswitches
228 switch-string)
229 (save-excursion
230 (and page-headers lpr-headers-switches
231 ;; It's possible to use an lpr option to get page headers.
232 (setq switches (append (if (stringp lpr-headers-switches)
233 (list lpr-headers-switches)
234 lpr-headers-switches)
235 switches)))
236 (setq nswitches (lpr-flatten-list
237 (mapcar 'lpr-eval-switch ; Dynamic evaluation
238 switches))
239 switch-string (if switches
240 (concat " with options "
241 (mapconcat 'identity switches " "))
242 ""))
243 (message "Spooling%s..." switch-string)
244 (if (/= tab-width 8) 236 (if (/= tab-width 8)
245 (let ((new-coords (print-region-new-buffer start end))) 237 (let ((new-coords (print-region-new-buffer start end)))
246 (setq start (car new-coords) 238 (setq start (car new-coords)
@@ -258,34 +250,48 @@ for further customization of the printer command."
258 (let ((new-coords (print-region-new-buffer start end))) 250 (let ((new-coords (print-region-new-buffer start end)))
259 (apply 'call-process-region (car new-coords) (cdr new-coords) 251 (apply 'call-process-region (car new-coords) (cdr new-coords)
260 lpr-page-header-program t t nil 252 lpr-page-header-program t t nil
261 (mapcar (lambda (e) (format e title)) 253 (mapcar (lambda (e) (format e name))
262 lpr-page-header-switches))) 254 lpr-page-header-switches)))
263 (setq start (point-min) 255 (setq start (point-min)
264 end (point-max)))) 256 end (point-max))))
265 (let ((buf (current-buffer))) 257 (lpr-print-region start end switches name))))
266 (with-temp-buffer 258
267 (let ((tempbuf (current-buffer))) 259(defun lpr-print-region (start end switches name)
268 (with-current-buffer buf 260 (let ((buf (current-buffer))
269 (apply (or print-region-function 'call-process-region) 261 (nswitches (lpr-flatten-list
270 (nconc (list start end lpr-command 262 (mapcar #'lpr-eval-switch ; Dynamic evaluation
271 nil tempbuf nil) 263 switches)))
272 (and lpr-add-switches 264 (switch-string (if switches
273 (list "-J" name)) 265 (concat " with options "
274 ;; These belong in pr if we are using that. 266 (mapconcat #'identity switches " "))
275 (and lpr-add-switches lpr-headers-switches 267 "")))
276 (list "-T" title)) 268 (message "Spooling%s..." switch-string)
277 (and (stringp printer-name) 269 (with-temp-buffer
278 (list (concat lpr-printer-switch 270 (let ((retval
279 printer-name))) 271 (let ((tempbuf (current-buffer)))
280 nswitches)))) 272 (with-current-buffer buf
281 (if (markerp end) 273 (apply (or print-region-function 'call-process-region)
282 (set-marker end nil)) 274 start end lpr-command
283 (message "Spooling%s...done%s%s" switch-string 275 nil tempbuf nil
284 (pcase (count-lines (point-min) (point-max)) 276 (nconc (and name lpr-add-switches
285 (0 "") 277 (list "-J" name))
286 (1 ": ") 278 ;; These belong in pr if we are using that.
287 (_ ":\n")) 279 (and name lpr-add-switches lpr-headers-switches
288 (buffer-string))))))) 280 (list "-T" name))
281 (and (stringp printer-name)
282 (string< "" printer-name)
283 (list (concat lpr-printer-switch
284 printer-name)))
285 nswitches))))))
286 (if (markerp end)
287 (set-marker end nil))
288 (funcall (if (memq retval '(nil 0)) #'message #'user-error)
289 "Spooling%s...done%s%s" switch-string
290 (pcase (count-lines (point-min) (point-max))
291 (0 "")
292 (1 ": ")
293 (_ ":\n"))
294 (buffer-string))))))
289 295
290;; This function copies the text between start and end 296;; This function copies the text between start and end
291;; into a new buffer, makes that buffer current. 297;; into a new buffer, makes that buffer current.
@@ -325,7 +331,7 @@ The characters tab, linefeed, space, return and formfeed are not affected."
325;; Dynamic evaluation 331;; Dynamic evaluation
326(defun lpr-eval-switch (arg) 332(defun lpr-eval-switch (arg)
327 (cond ((stringp arg) arg) 333 (cond ((stringp arg) arg)
328 ((functionp arg) (apply arg nil)) 334 ((functionp arg) (funcall arg))
329 ((symbolp arg) (symbol-value arg)) 335 ((symbolp arg) (symbol-value arg))
330 ((consp arg) (apply (car arg) (cdr arg))) 336 ((consp arg) (apply (car arg) (cdr arg)))
331 (t nil))) 337 (t nil)))
@@ -342,7 +348,7 @@ The characters tab, linefeed, space, return and formfeed are not affected."
342 348
343(defun lpr-flatten-list-1 (list) 349(defun lpr-flatten-list-1 (list)
344 (cond 350 (cond
345 ((null list) (list)) 351 ((null list) nil)
346 ((consp list) 352 ((consp list)
347 (append (lpr-flatten-list-1 (car list)) 353 (append (lpr-flatten-list-1 (car list))
348 (lpr-flatten-list-1 (cdr list)))) 354 (lpr-flatten-list-1 (cdr list))))
diff --git a/lisp/printing.el b/lisp/printing.el
index 18b2b89363b..2c807b078f5 100644
--- a/lisp/printing.el
+++ b/lisp/printing.el
@@ -1030,7 +1030,7 @@ Please send all bug fixes and enhancements to
1030 1030
1031 1031
1032(defconst pr-cygwin-system 1032(defconst pr-cygwin-system
1033 (and ps-windows-system (getenv "OSTYPE") 1033 (and lpr-windows-system (getenv "OSTYPE")
1034 (string-match "cygwin" (getenv "OSTYPE")))) 1034 (string-match "cygwin" (getenv "OSTYPE"))))
1035 1035
1036 1036
@@ -1414,7 +1414,7 @@ Used by `pr-menu-bind' and `pr-update-menus'.")
1414 1414
1415 (eval-and-compile 1415 (eval-and-compile
1416 (cond 1416 (cond
1417 (ps-windows-system 1417 (lpr-windows-system
1418 ;; GNU Emacs for Windows 9x/NT 1418 ;; GNU Emacs for Windows 9x/NT
1419 (defun pr-menu-position (entry index horizontal) 1419 (defun pr-menu-position (entry index horizontal)
1420 (let ((pos (cdr (mouse-pixel-position)))) 1420 (let ((pos (cdr (mouse-pixel-position))))
@@ -1614,7 +1614,7 @@ Used by `pr-menu-bind' and `pr-update-menus'.")
1614 "Ensure the proper directory separator depending on the OS. 1614 "Ensure the proper directory separator depending on the OS.
1615That is, if Emacs is running on DOS/Windows, ensure dos/windows-style directory 1615That is, if Emacs is running on DOS/Windows, ensure dos/windows-style directory
1616separator; otherwise, ensure unix-style directory separator." 1616separator; otherwise, ensure unix-style directory separator."
1617 (if (or pr-cygwin-system ps-windows-system) 1617 (if (or pr-cygwin-system lpr-windows-system)
1618 (subst-char-in-string ?/ ?\\ path) 1618 (subst-char-in-string ?/ ?\\ path)
1619 (subst-char-in-string ?\\ ?/ path))) 1619 (subst-char-in-string ?\\ ?/ path)))
1620 1620
@@ -1667,7 +1667,7 @@ separator; otherwise, ensure unix-style directory separator."
1667 1667
1668(defcustom pr-path-style 1668(defcustom pr-path-style
1669 (if (and (not pr-cygwin-system) 1669 (if (and (not pr-cygwin-system)
1670 ps-windows-system) 1670 lpr-windows-system)
1671 'windows 1671 'windows
1672 'unix) 1672 'unix)
1673 "Specify which path style to use for external commands. 1673 "Specify which path style to use for external commands.
@@ -1778,7 +1778,7 @@ function (see it for documentation) to update text printer menu."
1778(defcustom pr-txt-printer-alist 1778(defcustom pr-txt-printer-alist
1779 (list (list 'default lpr-command nil 1779 (list (list 'default lpr-command nil
1780 (cond ((boundp 'printer-name) printer-name) 1780 (cond ((boundp 'printer-name) printer-name)
1781 (ps-windows-system "PRN") 1781 (lpr-windows-system "PRN")
1782 (t nil) 1782 (t nil)
1783 ))) 1783 )))
1784 ;; Examples: 1784 ;; Examples:
@@ -1923,8 +1923,8 @@ function (see it for documentation) to update PostScript printer menu."
1923 1923
1924(defcustom pr-ps-printer-alist 1924(defcustom pr-ps-printer-alist
1925 (list (list 'default lpr-command nil 1925 (list (list 'default lpr-command nil
1926 (cond (ps-windows-system nil) 1926 (cond (lpr-windows-system nil)
1927 (ps-lp-system "-d") 1927 (lpr-lp-system "-d")
1928 (t "-P")) 1928 (t "-P"))
1929 (or (getenv "PRINTER") (getenv "LPDEST") ps-printer-name))) 1929 (or (getenv "PRINTER") (getenv "LPDEST") ps-printer-name)))
1930 ;; Examples: 1930 ;; Examples:
@@ -2200,7 +2200,7 @@ Useful links:
2200 ;; hacked from `temporary-file-directory' variable in files.el 2200 ;; hacked from `temporary-file-directory' variable in files.el
2201 (file-name-as-directory 2201 (file-name-as-directory
2202 (or (getenv "TMPDIR") (getenv "TMP") (getenv "TEMP") 2202 (or (getenv "TMPDIR") (getenv "TMP") (getenv "TEMP")
2203 (cond (ps-windows-system "c:/temp") 2203 (cond (lpr-windows-system "c:/temp")
2204 (t "/tmp") 2204 (t "/tmp")
2205 ))))) 2205 )))))
2206 "Specify a directory for temporary files during printing. 2206 "Specify a directory for temporary files during printing.
@@ -2232,7 +2232,7 @@ See also `pr-temp-dir' and `pr-ps-temp-file'."
2232 2232
2233 2233
2234(defcustom pr-gv-command 2234(defcustom pr-gv-command
2235 (if ps-windows-system 2235 (if lpr-windows-system
2236 "gsview32.exe" 2236 "gsview32.exe"
2237 "gv") 2237 "gv")
2238 "Specify path and name of the gsview/gv utility. 2238 "Specify path and name of the gsview/gv utility.
@@ -2273,7 +2273,7 @@ Useful links:
2273 2273
2274 2274
2275(defcustom pr-gs-command 2275(defcustom pr-gs-command
2276 (if ps-windows-system 2276 (if lpr-windows-system
2277 "gswin32.exe" 2277 "gswin32.exe"
2278 "gs") 2278 "gs")
2279 "Specify path and name of the ghostscript utility. 2279 "Specify path and name of the ghostscript utility.
@@ -2299,7 +2299,7 @@ Useful links:
2299 2299
2300 2300
2301(defcustom pr-gs-switches 2301(defcustom pr-gs-switches
2302 (if ps-windows-system 2302 (if lpr-windows-system
2303 '("-q -dNOPAUSE -Ic:/gs/gs5.50;c:/gs/gs5.50/fonts") 2303 '("-q -dNOPAUSE -Ic:/gs/gs5.50;c:/gs/gs5.50/fonts")
2304 '("-q -dNOPAUSE -I/usr/share/ghostscript/5.10")) 2304 '("-q -dNOPAUSE -I/usr/share/ghostscript/5.10"))
2305 "Specify ghostscript switches. See the documentation on GS for more info. 2305 "Specify ghostscript switches. See the documentation on GS for more info.
@@ -2341,7 +2341,7 @@ Useful links:
2341 2341
2342 2342
2343(defcustom pr-gs-device 2343(defcustom pr-gs-device
2344 (if ps-windows-system 2344 (if lpr-windows-system
2345 "mswinpr2" 2345 "mswinpr2"
2346 "uniprint") 2346 "uniprint")
2347 "Specify the ghostscript device switch value (-sDEVICE=). 2347 "Specify the ghostscript device switch value (-sDEVICE=).
@@ -4852,8 +4852,8 @@ Or choose the menu option Printing/Show Settings/printing."
4852 (ps-comment-string "pr-ps-printer-switch" pr-ps-printer-switch) 4852 (ps-comment-string "pr-ps-printer-switch" pr-ps-printer-switch)
4853 (ps-comment-string "pr-ps-printer " pr-ps-printer) 4853 (ps-comment-string "pr-ps-printer " pr-ps-printer)
4854 (ps-comment-string "pr-cygwin-system " pr-cygwin-system) 4854 (ps-comment-string "pr-cygwin-system " pr-cygwin-system)
4855 (ps-comment-string "ps-windows-system " ps-windows-system) 4855 (ps-comment-string "lpr-windows-system " lpr-windows-system)
4856 (ps-comment-string "ps-lp-system " ps-lp-system) 4856 (ps-comment-string "lpr-lp-system " lpr-lp-system)
4857 nil 4857 nil
4858 '(14 . pr-path-style) 4858 '(14 . pr-path-style)
4859 '(14 . pr-path-alist) 4859 '(14 . pr-path-alist)
@@ -5235,14 +5235,14 @@ If menu binding was not done, calls `pr-menu-bind'."
5235 pr-ps-printer (nth 3 ps)) 5235 pr-ps-printer (nth 3 ps))
5236 (or (stringp pr-ps-command) 5236 (or (stringp pr-ps-command)
5237 (setq pr-ps-command 5237 (setq pr-ps-command
5238 (cond (ps-windows-system "print") 5238 (cond (lpr-windows-system "print")
5239 (ps-lp-system "lp") 5239 (lpr-lp-system "lp")
5240 (t "lpr") 5240 (t "lpr")
5241 ))) 5241 )))
5242 (or (stringp pr-ps-printer-switch) 5242 (or (stringp pr-ps-printer-switch)
5243 (setq pr-ps-printer-switch 5243 (setq pr-ps-printer-switch
5244 (cond (ps-windows-system "/D:") 5244 (cond (lpr-windows-system "/D:")
5245 (ps-lp-system "-d") 5245 (lpr-lp-system "-d")
5246 (t "-P") 5246 (t "-P")
5247 ))) 5247 )))
5248 (pr-eval-alist (nthcdr 4 ps))) 5248 (pr-eval-alist (nthcdr 4 ps)))
@@ -5260,8 +5260,8 @@ If menu binding was not done, calls `pr-menu-bind'."
5260 pr-txt-printer (nth 2 txt))) 5260 pr-txt-printer (nth 2 txt)))
5261 (or (stringp pr-txt-command) 5261 (or (stringp pr-txt-command)
5262 (setq pr-txt-command 5262 (setq pr-txt-command
5263 (cond (ps-windows-system "print") 5263 (cond (lpr-windows-system "print")
5264 (ps-lp-system "lp") 5264 (lpr-lp-system "lp")
5265 (t "lpr") 5265 (t "lpr")
5266 ))) 5266 )))
5267 (pr-update-mode-line)) 5267 (pr-update-mode-line))
@@ -5667,7 +5667,7 @@ If menu binding was not done, calls `pr-menu-bind'."
5667(defun pr-switches (switches mess) 5667(defun pr-switches (switches mess)
5668 (or (listp switches) 5668 (or (listp switches)
5669 (error "%S should have a list of strings" mess)) 5669 (error "%S should have a list of strings" mess))
5670 (ps-flatten-list ; dynamic evaluation 5670 (lpr-flatten-list ; dynamic evaluation
5671 (mapcar 'ps-eval-switch switches))) 5671 (mapcar 'ps-eval-switch switches)))
5672 5672
5673 5673
@@ -5825,7 +5825,7 @@ If menu binding was not done, calls `pr-menu-bind'."
5825 5825
5826(defun pr-find-buffer-visiting (file) 5826(defun pr-find-buffer-visiting (file)
5827 (if (not (file-directory-p file)) 5827 (if (not (file-directory-p file))
5828 (find-buffer-visiting (if ps-windows-system 5828 (find-buffer-visiting (if lpr-windows-system
5829 (downcase file) 5829 (downcase file)
5830 file)) 5830 file))
5831 (let ((truename (file-truename file)) 5831 (let ((truename (file-truename file))
@@ -5939,7 +5939,7 @@ COMMAND.exe, COMMAND.bat and COMMAND.com in this order."
5939 (pr-dosify-file-name 5939 (pr-dosify-file-name
5940 (or (pr-find-command command) 5940 (or (pr-find-command command)
5941 (pr-path-command (cond (pr-cygwin-system 'cygwin) 5941 (pr-path-command (cond (pr-cygwin-system 'cygwin)
5942 (ps-windows-system 'windows) 5942 (lpr-windows-system 'windows)
5943 (t 'unix)) 5943 (t 'unix))
5944 (file-name-nondirectory command) 5944 (file-name-nondirectory command)
5945 nil) 5945 nil)
@@ -5976,7 +5976,7 @@ COMMAND.exe, COMMAND.bat and COMMAND.com in this order."
5976 5976
5977 5977
5978(defun pr-find-command (cmd) 5978(defun pr-find-command (cmd)
5979 (if ps-windows-system 5979 (if lpr-windows-system
5980 ;; windows system 5980 ;; windows system
5981 (let ((ext (cons (file-name-extension cmd t) 5981 (let ((ext (cons (file-name-extension cmd t)
5982 (list ".exe" ".bat" ".com"))) 5982 (list ".exe" ".bat" ".com")))
diff --git a/lisp/ps-mule.el b/lisp/ps-mule.el
index 059261ac0ac..7f30700bee8 100644
--- a/lisp/ps-mule.el
+++ b/lisp/ps-mule.el
@@ -1058,6 +1058,7 @@ It checks if all multi-byte characters in the region are printable or not."
1058 (= (skip-chars-forward "\x00-\x7F" to) to))) 1058 (= (skip-chars-forward "\x00-\x7F" to) to)))
1059 ;; All characters can be printed by normal PostScript fonts. 1059 ;; All characters can be printed by normal PostScript fonts.
1060 (setq ps-basic-plot-string-function 'ps-basic-plot-string 1060 (setq ps-basic-plot-string-function 'ps-basic-plot-string
1061 ;; FIXME: Doesn't ps-encode-header-string-function take 2 args?
1061 ps-encode-header-string-function 'identity) 1062 ps-encode-header-string-function 'identity)
1062 (setq ps-basic-plot-string-function 'ps-mule-plot-string 1063 (setq ps-basic-plot-string-function 'ps-mule-plot-string
1063 ps-encode-header-string-function 'ps-mule-encode-header-string 1064 ps-encode-header-string-function 'ps-mule-encode-header-string
diff --git a/lisp/ps-print.el b/lisp/ps-print.el
index b5961064cb4..8369afcbbc7 100644
--- a/lisp/ps-print.el
+++ b/lisp/ps-print.el
@@ -1472,12 +1472,6 @@ Please send all bug fixes and enhancements to
1472 (error "`ps-print' only supports Emacs 23 and higher"))) 1472 (error "`ps-print' only supports Emacs 23 and higher")))
1473 1473
1474 1474
1475(defconst ps-windows-system
1476 (memq system-type '(ms-dos windows-nt)))
1477(defconst ps-lp-system
1478 (memq system-type '(usg-unix-v hpux irix)))
1479
1480
1481;; Load XEmacs/Emacs definitions 1475;; Load XEmacs/Emacs definitions
1482(require 'ps-def) 1476(require 'ps-def)
1483 1477
@@ -1676,8 +1670,7 @@ For more information about PostScript document comments, see:
1676 :version "20" 1670 :version "20"
1677 :group 'ps-print-miscellany) 1671 :group 'ps-print-miscellany)
1678 1672
1679(defcustom ps-printer-name (and (boundp 'printer-name) 1673(defcustom ps-printer-name nil
1680 (symbol-value 'printer-name))
1681 "The name of a local printer for printing PostScript files. 1674 "The name of a local printer for printing PostScript files.
1682 1675
1683On Unix-like systems, a string value should be a name understood by lpr's -P 1676On Unix-like systems, a string value should be a name understood by lpr's -P
@@ -1709,12 +1702,8 @@ See also `ps-printer-name-option' for documentation."
1709 :group 'ps-print-printer) 1702 :group 'ps-print-printer)
1710 1703
1711(defcustom ps-printer-name-option 1704(defcustom ps-printer-name-option
1712 (cond (ps-windows-system 1705 (cond (lpr-windows-system "/D:")
1713 "/D:") 1706 (t lpr-printer-switch))
1714 (ps-lp-system
1715 "-d")
1716 (t
1717 "-P" ))
1718 "Option for `ps-printer-name' variable (see it). 1707 "Option for `ps-printer-name' variable (see it).
1719 1708
1720On Unix-like systems, if `lpr' is in use, this should be the string 1709On Unix-like systems, if `lpr' is in use, this should be the string
@@ -1729,8 +1718,6 @@ Set this to \"\" or nil, if the utility given by `ps-lpr-command'
1729needs an empty printer name option--that is, pass the printer name 1718needs an empty printer name option--that is, pass the printer name
1730with no special option preceding it. 1719with no special option preceding it.
1731 1720
1732Any value that is not a string is treated as nil.
1733
1734This variable is used only when `ps-printer-name' is a non-empty string." 1721This variable is used only when `ps-printer-name' is a non-empty string."
1735 :type '(choice :menu-tag "Printer Name Option" 1722 :type '(choice :menu-tag "Printer Name Option"
1736 :tag "Printer Name Option" 1723 :tag "Printer Name Option"
@@ -1782,11 +1769,14 @@ See `ps-lpr-command'."
1782 :version "20" 1769 :version "20"
1783 :group 'ps-print-printer) 1770 :group 'ps-print-printer)
1784 1771
1785(defcustom ps-print-region-function nil 1772(defcustom ps-print-region-function
1773 (if (memq system-type '(ms-dos windows-nt))
1774 #'direct-ps-print-region-function
1775 #'call-process-region)
1786 "Specify a function to print the region on a PostScript printer. 1776 "Specify a function to print the region on a PostScript printer.
1787See definition of `call-process-region' for calling conventions. The fourth 1777See definition of `call-process-region' for calling conventions. The fourth
1788and the sixth arguments are both nil." 1778and the sixth arguments are both nil."
1789 :type '(choice (const nil) function) 1779 :type 'function
1790 :version "20" 1780 :version "20"
1791 :group 'ps-print-printer) 1781 :group 'ps-print-printer)
1792 1782
@@ -1798,7 +1788,7 @@ If it's nil, automatic feeding takes place."
1798 :version "20" 1788 :version "20"
1799 :group 'ps-print-printer) 1789 :group 'ps-print-printer)
1800 1790
1801(defcustom ps-end-with-control-d (and ps-windows-system t) 1791(defcustom ps-end-with-control-d (and lpr-windows-system t)
1802 "Non-nil means insert C-d at end of PostScript file generated." 1792 "Non-nil means insert C-d at end of PostScript file generated."
1803 :version "21.1" 1793 :version "21.1"
1804 :type 'boolean 1794 :type 'boolean
@@ -2636,7 +2626,7 @@ NOTE: page numbers are displayed as part of headers,
2636 :group 'ps-print-headers) 2626 :group 'ps-print-headers)
2637 2627
2638(defcustom ps-spool-config 2628(defcustom ps-spool-config
2639 (if ps-windows-system 2629 (if lpr-windows-system
2640 nil 2630 nil
2641 'lpr-switches) 2631 'lpr-switches)
2642 "Specify who is responsible for setting duplex and page size. 2632 "Specify who is responsible for setting duplex and page size.
@@ -3389,15 +3379,12 @@ It's like the very first character of buffer (or region) is ^L (\\014)."
3389 :group 'ps-print-headers) 3379 :group 'ps-print-headers)
3390 3380
3391(defcustom ps-postscript-code-directory 3381(defcustom ps-postscript-code-directory
3392 (or (if (featurep 'xemacs) 3382 (cond ((fboundp 'locate-data-directory) ; XEmacs
3393 (cond ((fboundp 'locate-data-directory) ; XEmacs 3383 (locate-data-directory "ps-print"))
3394 (funcall 'locate-data-directory "ps-print")) 3384 ((boundp 'data-directory) ; XEmacs and Emacs.
3395 ((boundp 'data-directory) ; XEmacs 3385 data-directory)
3396 (symbol-value 'data-directory)) 3386 (t ; don't know what to do
3397 (t ; don't know what to do 3387 (error "`ps-postscript-code-directory' isn't set properly")))
3398 nil))
3399 data-directory) ; Emacs
3400 (error "`ps-postscript-code-directory' isn't set properly"))
3401 "Directory where it's located the PostScript prologue file used by ps-print. 3388 "Directory where it's located the PostScript prologue file used by ps-print.
3402By default, this directory is the same as in the variable `data-directory'." 3389By default, this directory is the same as in the variable `data-directory'."
3403 :type 'directory 3390 :type 'directory
@@ -3646,8 +3633,7 @@ The table depends on the current ps-print setup."
3646 ") ps-print version " ps-print-version "\n") 3633 ") ps-print version " ps-print-version "\n")
3647 ";; internal vars" 3634 ";; internal vars"
3648 (ps-comment-string "emacs-version " emacs-version) 3635 (ps-comment-string "emacs-version " emacs-version)
3649 (ps-comment-string "ps-windows-system " ps-windows-system) 3636 (ps-comment-string "lpr-windows-system" lpr-windows-system)
3650 (ps-comment-string "ps-lp-system " ps-lp-system)
3651 nil 3637 nil
3652 '(25 . ps-print-color-p) 3638 '(25 . ps-print-color-p)
3653 '(25 . ps-lpr-command) 3639 '(25 . ps-lpr-command)
@@ -5426,8 +5412,8 @@ XSTART YSTART are the relative position for the first page in a sheet.")
5426 "%%Title: " (buffer-name) ; Take job name from name of 5412 "%%Title: " (buffer-name) ; Take job name from name of
5427 ; first buffer printed 5413 ; first buffer printed
5428 "\n%%Creator: ps-print v" ps-print-version 5414 "\n%%Creator: ps-print v" ps-print-version
5429 "\n%%For: " (user-full-name) 5415 "\n%%For: " (user-full-name) ;FIXME: may need encoding!
5430 "\n%%CreationDate: " (format-time-string "%T %b %d %Y") 5416 "\n%%CreationDate: " (format-time-string "%T %b %d %Y") ;FIXME: encoding!
5431 "\n%%Orientation: " 5417 "\n%%Orientation: "
5432 (if ps-landscape-mode "Landscape" "Portrait") 5418 (if ps-landscape-mode "Landscape" "Portrait")
5433 "\n%%DocumentNeededResources: font Times-Roman Times-Italic\n%%+ font " 5419 "\n%%DocumentNeededResources: font Times-Roman Times-Italic\n%%+ font "
@@ -6569,96 +6555,36 @@ If FACE is not a valid face name, use default face."
6569 (write-region (point-min) (point-max) filename)) 6555 (write-region (point-min) (point-max) filename))
6570 (and ps-razzle-dazzle (message "Wrote %s" filename))) 6556 (and ps-razzle-dazzle (message "Wrote %s" filename)))
6571 ;; Else, spool to the printer 6557 ;; Else, spool to the printer
6572 (and ps-razzle-dazzle (message "Printing..."))
6573 (with-current-buffer ps-spool-buffer 6558 (with-current-buffer ps-spool-buffer
6574 (let* ((coding-system-for-write 'raw-text-unix) 6559 (let* ((coding-system-for-write 'raw-text-unix)
6575 (ps-printer-name (or ps-printer-name 6560 (printer-name (or ps-printer-name printer-name))
6576 (and (boundp 'printer-name) 6561 (lpr-printer-switch ps-printer-name-option)
6577 (symbol-value 'printer-name)))) 6562 (print-region-function ps-print-region-function)
6578 (ps-lpr-switches 6563 (lpr-command ps-lpr-command))
6579 (append ps-lpr-switches 6564 (lpr-print-region (point-min) (point-max) ps-lpr-switches nil))))
6580 (and (stringp ps-printer-name)
6581 (string< "" ps-printer-name)
6582 (list (concat
6583 (and (stringp ps-printer-name-option)
6584 ps-printer-name-option)
6585 ps-printer-name))))))
6586 (or (stringp ps-printer-name)
6587 (setq ps-printer-name nil))
6588 (apply (or ps-print-region-function 'call-process-region)
6589 (point-min) (point-max) ps-lpr-command nil
6590 (and (fboundp 'start-process) 0)
6591 nil
6592 (ps-flatten-list ; dynamic evaluation
6593 (ps-string-list
6594 (mapcar 'ps-eval-switch ps-lpr-switches))))))
6595 (and ps-razzle-dazzle (message "Printing...done")))
6596 (kill-buffer ps-spool-buffer))) 6565 (kill-buffer ps-spool-buffer)))
6597 6566
6598(defun ps-string-list (arg)
6599 (let (lstr)
6600 (dolist (elm arg)
6601 (cond ((stringp elm)
6602 (setq lstr (cons elm lstr)))
6603 ((listp elm)
6604 (let ((s (ps-string-list elm)))
6605 (when s
6606 (setq lstr (cons s lstr)))))
6607 (t ))) ; ignore any other value
6608 (nreverse lstr)))
6609
6610;; Dynamic evaluation
6611(defun ps-eval-switch (arg)
6612 (cond ((stringp arg) arg)
6613 ((functionp arg) (apply arg nil))
6614 ((symbolp arg) (symbol-value arg))
6615 ((consp arg) (apply (car arg) (cdr arg)))
6616 (t nil)))
6617
6618;; `ps-flatten-list' is defined here (copied from "message.el" and
6619;; enhanced to handle dotted pairs as well) until we can get some
6620;; sensible autoloads, or `flatten-list' gets put somewhere decent.
6621
6622;; (ps-flatten-list '((a . b) c (d . e) (f g h) i . j))
6623;; => (a b c d e f g h i j)
6624
6625(defun ps-flatten-list (&rest list)
6626 (ps-flatten-list-1 list))
6627
6628(defun ps-flatten-list-1 (list)
6629 (cond ((null list) nil)
6630 ((consp list) (append (ps-flatten-list-1 (car list))
6631 (ps-flatten-list-1 (cdr list))))
6632 (t (list list))))
6633
6634(defun ps-kill-emacs-check () 6567(defun ps-kill-emacs-check ()
6635 (let (ps-buffer) 6568 (let ((ps-buffer (get-buffer ps-spool-buffer-name)))
6636 (and (setq ps-buffer (get-buffer ps-spool-buffer-name)) 6569 (and (buffer-live-p ps-buffer)
6637 (buffer-name ps-buffer) ; check if it's not killed
6638 (buffer-modified-p ps-buffer) 6570 (buffer-modified-p ps-buffer)
6639 (y-or-n-p "Unprinted PostScript waiting; print now? ") 6571 (y-or-n-p "Unprinted PostScript waiting; print now? ")
6640 (ps-despool)) 6572 (ps-despool)))
6641 (and (setq ps-buffer (get-buffer ps-spool-buffer-name)) 6573 (let ((ps-buffer (get-buffer ps-spool-buffer-name)))
6642 (buffer-name ps-buffer) ; check if it's not killed 6574 (and (buffer-live-p ps-buffer)
6643 (buffer-modified-p ps-buffer) 6575 (buffer-modified-p ps-buffer)
6644 (not (yes-or-no-p "Unprinted PostScript waiting; exit anyway? ")) 6576 (not (yes-or-no-p "Unprinted PostScript waiting; exit anyway? "))
6645 (error "Unprinted PostScript")))) 6577 (error "Unprinted PostScript"))))
6646 6578
6647(cond ((fboundp 'add-hook) 6579(unless noninteractive
6648 (unless noninteractive 6580 (add-hook 'kill-emacs-hook #'ps-kill-emacs-check))
6649 (funcall 'add-hook 'kill-emacs-hook 'ps-kill-emacs-check)))
6650 (kill-emacs-hook
6651 (message "Won't override existing `kill-emacs-hook'"))
6652 (t
6653 (setq kill-emacs-hook 'ps-kill-emacs-check)))
6654 6581
6655 6582
6656;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; 6583;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
6657;; To make this file smaller, some commands go in a separate file. 6584;; To make this file smaller, some commands go in a separate file.
6658;; But autoload them here to make the separation invisible. 6585;; But autoload them here to make the separation invisible.
6659 6586
6660;;;### (autoloads (ps-mule-end-job ps-mule-begin-job ps-mule-initialize 6587;;;### (autoloads nil "ps-mule" "ps-mule.el" "a90e8414a27ac8fdf093251ac648d761")
6661;;;;;; ps-multibyte-buffer) "ps-mule" "ps-mule.el" "b39f881d3a029049994ef6aa3de93c89")
6662;;; Generated autoloads from ps-mule.el 6588;;; Generated autoloads from ps-mule.el
6663 6589
6664(defvar ps-multibyte-buffer nil "\ 6590(defvar ps-multibyte-buffer nil "\
diff --git a/src/ChangeLog b/src/ChangeLog
index 30cc0dcdac6..51a5da68877 100644
--- a/src/ChangeLog
+++ b/src/ChangeLog
@@ -1,3 +1,10 @@
12013-07-24 Paul Eggert <eggert@cs.ucla.edu>
2
3 * eval.c (Fprogn): Do not check that BODY is a proper list.
4 This undoes the previous change. The check slows down the
5 interpreter, and is not needed to prevent a crash. See
6 <http://lists.gnu.org/archive/html/emacs-devel/2013-07/msg00693.html>.
7
12013-07-23 Glenn Morris <rgm@gnu.org> 82013-07-23 Glenn Morris <rgm@gnu.org>
2 9
3 * Makefile.in ($(etc)/DOC, temacs$(EXEEXT)): Ensure etc/ exists. 10 * Makefile.in ($(etc)/DOC, temacs$(EXEEXT)): Ensure etc/ exists.
diff --git a/src/eval.c b/src/eval.c
index e6ccf0bdcb5..6cb2b7a92b8 100644
--- a/src/eval.c
+++ b/src/eval.c
@@ -454,12 +454,6 @@ usage: (progn BODY...) */)
454 body = XCDR (body); 454 body = XCDR (body);
455 } 455 }
456 456
457 if (!NILP (body))
458 {
459 /* This can happen if functions like Fcond are the caller. */
460 wrong_type_argument (Qlistp, body);
461 }
462
463 UNGCPRO; 457 UNGCPRO;
464 return val; 458 return val;
465} 459}