]> code.delx.au - gnu-emacs/blobdiff - lisp/ps-print.el
(c-macro-expansion): Delete ??! trigraph in uniquestring.
[gnu-emacs] / lisp / ps-print.el
index 8968d41419937efcb1beb3c17a3ae791be63b965..cc5066bcf6f079197efcfb38c850f8cb1faf6d5b 100644 (file)
@@ -1,8 +1,9 @@
 ;;; ps-print.el --- Jim's Pretty-Good PostScript Generator for Emacs 19.
 
-;; Copyright (C) 1993, 1994, 1995 Free Software Foundation, Inc.
+;; Copyright (C) 1993, 1994, 1995, 1996 Free Software Foundation, Inc.
 
 ;; Author: Jim Thompson <thompson@wg2.waii.com>
+;; Maintainer: FSF
 ;; Keywords: print, PostScript
 
 ;; This file is part of GNU Emacs.
@@ -1167,9 +1168,11 @@ StandardEncoding 46 82 getinterval aload pop
               (listp filename)))
       (let* ((name (concat (buffer-name) ".ps"))
             (prompt (format "Save PostScript to file: (default %s) "
-                            name)))
-       (read-file-name prompt default-directory
-                       name nil))))
+                            name))
+            (res (read-file-name prompt default-directory name nil)))
+       (if (file-directory-p res)
+           (expand-file-name name (file-name-as-directory res))
+         res))))
 
 ;; The following functions implement a simple list-buffering scheme so
 ;; that ps-print doesn't have to repeatedly switch between buffers
@@ -1760,8 +1763,20 @@ EndDSCPage\n"))
                           (min (next-overlay-change from) to)))
                 (setq position
                       (min property-change overlay-change))
+                ;; The code below is not quite correct,
+                ;; because a non-nil overlay invisible property
+                ;; which is inactive according to the current value
+                ;; of buffer-invisibility-spec nonetheless overrides
+                ;; a face text property.
                 (setq face
-                      (cond ((get-text-property from 'invisible) nil)
+                      (cond ((let ((prop (get-text-property from 'invisible)))
+                               ;; Decide whether this invisible property
+                               ;; really makes the text invisible.
+                               (if (eq buffer-invisibility-spec t)
+                                   (not (null prop))
+                                 (or (memq prop buffer-invisibility-spec)
+                                     (assq prop buffer-invisibility-spec))))
+                             nil)
                             ((get-text-property from 'face))
                             (t 'default)))
                 (let ((overlays (overlays-at from))
@@ -1775,7 +1790,11 @@ EndDSCPage\n"))
                                                  0)))
                       (if (and (or overlay-invisible overlay-face)
                                (> overlay-priority face-priority))
-                          (setq face (cond (overlay-invisible nil)
+                          (setq face (cond ((if (eq buffer-invisibility-spec t)
+                                                (not (null overlay-invisible))
+                                              (or (memq overlay-invisible buffer-invisibility-spec)
+                                                  (assq overlay-invisible buffer-invisibility-spec)))
+                                            nil)
                                            ((and face overlay-face)))
                                 face-priority overlay-priority)))
                     (setq overlays (cdr overlays))))
@@ -1789,7 +1808,10 @@ EndDSCPage\n"))
 
 (defun ps-generate (buffer from to genfunc)
   (let ((from (min to from))
-       (to (max to from)))
+       (to (max to from))
+       ;; This avoids trouble if chars with read-only properties
+       ;; are copied into ps-spool-buffer.
+       (inhibit-read-only t))
     (save-restriction
       (narrow-to-region from to)
       (if ps-razzle-dazzle
@@ -1869,11 +1891,14 @@ EndDSCPage\n"))
          (message "Printing..."))
       (save-excursion
        (set-buffer ps-spool-buffer)
-       (if (eq system-type 'ms-dos)
-           (write-region (point-min) (point-max) "PRN")
-         (apply 'call-process-region
-                (point-min) (point-max) ps-lpr-command nil 0 nil
-                ps-lpr-switches)))
+       (if (and (eq system-type 'ms-dos) (stringp dos-ps-printer))
+           (write-region (point-min) (point-max) dos-ps-printer t 0)
+         (let ((binary-process-input t)) ; for MS-DOS
+           (apply 'call-process-region
+                  (point-min) (point-max) ps-lpr-command nil
+                  (if (fboundp 'start-process) 0 nil)
+                  nil
+                  ps-lpr-switches))))
       (if ps-razzle-dazzle
          (message "Printing...done")))
     (kill-buffer ps-spool-buffer)))