5 |
|
|
6 |
;; Author: Vinicius Jose Latorre <viniciusjl@ig.com.br> |
;; Author: Vinicius Jose Latorre <viniciusjl@ig.com.br> |
7 |
;; Maintainer: Vinicius Jose Latorre <viniciusjl@ig.com.br> |
;; Maintainer: Vinicius Jose Latorre <viniciusjl@ig.com.br> |
8 |
;; Time-stamp: <2004/11/14 14:38:36 vinicius> |
;; Time-stamp: <2004/11/15 17:23:32 vinicius> |
9 |
;; Keywords: wp, print, PostScript |
;; Keywords: wp, print, PostScript |
10 |
;; Version: 6.8.3 |
;; Version: 6.8.3 |
11 |
;; X-URL: http://www.cpqd.com.br/~vinicius/emacs/ |
;; X-URL: http://www.cpqd.com.br/~vinicius/emacs/ |
3882 |
;; use `pr-ps-command' to print |
;; use `pr-ps-command' to print |
3883 |
(apply 'pr-call-process |
(apply 'pr-call-process |
3884 |
pr-ps-command |
pr-ps-command |
3885 |
(pr-switches-string pr-ps-switches "pr-gs-switches") |
(pr-switches-string pr-ps-switches "pr-ps-switches") |
3886 |
(if (string-match "cp" pr-ps-command) |
(if (string-match "cp" pr-ps-command) |
3887 |
;; for "cp" (cmd in out) |
;; for "cp" (cmd in out) |
3888 |
(list file |
(list file |
4000 |
(interactive) |
(interactive) |
4001 |
(pr-save-interactive |
(pr-save-interactive |
4002 |
(pr-toggle 'ps-spool-duplex "Printing duplex" |
(pr-toggle 'ps-spool-duplex "Printing duplex" |
4003 |
'postcsript-options 5 12 'toggle))) |
'postscript-options 5 12 'toggle))) |
4004 |
|
|
4005 |
|
|
4006 |
;;;###autoload |
;;;###autoload |
5325 |
|
|
5326 |
|
|
5327 |
(defun pr-call-process (command &rest args) |
(defun pr-call-process (command &rest args) |
5328 |
(pr-save-file-modes |
(let ((buffer (get-buffer-create "*Printing Command Output*")) |
5329 |
(let ((buffer (get-buffer-create "*Printing Command Output*")) |
(cmd (pr-command command)) |
5330 |
(cmd (pr-command command)) |
status) |
5331 |
status) |
(setq args (pr-remove-nil-from-list args)) |
5332 |
(setq args (pr-remove-nil-from-list args)) |
;; *Printing Command Output* == show command & args |
5333 |
(save-excursion |
(save-excursion |
5334 |
(set-buffer buffer) |
(set-buffer buffer) |
5335 |
(goto-char (point-max)) |
(goto-char (point-max)) |
5336 |
(insert (format "%s %S\n" cmd args))) |
(insert (format "%s %S\n" cmd args))) |
5337 |
|
;; *Printing Command Output* == show any return message from command |
5338 |
|
(pr-save-file-modes |
5339 |
(setq status |
(setq status |
5340 |
(condition-case data |
(condition-case data |
5341 |
(apply 'call-process cmd nil buffer nil args) |
(apply 'call-process cmd nil buffer nil args) |
5342 |
((quit error) |
((quit error) |
5343 |
(error-message-string data)))) |
(error-message-string data))))) |
5344 |
(save-excursion |
;; *Printing Command Output* == show exit status |
5345 |
(set-buffer buffer) |
(save-excursion |
5346 |
(goto-char (point-max)) |
(set-buffer buffer) |
5347 |
(insert (format "Exit status: %s\n" status)))))) |
(goto-char (point-max)) |
5348 |
|
(insert (format "Exit status: %s\n\n" status))) |
5349 |
|
;; message if error status |
5350 |
|
(if (or (stringp status) |
5351 |
|
(and (integerp status) (/= status 0))) |
5352 |
|
(message |
5353 |
|
"Printing error status: %s (see *Printing Command Output* buffer)" |
5354 |
|
status)))) |
5355 |
|
|
5356 |
|
|
5357 |
(defun pr-txt-print (from to) |
(defun pr-txt-print (from to) |
5362 |
|
|
5363 |
|
|
5364 |
(defun pr-switches-string (switches mess) |
(defun pr-switches-string (switches mess) |
5365 |
(mapconcat 'identity (pr-switches switches mess) " ")) |
;; If SWITCHES is nil, return nil. |
5366 |
|
;; Otherwise, return the list of string in a string. |
5367 |
|
(and switches |
5368 |
|
(mapconcat 'identity (pr-switches switches mess) " "))) |
5369 |
|
|
5370 |
|
|
5371 |
(defun pr-switches (switches mess) |
(defun pr-switches (switches mess) |