;;; 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.
(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
(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))
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))))
(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
(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)))