;;; printing.el --- printing utilities
-;; Copyright (C) 2000, 2001, 2002, 2003, 2004, 2005
-;; Free Software Foundation, Inc.
+;; Copyright (C) 2000, 2001, 2003, 2004, 2005,
+;; 2006, 2007 Free Software Foundation, Inc.
;; Author: Vinicius Jose Latorre <viniciusjl@ig.com.br>
;; Maintainer: Vinicius Jose Latorre <viniciusjl@ig.com.br>
-;; Time-stamp: <2005/06/11 19:51:32 vinicius>
;; Keywords: wp, print, PostScript
;; Version: 6.8.4
-;; X-URL: http://www.cpqd.com.br/~vinicius/emacs/
+;; X-URL: http://www.emacswiki.org/cgi-bin/wiki/ViniciusJoseLatorre
(defconst pr-version "6.8.4"
"printing.el, v 6.8.4 <2005/06/11 vinicius>
;; GNU Emacs is free software; you can redistribute it and/or modify it under
;; the terms of the GNU General Public License as published by the Free
-;; Software Foundation; either version 2, or (at your option) any later
+;; Software Foundation; either version 3, or (at your option) any later
;; version.
;; GNU Emacs is distributed in the hope that it will be useful, but WITHOUT ANY
;; You should have received a copy of the GNU General Public License along with
;; GNU Emacs; see the file COPYING. If not, write to the Free Software
-;; Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
+;; Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
;;; Commentary:
;; interface to ps-print package and it also provides some extra stuff.
;;
;; To download the latest ps-print package see
-;; `http://www.cpqd.com.br/~vinicius/emacs/ps-print.tar.gz'.
+;; `http://www.emacswiki.org/cgi-bin/wiki/PsPrintPackage'.
;; Please, see README file for ps-print installation instructions.
;;
;; `printing' was inspired on:
;;
;; * For `printing' package:
;;
-;; printing `http://www.cpqd.com.br/~vinicius/emacs/printing.el.gz'
-;; ps-print `http://www.cpqd.com.br/~vinicius/emacs/ps-print.tar.gz'
+;; printing `http://www.emacswiki.org/cgi-bin/emacs/download/printing.el'
+;; ps-print `http://www.emacswiki.org/cgi-bin/wiki/PsPrintPackage'
;;
;; * For GNU or Unix system:
;;
;; To avoid compilation gripes
-(or (fboundp 'easy-menu-intern) ; hacked from easymenu.el
- (defsubst easy-menu-intern (s)
- (if (stringp s) (intern s) s)))
-
-
-
(or (fboundp 'subst-char-in-string) ; hacked from subr.el
(defun subst-char-in-string (fromchar tochar string &optional inplace)
"Replace FROMCHAR with TOCHAR in STRING each time it occurs.
(and pr-print-using-ghostscript (not pr-spool-p)))
-(defun pr-get-symbol (name)
- (easy-menu-intern name))
+(defalias 'pr-get-symbol
+ (if (fboundp 'easy-menu-intern) ; hacked from easymenu.el
+ 'easy-menu-intern
+ (lambda (s) (if (stringp s) (intern s) s))))
(cond
((featurep 'xemacs) ; XEmacs
;; third... time, but "print" item exists only in the first load.
(cond
;; Emacs 20
- ((string< emacs-version "21.")
+ ((< emacs-major-version 21)
(easy-menu-change '("tools") "Printing" pr-menu-spec pr-menu-print-item)
(when pr-menu-print-item
(easy-menu-remove-item nil '("tools") pr-menu-print-item)
(pr-get-symbol "Printing")))))
;; Emacs 21 & 22
(t
- (let* ((has-file (lookup-key global-map (vector 'menu-bar 'file)))
- (item-file (if has-file '("file") '("files"))))
+ (let ((menu-file (if (= emacs-major-version 21)
+ '("menu-bar" "files") ; Emacs 21
+ '("menu-bar" "file")))) ; Emacs 22 or higher
(cond
(pr-menu-print-item
- (easy-menu-change item-file "Print" pr-menu-spec "print-buffer")
- (let ((items '("print-buffer" "print-region"
- "ps-print-buffer-faces" "ps-print-region-faces"
- "ps-print-buffer" "ps-print-region")))
- (while items
- (easy-menu-remove-item nil item-file (car items))
- (setq items (cdr items)))
- (setq pr-menu-print-item nil
- pr-menu-bar (vector 'menu-bar
- (if has-file 'file 'files)
- (pr-get-symbol "Print")))))
+ (easy-menu-add-item global-map menu-file
+ (easy-menu-create-menu "Print" pr-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
+ (pr-get-symbol (nth 1 menu-file))
+ (pr-get-symbol "Print"))))
(t
- (easy-menu-change item-file "Print" pr-menu-spec))))))))
+ (easy-menu-add-item global-map menu-file
+ (easy-menu-create-menu "Print" pr-menu-spec)))
+ ))))))
(pr-update-menus t))
C-u 2 M-x pr-ps-fast-fire RET
The command prompts the user for a N-UP value, then for a current
PostScript printer and, finally, for a file name. Then change the active
- printer to that choosen by user and saves the PostScript image in
+ printer to that chosen by user and saves the PostScript image in
that file instead of sending it to the printer.
If it's an integer greater or equal to 2, the command prompts the user for a
current PostScript printer and for a file name. Then change the active
- printer to that choosen by user and saves the PostScript image in that file
+ printer to that chosen by user and saves the PostScript image in that file
instead of sending it to the printer.
If it's a symbol which it's defined in `pr-ps-printer-alist', it's the new
If FORCE is non-nil, update menus doesn't matter if `pr-ps-printer-alist',
`pr-txt-printer-alist' or `pr-ps-utility-alist' were modified or not;
-otherwise, update PostScript printer menu iff `pr-ps-printer-menu-modified' is
-non-nil, update text printer menu iff `pr-txt-printer-menu-modified' is
-non-nil, and update PostScript File menus iff `pr-ps-utility-menu-modified' is
+otherwise, update PostScript printer menu if `pr-ps-printer-menu-modified' is
+non-nil, update text printer menu if `pr-txt-printer-menu-modified' is
+non-nil, and update PostScript File menus if `pr-ps-utility-menu-modified' is
non-nil.
If menu binding was not done, calls `pr-menu-bind'."
(defun pr-interactive-n-up (mess)
(or (stringp mess) (setq mess "*"))
(save-match-data
- (let* ((fmt-prompt "%s[%s] N-up printing: (default 1) ")
+ (let* ((fmt-prompt "%s[%s] N-up printing (default 1): ")
(prompt "")
(str (pr-f-read-string (format fmt-prompt prompt mess) "1" nil "1"))
int)
;; header
(let ((versions (concat "printing v" pr-version
" ps-print v" ps-print-version)))
- (widget-insert (make-string (- 79 (length versions)) ?\s) versions))
+ ;; to keep compatibility with Emacs 20 & 21:
+ ;; DO NOT REPLACE `?\ ' BY `?\s'
+ (widget-insert (make-string (- 79 (length versions)) ?\ ) versions))
(pr-insert-italic "\nCurrent Directory : " 1)
(pr-insert-italic default-directory)
;; handlers
((quit error)
(ding)
- (message (error-message-string data)))))
+ (message "%s" (error-message-string data)))))
(defun pr-interface-printify (&rest ignore)
;; handlers
((quit error)
(ding)
- (message (error-message-string data)))))
+ (message "%s" (error-message-string data)))))
(defun pr-interface-ps-print (&rest ignore)
;; handlers
((quit error)
(ding)
- (message (error-message-string data)))))
+ (message "%s" (error-message-string data)))))
(defun pr-i-ps-send ()