Mercurial > emacs
annotate lisp/ps-samp.el @ 99302:2f4e59d39285
(Document View): Major rewrite.
author | Richard M. Stallman <rms@gnu.org> |
---|---|
date | Sat, 01 Nov 2008 03:27:54 +0000 |
parents | ee5932bf781d |
children | a9dc0e7c3f2b |
rev | line source |
---|---|
90736
ef1369583937
Split XEmacs/Emacs definitions and sample setup code into separate files
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
diff
changeset
|
1 ;;; ps-samp.el --- ps-print sample setup code |
ef1369583937
Split XEmacs/Emacs definitions and sample setup code into separate files
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
diff
changeset
|
2 |
91332
6b6e684740e5
Fix face attributes recognition
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
91074
diff
changeset
|
3 ;; Copyright (C) 2007, 2008 Free Software Foundation, Inc. |
90736
ef1369583937
Split XEmacs/Emacs definitions and sample setup code into separate files
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
diff
changeset
|
4 |
ef1369583937
Split XEmacs/Emacs definitions and sample setup code into separate files
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
diff
changeset
|
5 ;; Author: Jim Thompson (was <thompson@wg2.waii.com>) |
ef1369583937
Split XEmacs/Emacs definitions and sample setup code into separate files
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
diff
changeset
|
6 ;; Jacques Duthen (was <duthen@cegelec-red.fr>) |
ef1369583937
Split XEmacs/Emacs definitions and sample setup code into separate files
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
diff
changeset
|
7 ;; Vinicius Jose Latorre <viniciusjl@ig.com.br> |
ef1369583937
Split XEmacs/Emacs definitions and sample setup code into separate files
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
diff
changeset
|
8 ;; Kenichi Handa <handa@m17n.org> (multi-byte characters) |
ef1369583937
Split XEmacs/Emacs definitions and sample setup code into separate files
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
diff
changeset
|
9 ;; Maintainer: Kenichi Handa <handa@m17n.org> (multi-byte characters) |
ef1369583937
Split XEmacs/Emacs definitions and sample setup code into separate files
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
diff
changeset
|
10 ;; Vinicius Jose Latorre <viniciusjl@ig.com.br> |
ef1369583937
Split XEmacs/Emacs definitions and sample setup code into separate files
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
diff
changeset
|
11 ;; Keywords: wp, print, PostScript |
ef1369583937
Split XEmacs/Emacs definitions and sample setup code into separate files
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
diff
changeset
|
12 ;; X-URL: http://www.emacswiki.org/cgi-bin/wiki/ViniciusJoseLatorre |
ef1369583937
Split XEmacs/Emacs definitions and sample setup code into separate files
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
diff
changeset
|
13 |
ef1369583937
Split XEmacs/Emacs definitions and sample setup code into separate files
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
diff
changeset
|
14 ;; This file is part of GNU Emacs. |
ef1369583937
Split XEmacs/Emacs definitions and sample setup code into separate files
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
diff
changeset
|
15 |
94678
ee5932bf781d
Switch to recommended form of GPLv3 permissions notice.
Glenn Morris <rgm@gnu.org>
parents:
93873
diff
changeset
|
16 ;; GNU Emacs is free software: you can redistribute it and/or modify |
ee5932bf781d
Switch to recommended form of GPLv3 permissions notice.
Glenn Morris <rgm@gnu.org>
parents:
93873
diff
changeset
|
17 ;; it under the terms of the GNU General Public License as published by |
ee5932bf781d
Switch to recommended form of GPLv3 permissions notice.
Glenn Morris <rgm@gnu.org>
parents:
93873
diff
changeset
|
18 ;; the Free Software Foundation, either version 3 of the License, or |
ee5932bf781d
Switch to recommended form of GPLv3 permissions notice.
Glenn Morris <rgm@gnu.org>
parents:
93873
diff
changeset
|
19 ;; (at your option) any later version. |
90736
ef1369583937
Split XEmacs/Emacs definitions and sample setup code into separate files
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
diff
changeset
|
20 |
94678
ee5932bf781d
Switch to recommended form of GPLv3 permissions notice.
Glenn Morris <rgm@gnu.org>
parents:
93873
diff
changeset
|
21 ;; GNU Emacs is distributed in the hope that it will be useful, |
ee5932bf781d
Switch to recommended form of GPLv3 permissions notice.
Glenn Morris <rgm@gnu.org>
parents:
93873
diff
changeset
|
22 ;; but WITHOUT ANY WARRANTY; without even the implied warranty of |
ee5932bf781d
Switch to recommended form of GPLv3 permissions notice.
Glenn Morris <rgm@gnu.org>
parents:
93873
diff
changeset
|
23 ;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
ee5932bf781d
Switch to recommended form of GPLv3 permissions notice.
Glenn Morris <rgm@gnu.org>
parents:
93873
diff
changeset
|
24 ;; GNU General Public License for more details. |
90736
ef1369583937
Split XEmacs/Emacs definitions and sample setup code into separate files
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
diff
changeset
|
25 |
94678
ee5932bf781d
Switch to recommended form of GPLv3 permissions notice.
Glenn Morris <rgm@gnu.org>
parents:
93873
diff
changeset
|
26 ;; You should have received a copy of the GNU General Public License |
ee5932bf781d
Switch to recommended form of GPLv3 permissions notice.
Glenn Morris <rgm@gnu.org>
parents:
93873
diff
changeset
|
27 ;; along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>. |
90736
ef1369583937
Split XEmacs/Emacs definitions and sample setup code into separate files
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
diff
changeset
|
28 |
ef1369583937
Split XEmacs/Emacs definitions and sample setup code into separate files
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
diff
changeset
|
29 ;;; Commentary: |
ef1369583937
Split XEmacs/Emacs definitions and sample setup code into separate files
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
diff
changeset
|
30 |
ef1369583937
Split XEmacs/Emacs definitions and sample setup code into separate files
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
diff
changeset
|
31 ;; See ps-print.el for documentation. |
ef1369583937
Split XEmacs/Emacs definitions and sample setup code into separate files
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
diff
changeset
|
32 |
ef1369583937
Split XEmacs/Emacs definitions and sample setup code into separate files
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
diff
changeset
|
33 ;;; Code: |
ef1369583937
Split XEmacs/Emacs definitions and sample setup code into separate files
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
diff
changeset
|
34 |
ef1369583937
Split XEmacs/Emacs definitions and sample setup code into separate files
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
diff
changeset
|
35 |
ef1369583937
Split XEmacs/Emacs definitions and sample setup code into separate files
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
diff
changeset
|
36 (eval-and-compile (require 'ps-print)) |
ef1369583937
Split XEmacs/Emacs definitions and sample setup code into separate files
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
diff
changeset
|
37 |
ef1369583937
Split XEmacs/Emacs definitions and sample setup code into separate files
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
diff
changeset
|
38 |
ef1369583937
Split XEmacs/Emacs definitions and sample setup code into separate files
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
diff
changeset
|
39 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; |
ef1369583937
Split XEmacs/Emacs definitions and sample setup code into separate files
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
diff
changeset
|
40 ;;; Sample Setup Code: |
ef1369583937
Split XEmacs/Emacs definitions and sample setup code into separate files
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
diff
changeset
|
41 |
ef1369583937
Split XEmacs/Emacs definitions and sample setup code into separate files
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
diff
changeset
|
42 |
ef1369583937
Split XEmacs/Emacs definitions and sample setup code into separate files
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
diff
changeset
|
43 ;; This stuff is for anybody that's brave enough to look this far, |
ef1369583937
Split XEmacs/Emacs definitions and sample setup code into separate files
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
diff
changeset
|
44 ;; and able to figure out how to use it. It isn't really part of |
ef1369583937
Split XEmacs/Emacs definitions and sample setup code into separate files
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
diff
changeset
|
45 ;; ps-print, but I'll leave it here in hopes it might be useful: |
ef1369583937
Split XEmacs/Emacs definitions and sample setup code into separate files
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
diff
changeset
|
46 |
ef1369583937
Split XEmacs/Emacs definitions and sample setup code into separate files
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
diff
changeset
|
47 ;; WARNING!!! The following code is *sample* code only. |
ef1369583937
Split XEmacs/Emacs definitions and sample setup code into separate files
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
diff
changeset
|
48 ;; Don't use it unless you understand what it does! |
ef1369583937
Split XEmacs/Emacs definitions and sample setup code into separate files
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
diff
changeset
|
49 |
90779
6ea6d3d1508d
Some code fix.
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
90738
diff
changeset
|
50 ;; The key `f22' should probably be replaced by `print'. --Stef |
90736
ef1369583937
Split XEmacs/Emacs definitions and sample setup code into separate files
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
diff
changeset
|
51 |
ef1369583937
Split XEmacs/Emacs definitions and sample setup code into separate files
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
diff
changeset
|
52 ;; A hook to bind to `rmail-mode-hook' to locally bind prsc and set the |
ef1369583937
Split XEmacs/Emacs definitions and sample setup code into separate files
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
diff
changeset
|
53 ;; `ps-left-headers' specially for mail messages. |
ef1369583937
Split XEmacs/Emacs definitions and sample setup code into separate files
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
diff
changeset
|
54 (defun ps-rmail-mode-hook () |
90779
6ea6d3d1508d
Some code fix.
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
90738
diff
changeset
|
55 (local-set-key [(f22)] 'ps-rmail-print-message-from-summary) |
90736
ef1369583937
Split XEmacs/Emacs definitions and sample setup code into separate files
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
diff
changeset
|
56 (setq ps-header-lines 3 |
ef1369583937
Split XEmacs/Emacs definitions and sample setup code into separate files
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
diff
changeset
|
57 ps-left-header |
ef1369583937
Split XEmacs/Emacs definitions and sample setup code into separate files
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
diff
changeset
|
58 ;; The left headers will display the message's subject, its |
ef1369583937
Split XEmacs/Emacs definitions and sample setup code into separate files
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
diff
changeset
|
59 ;; author, and the name of the folder it was in. |
ef1369583937
Split XEmacs/Emacs definitions and sample setup code into separate files
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
diff
changeset
|
60 '(ps-article-subject ps-article-author buffer-name))) |
ef1369583937
Split XEmacs/Emacs definitions and sample setup code into separate files
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
diff
changeset
|
61 |
ef1369583937
Split XEmacs/Emacs definitions and sample setup code into separate files
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
diff
changeset
|
62 ;; See `ps-gnus-print-article-from-summary'. This function does the |
ef1369583937
Split XEmacs/Emacs definitions and sample setup code into separate files
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
diff
changeset
|
63 ;; same thing for rmail. |
ef1369583937
Split XEmacs/Emacs definitions and sample setup code into separate files
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
diff
changeset
|
64 (defun ps-rmail-print-message-from-summary () |
ef1369583937
Split XEmacs/Emacs definitions and sample setup code into separate files
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
diff
changeset
|
65 (interactive) |
ef1369583937
Split XEmacs/Emacs definitions and sample setup code into separate files
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
diff
changeset
|
66 (ps-print-message-from-summary 'rmail-summary-buffer "RMAIL")) |
ef1369583937
Split XEmacs/Emacs definitions and sample setup code into separate files
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
diff
changeset
|
67 |
ef1369583937
Split XEmacs/Emacs definitions and sample setup code into separate files
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
diff
changeset
|
68 ;; Used in `ps-rmail-print-article-from-summary', |
ef1369583937
Split XEmacs/Emacs definitions and sample setup code into separate files
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
diff
changeset
|
69 ;; `ps-gnus-print-article-from-summary' and `ps-vm-print-message-from-summary'. |
ef1369583937
Split XEmacs/Emacs definitions and sample setup code into separate files
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
diff
changeset
|
70 (defun ps-print-message-from-summary (summary-buffer summary-default) |
ef1369583937
Split XEmacs/Emacs definitions and sample setup code into separate files
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
diff
changeset
|
71 (let ((ps-buf (or (and (boundp summary-buffer) |
ef1369583937
Split XEmacs/Emacs definitions and sample setup code into separate files
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
diff
changeset
|
72 (symbol-value summary-buffer)) |
ef1369583937
Split XEmacs/Emacs definitions and sample setup code into separate files
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
diff
changeset
|
73 summary-default))) |
ef1369583937
Split XEmacs/Emacs definitions and sample setup code into separate files
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
diff
changeset
|
74 (and (get-buffer ps-buf) |
ef1369583937
Split XEmacs/Emacs definitions and sample setup code into separate files
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
diff
changeset
|
75 (save-excursion |
ef1369583937
Split XEmacs/Emacs definitions and sample setup code into separate files
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
diff
changeset
|
76 (set-buffer ps-buf) |
ef1369583937
Split XEmacs/Emacs definitions and sample setup code into separate files
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
diff
changeset
|
77 (ps-spool-buffer-with-faces))))) |
ef1369583937
Split XEmacs/Emacs definitions and sample setup code into separate files
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
diff
changeset
|
78 |
ef1369583937
Split XEmacs/Emacs definitions and sample setup code into separate files
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
diff
changeset
|
79 ;; Look in an article or mail message for the Subject: line. To be |
ef1369583937
Split XEmacs/Emacs definitions and sample setup code into separate files
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
diff
changeset
|
80 ;; placed in `ps-left-headers'. |
ef1369583937
Split XEmacs/Emacs definitions and sample setup code into separate files
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
diff
changeset
|
81 (defun ps-article-subject () |
ef1369583937
Split XEmacs/Emacs definitions and sample setup code into separate files
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
diff
changeset
|
82 (save-excursion |
ef1369583937
Split XEmacs/Emacs definitions and sample setup code into separate files
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
diff
changeset
|
83 (goto-char (point-min)) |
ef1369583937
Split XEmacs/Emacs definitions and sample setup code into separate files
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
diff
changeset
|
84 (if (re-search-forward "^Subject:[ \t]+\\(.*\\)$" nil t) |
ef1369583937
Split XEmacs/Emacs definitions and sample setup code into separate files
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
diff
changeset
|
85 (buffer-substring (match-beginning 1) (match-end 1)) |
ef1369583937
Split XEmacs/Emacs definitions and sample setup code into separate files
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
diff
changeset
|
86 "Subject ???"))) |
ef1369583937
Split XEmacs/Emacs definitions and sample setup code into separate files
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
diff
changeset
|
87 |
ef1369583937
Split XEmacs/Emacs definitions and sample setup code into separate files
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
diff
changeset
|
88 ;; Look in an article or mail message for the From: line. Sorta-kinda |
ef1369583937
Split XEmacs/Emacs definitions and sample setup code into separate files
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
diff
changeset
|
89 ;; understands RFC-822 addresses and can pull the real name out where |
ef1369583937
Split XEmacs/Emacs definitions and sample setup code into separate files
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
diff
changeset
|
90 ;; it's provided. To be placed in `ps-left-headers'. |
ef1369583937
Split XEmacs/Emacs definitions and sample setup code into separate files
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
diff
changeset
|
91 (defun ps-article-author () |
ef1369583937
Split XEmacs/Emacs definitions and sample setup code into separate files
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
diff
changeset
|
92 (save-excursion |
ef1369583937
Split XEmacs/Emacs definitions and sample setup code into separate files
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
diff
changeset
|
93 (goto-char (point-min)) |
ef1369583937
Split XEmacs/Emacs definitions and sample setup code into separate files
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
diff
changeset
|
94 (if (re-search-forward "^From:[ \t]+\\(.*\\)$" nil t) |
ef1369583937
Split XEmacs/Emacs definitions and sample setup code into separate files
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
diff
changeset
|
95 (let ((fromstring (buffer-substring (match-beginning 1) (match-end 1)))) |
ef1369583937
Split XEmacs/Emacs definitions and sample setup code into separate files
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
diff
changeset
|
96 (cond |
ef1369583937
Split XEmacs/Emacs definitions and sample setup code into separate files
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
diff
changeset
|
97 |
ef1369583937
Split XEmacs/Emacs definitions and sample setup code into separate files
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
diff
changeset
|
98 ;; Try first to match addresses that look like |
ef1369583937
Split XEmacs/Emacs definitions and sample setup code into separate files
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
diff
changeset
|
99 ;; thompson@wg2.waii.com (Jim Thompson) |
ef1369583937
Split XEmacs/Emacs definitions and sample setup code into separate files
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
diff
changeset
|
100 ((string-match ".*[ \t]+(\\(.*\\))" fromstring) |
ef1369583937
Split XEmacs/Emacs definitions and sample setup code into separate files
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
diff
changeset
|
101 (substring fromstring (match-beginning 1) (match-end 1))) |
ef1369583937
Split XEmacs/Emacs definitions and sample setup code into separate files
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
diff
changeset
|
102 |
ef1369583937
Split XEmacs/Emacs definitions and sample setup code into separate files
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
diff
changeset
|
103 ;; Next try to match addresses that look like |
ef1369583937
Split XEmacs/Emacs definitions and sample setup code into separate files
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
diff
changeset
|
104 ;; Jim Thompson <thompson@wg2.waii.com> or |
ef1369583937
Split XEmacs/Emacs definitions and sample setup code into separate files
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
diff
changeset
|
105 ;; "Jim Thompson" <thompson@wg2.waii.com> |
ef1369583937
Split XEmacs/Emacs definitions and sample setup code into separate files
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
diff
changeset
|
106 ((string-match "\\(\"?\\)\\(.*\\)\\1[ \t]+<.*>" fromstring) |
ef1369583937
Split XEmacs/Emacs definitions and sample setup code into separate files
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
diff
changeset
|
107 (substring fromstring (match-beginning 2) (match-end 2))) |
ef1369583937
Split XEmacs/Emacs definitions and sample setup code into separate files
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
diff
changeset
|
108 |
ef1369583937
Split XEmacs/Emacs definitions and sample setup code into separate files
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
diff
changeset
|
109 ;; Couldn't find a real name -- show the address instead. |
ef1369583937
Split XEmacs/Emacs definitions and sample setup code into separate files
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
diff
changeset
|
110 (t fromstring))) |
ef1369583937
Split XEmacs/Emacs definitions and sample setup code into separate files
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
diff
changeset
|
111 "From ???"))) |
ef1369583937
Split XEmacs/Emacs definitions and sample setup code into separate files
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
diff
changeset
|
112 |
ef1369583937
Split XEmacs/Emacs definitions and sample setup code into separate files
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
diff
changeset
|
113 ;; A hook to bind to `gnus-article-prepare-hook'. This will set the |
ef1369583937
Split XEmacs/Emacs definitions and sample setup code into separate files
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
diff
changeset
|
114 ;; `ps-left-headers' specially for gnus articles. Unfortunately, |
ef1369583937
Split XEmacs/Emacs definitions and sample setup code into separate files
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
diff
changeset
|
115 ;; `gnus-article-mode-hook' is called only once, the first time the *Article* |
ef1369583937
Split XEmacs/Emacs definitions and sample setup code into separate files
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
diff
changeset
|
116 ;; buffer enters that mode, so it would only work for the first time |
ef1369583937
Split XEmacs/Emacs definitions and sample setup code into separate files
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
diff
changeset
|
117 ;; we ran gnus. The second time, this hook wouldn't get set up. The |
ef1369583937
Split XEmacs/Emacs definitions and sample setup code into separate files
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
diff
changeset
|
118 ;; only alternative is `gnus-article-prepare-hook'. |
ef1369583937
Split XEmacs/Emacs definitions and sample setup code into separate files
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
diff
changeset
|
119 (defun ps-gnus-article-prepare-hook () |
ef1369583937
Split XEmacs/Emacs definitions and sample setup code into separate files
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
diff
changeset
|
120 (setq ps-header-lines 3 |
ef1369583937
Split XEmacs/Emacs definitions and sample setup code into separate files
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
diff
changeset
|
121 ps-left-header |
ef1369583937
Split XEmacs/Emacs definitions and sample setup code into separate files
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
diff
changeset
|
122 ;; The left headers will display the article's subject, its |
ef1369583937
Split XEmacs/Emacs definitions and sample setup code into separate files
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
diff
changeset
|
123 ;; author, and the newsgroup it was in. |
ef1369583937
Split XEmacs/Emacs definitions and sample setup code into separate files
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
diff
changeset
|
124 '(ps-article-subject ps-article-author gnus-newsgroup-name))) |
ef1369583937
Split XEmacs/Emacs definitions and sample setup code into separate files
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
diff
changeset
|
125 |
ef1369583937
Split XEmacs/Emacs definitions and sample setup code into separate files
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
diff
changeset
|
126 ;; A hook to bind to `vm-mode-hook' to locally bind prsc and set the |
ef1369583937
Split XEmacs/Emacs definitions and sample setup code into separate files
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
diff
changeset
|
127 ;; `ps-left-headers' specially for mail messages. |
ef1369583937
Split XEmacs/Emacs definitions and sample setup code into separate files
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
diff
changeset
|
128 (defun ps-vm-mode-hook () |
90779
6ea6d3d1508d
Some code fix.
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
90738
diff
changeset
|
129 (local-set-key [(f22)] 'ps-vm-print-message-from-summary) |
90736
ef1369583937
Split XEmacs/Emacs definitions and sample setup code into separate files
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
diff
changeset
|
130 (setq ps-header-lines 3 |
ef1369583937
Split XEmacs/Emacs definitions and sample setup code into separate files
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
diff
changeset
|
131 ps-left-header |
ef1369583937
Split XEmacs/Emacs definitions and sample setup code into separate files
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
diff
changeset
|
132 ;; The left headers will display the message's subject, its |
ef1369583937
Split XEmacs/Emacs definitions and sample setup code into separate files
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
diff
changeset
|
133 ;; author, and the name of the folder it was in. |
ef1369583937
Split XEmacs/Emacs definitions and sample setup code into separate files
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
diff
changeset
|
134 '(ps-article-subject ps-article-author buffer-name))) |
ef1369583937
Split XEmacs/Emacs definitions and sample setup code into separate files
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
diff
changeset
|
135 |
ef1369583937
Split XEmacs/Emacs definitions and sample setup code into separate files
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
diff
changeset
|
136 ;; Every now and then I forget to switch from the *Summary* buffer to |
ef1369583937
Split XEmacs/Emacs definitions and sample setup code into separate files
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
diff
changeset
|
137 ;; the *Article* before hitting prsc, and a nicely formatted list of |
ef1369583937
Split XEmacs/Emacs definitions and sample setup code into separate files
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
diff
changeset
|
138 ;; article subjects shows up at the printer. This function, bound to |
ef1369583937
Split XEmacs/Emacs definitions and sample setup code into separate files
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
diff
changeset
|
139 ;; prsc for the gnus *Summary* buffer means I don't have to switch |
ef1369583937
Split XEmacs/Emacs definitions and sample setup code into separate files
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
diff
changeset
|
140 ;; buffers first. |
ef1369583937
Split XEmacs/Emacs definitions and sample setup code into separate files
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
diff
changeset
|
141 ;; sb: Updated for Gnus 5. |
ef1369583937
Split XEmacs/Emacs definitions and sample setup code into separate files
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
diff
changeset
|
142 (defun ps-gnus-print-article-from-summary () |
ef1369583937
Split XEmacs/Emacs definitions and sample setup code into separate files
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
diff
changeset
|
143 (interactive) |
ef1369583937
Split XEmacs/Emacs definitions and sample setup code into separate files
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
diff
changeset
|
144 (ps-print-message-from-summary 'gnus-article-buffer "*Article*")) |
ef1369583937
Split XEmacs/Emacs definitions and sample setup code into separate files
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
diff
changeset
|
145 |
ef1369583937
Split XEmacs/Emacs definitions and sample setup code into separate files
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
diff
changeset
|
146 ;; See `ps-gnus-print-article-from-summary'. This function does the |
ef1369583937
Split XEmacs/Emacs definitions and sample setup code into separate files
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
diff
changeset
|
147 ;; same thing for vm. |
ef1369583937
Split XEmacs/Emacs definitions and sample setup code into separate files
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
diff
changeset
|
148 (defun ps-vm-print-message-from-summary () |
ef1369583937
Split XEmacs/Emacs definitions and sample setup code into separate files
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
diff
changeset
|
149 (interactive) |
ef1369583937
Split XEmacs/Emacs definitions and sample setup code into separate files
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
diff
changeset
|
150 (ps-print-message-from-summary 'vm-mail-buffer "")) |
ef1369583937
Split XEmacs/Emacs definitions and sample setup code into separate files
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
diff
changeset
|
151 |
ef1369583937
Split XEmacs/Emacs definitions and sample setup code into separate files
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
diff
changeset
|
152 ;; A hook to bind to bind to `gnus-summary-setup-buffer' to locally bind |
ef1369583937
Split XEmacs/Emacs definitions and sample setup code into separate files
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
diff
changeset
|
153 ;; prsc. |
ef1369583937
Split XEmacs/Emacs definitions and sample setup code into separate files
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
diff
changeset
|
154 (defun ps-gnus-summary-setup () |
90779
6ea6d3d1508d
Some code fix.
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
90738
diff
changeset
|
155 (local-set-key [(f22)] 'ps-gnus-print-article-from-summary)) |
90736
ef1369583937
Split XEmacs/Emacs definitions and sample setup code into separate files
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
diff
changeset
|
156 |
ef1369583937
Split XEmacs/Emacs definitions and sample setup code into separate files
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
diff
changeset
|
157 ;; Look in an article or mail message for the Subject: line. To be |
ef1369583937
Split XEmacs/Emacs definitions and sample setup code into separate files
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
diff
changeset
|
158 ;; placed in `ps-left-headers'. |
ef1369583937
Split XEmacs/Emacs definitions and sample setup code into separate files
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
diff
changeset
|
159 (defun ps-info-file () |
ef1369583937
Split XEmacs/Emacs definitions and sample setup code into separate files
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
diff
changeset
|
160 (save-excursion |
ef1369583937
Split XEmacs/Emacs definitions and sample setup code into separate files
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
diff
changeset
|
161 (goto-char (point-min)) |
ef1369583937
Split XEmacs/Emacs definitions and sample setup code into separate files
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
diff
changeset
|
162 (if (re-search-forward "File:[ \t]+\\([^, \t\n]*\\)" nil t) |
ef1369583937
Split XEmacs/Emacs definitions and sample setup code into separate files
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
diff
changeset
|
163 (buffer-substring (match-beginning 1) (match-end 1)) |
ef1369583937
Split XEmacs/Emacs definitions and sample setup code into separate files
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
diff
changeset
|
164 "File ???"))) |
ef1369583937
Split XEmacs/Emacs definitions and sample setup code into separate files
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
diff
changeset
|
165 |
ef1369583937
Split XEmacs/Emacs definitions and sample setup code into separate files
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
diff
changeset
|
166 ;; Look in an article or mail message for the Subject: line. To be |
ef1369583937
Split XEmacs/Emacs definitions and sample setup code into separate files
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
diff
changeset
|
167 ;; placed in `ps-left-headers'. |
ef1369583937
Split XEmacs/Emacs definitions and sample setup code into separate files
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
diff
changeset
|
168 (defun ps-info-node () |
ef1369583937
Split XEmacs/Emacs definitions and sample setup code into separate files
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
diff
changeset
|
169 (save-excursion |
ef1369583937
Split XEmacs/Emacs definitions and sample setup code into separate files
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
diff
changeset
|
170 (goto-char (point-min)) |
ef1369583937
Split XEmacs/Emacs definitions and sample setup code into separate files
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
diff
changeset
|
171 (if (re-search-forward "Node:[ \t]+\\([^,\t\n]*\\)" nil t) |
ef1369583937
Split XEmacs/Emacs definitions and sample setup code into separate files
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
diff
changeset
|
172 (buffer-substring (match-beginning 1) (match-end 1)) |
ef1369583937
Split XEmacs/Emacs definitions and sample setup code into separate files
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
diff
changeset
|
173 "Node ???"))) |
ef1369583937
Split XEmacs/Emacs definitions and sample setup code into separate files
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
diff
changeset
|
174 |
ef1369583937
Split XEmacs/Emacs definitions and sample setup code into separate files
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
diff
changeset
|
175 (defun ps-info-mode-hook () |
ef1369583937
Split XEmacs/Emacs definitions and sample setup code into separate files
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
diff
changeset
|
176 (setq ps-left-header |
ef1369583937
Split XEmacs/Emacs definitions and sample setup code into separate files
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
diff
changeset
|
177 ;; The left headers will display the node name and file name. |
ef1369583937
Split XEmacs/Emacs definitions and sample setup code into separate files
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
diff
changeset
|
178 '(ps-info-node ps-info-file))) |
ef1369583937
Split XEmacs/Emacs definitions and sample setup code into separate files
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
diff
changeset
|
179 |
ef1369583937
Split XEmacs/Emacs definitions and sample setup code into separate files
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
diff
changeset
|
180 ;; WARNING! The following function is a *sample* only, and is *not* |
ef1369583937
Split XEmacs/Emacs definitions and sample setup code into separate files
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
diff
changeset
|
181 ;; meant to be used as a whole unless you understand what the effects |
ef1369583937
Split XEmacs/Emacs definitions and sample setup code into separate files
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
diff
changeset
|
182 ;; will be! (In fact, this is a copy of Jim's setup for ps-print -- |
ef1369583937
Split XEmacs/Emacs definitions and sample setup code into separate files
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
diff
changeset
|
183 ;; I'd be very surprised if it was useful to *anybody*, without |
ef1369583937
Split XEmacs/Emacs definitions and sample setup code into separate files
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
diff
changeset
|
184 ;; modification.) |
ef1369583937
Split XEmacs/Emacs definitions and sample setup code into separate files
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
diff
changeset
|
185 |
ef1369583937
Split XEmacs/Emacs definitions and sample setup code into separate files
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
diff
changeset
|
186 (defun ps-jts-ps-setup () |
90779
6ea6d3d1508d
Some code fix.
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
90738
diff
changeset
|
187 (global-set-key [(f22)] 'ps-spool-buffer-with-faces) ;f22 is prsc |
6ea6d3d1508d
Some code fix.
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
90738
diff
changeset
|
188 (global-set-key [(shift f22)] 'ps-spool-region-with-faces) |
6ea6d3d1508d
Some code fix.
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
90738
diff
changeset
|
189 (global-set-key [(control f22)] 'ps-despool) |
90736
ef1369583937
Split XEmacs/Emacs definitions and sample setup code into separate files
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
diff
changeset
|
190 (add-hook 'gnus-article-prepare-hook 'ps-gnus-article-prepare-hook) |
ef1369583937
Split XEmacs/Emacs definitions and sample setup code into separate files
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
diff
changeset
|
191 (add-hook 'gnus-summary-mode-hook 'ps-gnus-summary-setup) |
ef1369583937
Split XEmacs/Emacs definitions and sample setup code into separate files
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
diff
changeset
|
192 (add-hook 'vm-mode-hook 'ps-vm-mode-hook) |
ef1369583937
Split XEmacs/Emacs definitions and sample setup code into separate files
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
diff
changeset
|
193 (add-hook 'vm-mode-hooks 'ps-vm-mode-hook) |
ef1369583937
Split XEmacs/Emacs definitions and sample setup code into separate files
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
diff
changeset
|
194 (add-hook 'Info-mode-hook 'ps-info-mode-hook) |
ef1369583937
Split XEmacs/Emacs definitions and sample setup code into separate files
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
diff
changeset
|
195 (setq ps-spool-duplex t |
ef1369583937
Split XEmacs/Emacs definitions and sample setup code into separate files
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
diff
changeset
|
196 ps-print-color-p nil |
ef1369583937
Split XEmacs/Emacs definitions and sample setup code into separate files
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
diff
changeset
|
197 ps-lpr-command "lpr" |
ef1369583937
Split XEmacs/Emacs definitions and sample setup code into separate files
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
diff
changeset
|
198 ps-lpr-switches '("-Jjct,duplex_long")) |
ef1369583937
Split XEmacs/Emacs definitions and sample setup code into separate files
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
diff
changeset
|
199 'ps-jts-ps-setup) |
ef1369583937
Split XEmacs/Emacs definitions and sample setup code into separate files
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
diff
changeset
|
200 |
ef1369583937
Split XEmacs/Emacs definitions and sample setup code into separate files
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
diff
changeset
|
201 ;; WARNING! The following function is a *sample* only, and is *not* |
ef1369583937
Split XEmacs/Emacs definitions and sample setup code into separate files
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
diff
changeset
|
202 ;; meant to be used as a whole unless it corresponds to your needs. |
ef1369583937
Split XEmacs/Emacs definitions and sample setup code into separate files
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
diff
changeset
|
203 ;; (In fact, this is a copy of Jack's setup for ps-print -- |
ef1369583937
Split XEmacs/Emacs definitions and sample setup code into separate files
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
diff
changeset
|
204 ;; I would not be that surprised if it was useful to *anybody*, |
ef1369583937
Split XEmacs/Emacs definitions and sample setup code into separate files
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
diff
changeset
|
205 ;; without modification.) |
ef1369583937
Split XEmacs/Emacs definitions and sample setup code into separate files
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
diff
changeset
|
206 |
ef1369583937
Split XEmacs/Emacs definitions and sample setup code into separate files
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
diff
changeset
|
207 (defun ps-jack-setup () |
ef1369583937
Split XEmacs/Emacs definitions and sample setup code into separate files
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
diff
changeset
|
208 (setq ps-print-color-p nil |
ef1369583937
Split XEmacs/Emacs definitions and sample setup code into separate files
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
diff
changeset
|
209 ps-lpr-command "lpr" |
ef1369583937
Split XEmacs/Emacs definitions and sample setup code into separate files
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
diff
changeset
|
210 ps-lpr-switches nil |
ef1369583937
Split XEmacs/Emacs definitions and sample setup code into separate files
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
diff
changeset
|
211 |
ef1369583937
Split XEmacs/Emacs definitions and sample setup code into separate files
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
diff
changeset
|
212 ps-paper-type 'a4 |
ef1369583937
Split XEmacs/Emacs definitions and sample setup code into separate files
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
diff
changeset
|
213 ps-landscape-mode t |
ef1369583937
Split XEmacs/Emacs definitions and sample setup code into separate files
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
diff
changeset
|
214 ps-number-of-columns 2 |
ef1369583937
Split XEmacs/Emacs definitions and sample setup code into separate files
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
diff
changeset
|
215 |
ef1369583937
Split XEmacs/Emacs definitions and sample setup code into separate files
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
diff
changeset
|
216 ps-left-margin (/ (* 72 1.0) 2.54) ; 1.0 cm |
ef1369583937
Split XEmacs/Emacs definitions and sample setup code into separate files
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
diff
changeset
|
217 ps-right-margin (/ (* 72 1.0) 2.54) ; 1.0 cm |
ef1369583937
Split XEmacs/Emacs definitions and sample setup code into separate files
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
diff
changeset
|
218 ps-inter-column (/ (* 72 1.0) 2.54) ; 1.0 cm |
ef1369583937
Split XEmacs/Emacs definitions and sample setup code into separate files
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
diff
changeset
|
219 ps-bottom-margin (/ (* 72 1.5) 2.54) ; 1.5 cm |
ef1369583937
Split XEmacs/Emacs definitions and sample setup code into separate files
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
diff
changeset
|
220 ps-top-margin (/ (* 72 1.5) 2.54) ; 1.5 cm |
ef1369583937
Split XEmacs/Emacs definitions and sample setup code into separate files
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
diff
changeset
|
221 ps-header-offset (/ (* 72 1.0) 2.54) ; 1.0 cm |
ef1369583937
Split XEmacs/Emacs definitions and sample setup code into separate files
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
diff
changeset
|
222 ps-header-line-pad .15 |
ef1369583937
Split XEmacs/Emacs definitions and sample setup code into separate files
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
diff
changeset
|
223 ps-print-header t |
ef1369583937
Split XEmacs/Emacs definitions and sample setup code into separate files
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
diff
changeset
|
224 ps-print-header-frame t |
ef1369583937
Split XEmacs/Emacs definitions and sample setup code into separate files
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
diff
changeset
|
225 ps-header-lines 2 |
ef1369583937
Split XEmacs/Emacs definitions and sample setup code into separate files
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
diff
changeset
|
226 ps-show-n-of-n t |
ef1369583937
Split XEmacs/Emacs definitions and sample setup code into separate files
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
diff
changeset
|
227 ps-spool-duplex nil |
ef1369583937
Split XEmacs/Emacs definitions and sample setup code into separate files
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
diff
changeset
|
228 |
ef1369583937
Split XEmacs/Emacs definitions and sample setup code into separate files
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
diff
changeset
|
229 ps-font-family 'Courier |
ef1369583937
Split XEmacs/Emacs definitions and sample setup code into separate files
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
diff
changeset
|
230 ps-font-size 5.5 |
ef1369583937
Split XEmacs/Emacs definitions and sample setup code into separate files
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
diff
changeset
|
231 ps-header-font-family 'Helvetica |
ef1369583937
Split XEmacs/Emacs definitions and sample setup code into separate files
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
diff
changeset
|
232 ps-header-font-size 6 |
ef1369583937
Split XEmacs/Emacs definitions and sample setup code into separate files
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
diff
changeset
|
233 ps-header-title-font-size 8) |
ef1369583937
Split XEmacs/Emacs definitions and sample setup code into separate files
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
diff
changeset
|
234 'ps-jack-setup) |
ef1369583937
Split XEmacs/Emacs definitions and sample setup code into separate files
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
diff
changeset
|
235 |
ef1369583937
Split XEmacs/Emacs definitions and sample setup code into separate files
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
diff
changeset
|
236 |
ef1369583937
Split XEmacs/Emacs definitions and sample setup code into separate files
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
diff
changeset
|
237 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; |
ef1369583937
Split XEmacs/Emacs definitions and sample setup code into separate files
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
diff
changeset
|
238 |
93873
64def2c58ad1
* ps-samp.el (ps-add-printer, ps-remove-printer)
Michael Albinus <michael.albinus@gmx.de>
parents:
91332
diff
changeset
|
239 ;; If zeroconf is enabled, all CUPS printers can be detected. The |
64def2c58ad1
* ps-samp.el (ps-add-printer, ps-remove-printer)
Michael Albinus <michael.albinus@gmx.de>
parents:
91332
diff
changeset
|
240 ;; "Postscript printer" menu will be modified dynamically, as printers |
64def2c58ad1
* ps-samp.el (ps-add-printer, ps-remove-printer)
Michael Albinus <michael.albinus@gmx.de>
parents:
91332
diff
changeset
|
241 ;; are added or removed. |
64def2c58ad1
* ps-samp.el (ps-add-printer, ps-remove-printer)
Michael Albinus <michael.albinus@gmx.de>
parents:
91332
diff
changeset
|
242 |
64def2c58ad1
* ps-samp.el (ps-add-printer, ps-remove-printer)
Michael Albinus <michael.albinus@gmx.de>
parents:
91332
diff
changeset
|
243 ;; Preconditions: |
64def2c58ad1
* ps-samp.el (ps-add-printer, ps-remove-printer)
Michael Albinus <michael.albinus@gmx.de>
parents:
91332
diff
changeset
|
244 ;; |
64def2c58ad1
* ps-samp.el (ps-add-printer, ps-remove-printer)
Michael Albinus <michael.albinus@gmx.de>
parents:
91332
diff
changeset
|
245 ;; * Emacs has D-Bus support enabled. That is, D-Bus is installed on |
64def2c58ad1
* ps-samp.el (ps-add-printer, ps-remove-printer)
Michael Albinus <michael.albinus@gmx.de>
parents:
91332
diff
changeset
|
246 ;; the system, and Emacs has been configured and built with the |
64def2c58ad1
* ps-samp.el (ps-add-printer, ps-remove-printer)
Michael Albinus <michael.albinus@gmx.de>
parents:
91332
diff
changeset
|
247 ;; --with-dbus option. |
64def2c58ad1
* ps-samp.el (ps-add-printer, ps-remove-printer)
Michael Albinus <michael.albinus@gmx.de>
parents:
91332
diff
changeset
|
248 ;; |
64def2c58ad1
* ps-samp.el (ps-add-printer, ps-remove-printer)
Michael Albinus <michael.albinus@gmx.de>
parents:
91332
diff
changeset
|
249 ;; * The zeroconf daemon avahi-daemon is running. |
64def2c58ad1
* ps-samp.el (ps-add-printer, ps-remove-printer)
Michael Albinus <michael.albinus@gmx.de>
parents:
91332
diff
changeset
|
250 ;; |
64def2c58ad1
* ps-samp.el (ps-add-printer, ps-remove-printer)
Michael Albinus <michael.albinus@gmx.de>
parents:
91332
diff
changeset
|
251 ;; * CUPS has enabled the option "Share published printers connected |
64def2c58ad1
* ps-samp.el (ps-add-printer, ps-remove-printer)
Michael Albinus <michael.albinus@gmx.de>
parents:
91332
diff
changeset
|
252 ;; to this system" (see <http://localhost:631/admin>). |
64def2c58ad1
* ps-samp.el (ps-add-printer, ps-remove-printer)
Michael Albinus <michael.albinus@gmx.de>
parents:
91332
diff
changeset
|
253 |
64def2c58ad1
* ps-samp.el (ps-add-printer, ps-remove-printer)
Michael Albinus <michael.albinus@gmx.de>
parents:
91332
diff
changeset
|
254 (eval-when-compile |
64def2c58ad1
* ps-samp.el (ps-add-printer, ps-remove-printer)
Michael Albinus <michael.albinus@gmx.de>
parents:
91332
diff
changeset
|
255 (require 'cl)) |
64def2c58ad1
* ps-samp.el (ps-add-printer, ps-remove-printer)
Michael Albinus <michael.albinus@gmx.de>
parents:
91332
diff
changeset
|
256 |
64def2c58ad1
* ps-samp.el (ps-add-printer, ps-remove-printer)
Michael Albinus <michael.albinus@gmx.de>
parents:
91332
diff
changeset
|
257 (eval-and-compile |
64def2c58ad1
* ps-samp.el (ps-add-printer, ps-remove-printer)
Michael Albinus <michael.albinus@gmx.de>
parents:
91332
diff
changeset
|
258 (require 'printing) |
64def2c58ad1
* ps-samp.el (ps-add-printer, ps-remove-printer)
Michael Albinus <michael.albinus@gmx.de>
parents:
91332
diff
changeset
|
259 (require 'zeroconf)) |
64def2c58ad1
* ps-samp.el (ps-add-printer, ps-remove-printer)
Michael Albinus <michael.albinus@gmx.de>
parents:
91332
diff
changeset
|
260 |
64def2c58ad1
* ps-samp.el (ps-add-printer, ps-remove-printer)
Michael Albinus <michael.albinus@gmx.de>
parents:
91332
diff
changeset
|
261 ;; Add a Postscript printer to the "Postscript printer" menu. |
64def2c58ad1
* ps-samp.el (ps-add-printer, ps-remove-printer)
Michael Albinus <michael.albinus@gmx.de>
parents:
91332
diff
changeset
|
262 (defun ps-add-printer (service) |
64def2c58ad1
* ps-samp.el (ps-add-printer, ps-remove-printer)
Michael Albinus <michael.albinus@gmx.de>
parents:
91332
diff
changeset
|
263 (let ((name (zeroconf-service-name service)) |
64def2c58ad1
* ps-samp.el (ps-add-printer, ps-remove-printer)
Michael Albinus <michael.albinus@gmx.de>
parents:
91332
diff
changeset
|
264 (text (zeroconf-service-txt service)) |
64def2c58ad1
* ps-samp.el (ps-add-printer, ps-remove-printer)
Michael Albinus <michael.albinus@gmx.de>
parents:
91332
diff
changeset
|
265 (addr (zeroconf-service-address service)) |
64def2c58ad1
* ps-samp.el (ps-add-printer, ps-remove-printer)
Michael Albinus <michael.albinus@gmx.de>
parents:
91332
diff
changeset
|
266 (port (zeroconf-service-port service)) |
64def2c58ad1
* ps-samp.el (ps-add-printer, ps-remove-printer)
Michael Albinus <michael.albinus@gmx.de>
parents:
91332
diff
changeset
|
267 is-ps cups-queue) |
64def2c58ad1
* ps-samp.el (ps-add-printer, ps-remove-printer)
Michael Albinus <michael.albinus@gmx.de>
parents:
91332
diff
changeset
|
268 ;; `text' is an array of key=value strings like ("Duplex=T" "Copies=T"). |
64def2c58ad1
* ps-samp.el (ps-add-printer, ps-remove-printer)
Michael Albinus <michael.albinus@gmx.de>
parents:
91332
diff
changeset
|
269 (dolist (string text) |
64def2c58ad1
* ps-samp.el (ps-add-printer, ps-remove-printer)
Michael Albinus <michael.albinus@gmx.de>
parents:
91332
diff
changeset
|
270 (let ((split (split-string string "=" t))) |
64def2c58ad1
* ps-samp.el (ps-add-printer, ps-remove-printer)
Michael Albinus <michael.albinus@gmx.de>
parents:
91332
diff
changeset
|
271 ;; If it is a Postscript printer, there must be a string like |
64def2c58ad1
* ps-samp.el (ps-add-printer, ps-remove-printer)
Michael Albinus <michael.albinus@gmx.de>
parents:
91332
diff
changeset
|
272 ;; "pdl=application/postscript,application/vnd.hp-PCL,...". |
64def2c58ad1
* ps-samp.el (ps-add-printer, ps-remove-printer)
Michael Albinus <michael.albinus@gmx.de>
parents:
91332
diff
changeset
|
273 (when (and (string-equal "pdl" (car split)) |
64def2c58ad1
* ps-samp.el (ps-add-printer, ps-remove-printer)
Michael Albinus <michael.albinus@gmx.de>
parents:
91332
diff
changeset
|
274 (string-match "application/postscript" (cadr split))) |
64def2c58ad1
* ps-samp.el (ps-add-printer, ps-remove-printer)
Michael Albinus <michael.albinus@gmx.de>
parents:
91332
diff
changeset
|
275 (setq is-ps t)) |
64def2c58ad1
* ps-samp.el (ps-add-printer, ps-remove-printer)
Michael Albinus <michael.albinus@gmx.de>
parents:
91332
diff
changeset
|
276 ;; A CUPS printer queue is coded as "rp=printers/<name>". |
64def2c58ad1
* ps-samp.el (ps-add-printer, ps-remove-printer)
Michael Albinus <michael.albinus@gmx.de>
parents:
91332
diff
changeset
|
277 (when (and (string-equal "rp" (car split)) |
64def2c58ad1
* ps-samp.el (ps-add-printer, ps-remove-printer)
Michael Albinus <michael.albinus@gmx.de>
parents:
91332
diff
changeset
|
278 (string-match "printers/\\(.+\\)" (cadr split))) |
64def2c58ad1
* ps-samp.el (ps-add-printer, ps-remove-printer)
Michael Albinus <michael.albinus@gmx.de>
parents:
91332
diff
changeset
|
279 (setq cups-queue (match-string 1 (cadr split)))))) |
64def2c58ad1
* ps-samp.el (ps-add-printer, ps-remove-printer)
Michael Albinus <michael.albinus@gmx.de>
parents:
91332
diff
changeset
|
280 ;; Add the printer. |
64def2c58ad1
* ps-samp.el (ps-add-printer, ps-remove-printer)
Michael Albinus <michael.albinus@gmx.de>
parents:
91332
diff
changeset
|
281 (when is-ps |
64def2c58ad1
* ps-samp.el (ps-add-printer, ps-remove-printer)
Michael Albinus <michael.albinus@gmx.de>
parents:
91332
diff
changeset
|
282 (if cups-queue |
64def2c58ad1
* ps-samp.el (ps-add-printer, ps-remove-printer)
Michael Albinus <michael.albinus@gmx.de>
parents:
91332
diff
changeset
|
283 (add-to-list |
64def2c58ad1
* ps-samp.el (ps-add-printer, ps-remove-printer)
Michael Albinus <michael.albinus@gmx.de>
parents:
91332
diff
changeset
|
284 'pr-ps-printer-alist (list (intern name) "lpr" nil "-P" cups-queue)) |
64def2c58ad1
* ps-samp.el (ps-add-printer, ps-remove-printer)
Michael Albinus <michael.albinus@gmx.de>
parents:
91332
diff
changeset
|
285 ;; No CUPS printer, but a network printer. |
64def2c58ad1
* ps-samp.el (ps-add-printer, ps-remove-printer)
Michael Albinus <michael.albinus@gmx.de>
parents:
91332
diff
changeset
|
286 (add-to-list |
64def2c58ad1
* ps-samp.el (ps-add-printer, ps-remove-printer)
Michael Albinus <michael.albinus@gmx.de>
parents:
91332
diff
changeset
|
287 'pr-ps-printer-alist (list (intern name) "cupsdoprint" |
64def2c58ad1
* ps-samp.el (ps-add-printer, ps-remove-printer)
Michael Albinus <michael.albinus@gmx.de>
parents:
91332
diff
changeset
|
288 '("-P" "default") |
64def2c58ad1
* ps-samp.el (ps-add-printer, ps-remove-printer)
Michael Albinus <michael.albinus@gmx.de>
parents:
91332
diff
changeset
|
289 "-H" (format "%s:%s" addr port)))) |
64def2c58ad1
* ps-samp.el (ps-add-printer, ps-remove-printer)
Michael Albinus <michael.albinus@gmx.de>
parents:
91332
diff
changeset
|
290 (pr-update-menus t)))) |
64def2c58ad1
* ps-samp.el (ps-add-printer, ps-remove-printer)
Michael Albinus <michael.albinus@gmx.de>
parents:
91332
diff
changeset
|
291 |
64def2c58ad1
* ps-samp.el (ps-add-printer, ps-remove-printer)
Michael Albinus <michael.albinus@gmx.de>
parents:
91332
diff
changeset
|
292 ;; Remove a printer from the "Postscript printer" menu. |
64def2c58ad1
* ps-samp.el (ps-add-printer, ps-remove-printer)
Michael Albinus <michael.albinus@gmx.de>
parents:
91332
diff
changeset
|
293 (defun ps-remove-printer (service) |
64def2c58ad1
* ps-samp.el (ps-add-printer, ps-remove-printer)
Michael Albinus <michael.albinus@gmx.de>
parents:
91332
diff
changeset
|
294 (setq pr-ps-printer-alist |
64def2c58ad1
* ps-samp.el (ps-add-printer, ps-remove-printer)
Michael Albinus <michael.albinus@gmx.de>
parents:
91332
diff
changeset
|
295 (delete (assoc (intern (zeroconf-service-name service)) |
64def2c58ad1
* ps-samp.el (ps-add-printer, ps-remove-printer)
Michael Albinus <michael.albinus@gmx.de>
parents:
91332
diff
changeset
|
296 pr-ps-printer-alist) |
64def2c58ad1
* ps-samp.el (ps-add-printer, ps-remove-printer)
Michael Albinus <michael.albinus@gmx.de>
parents:
91332
diff
changeset
|
297 pr-ps-printer-alist)) |
64def2c58ad1
* ps-samp.el (ps-add-printer, ps-remove-printer)
Michael Albinus <michael.albinus@gmx.de>
parents:
91332
diff
changeset
|
298 (pr-update-menus t)) |
64def2c58ad1
* ps-samp.el (ps-add-printer, ps-remove-printer)
Michael Albinus <michael.albinus@gmx.de>
parents:
91332
diff
changeset
|
299 |
64def2c58ad1
* ps-samp.el (ps-add-printer, ps-remove-printer)
Michael Albinus <michael.albinus@gmx.de>
parents:
91332
diff
changeset
|
300 ;; Activate the functions in zeroconf. |
64def2c58ad1
* ps-samp.el (ps-add-printer, ps-remove-printer)
Michael Albinus <michael.albinus@gmx.de>
parents:
91332
diff
changeset
|
301 (defun ps-make-dynamic-printer-menu () |
64def2c58ad1
* ps-samp.el (ps-add-printer, ps-remove-printer)
Michael Albinus <michael.albinus@gmx.de>
parents:
91332
diff
changeset
|
302 (when (featurep 'dbusbind) |
64def2c58ad1
* ps-samp.el (ps-add-printer, ps-remove-printer)
Michael Albinus <michael.albinus@gmx.de>
parents:
91332
diff
changeset
|
303 (zeroconf-init) |
64def2c58ad1
* ps-samp.el (ps-add-printer, ps-remove-printer)
Michael Albinus <michael.albinus@gmx.de>
parents:
91332
diff
changeset
|
304 (zeroconf-service-add-hook "_ipp._tcp" :new 'ps-add-printer) |
64def2c58ad1
* ps-samp.el (ps-add-printer, ps-remove-printer)
Michael Albinus <michael.albinus@gmx.de>
parents:
91332
diff
changeset
|
305 (zeroconf-service-add-hook "_ipp._tcp" :removed 'ps-remove-printer))) |
64def2c58ad1
* ps-samp.el (ps-add-printer, ps-remove-printer)
Michael Albinus <michael.albinus@gmx.de>
parents:
91332
diff
changeset
|
306 |
64def2c58ad1
* ps-samp.el (ps-add-printer, ps-remove-printer)
Michael Albinus <michael.albinus@gmx.de>
parents:
91332
diff
changeset
|
307 |
64def2c58ad1
* ps-samp.el (ps-add-printer, ps-remove-printer)
Michael Albinus <michael.albinus@gmx.de>
parents:
91332
diff
changeset
|
308 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; |
64def2c58ad1
* ps-samp.el (ps-add-printer, ps-remove-printer)
Michael Albinus <michael.albinus@gmx.de>
parents:
91332
diff
changeset
|
309 |
90736
ef1369583937
Split XEmacs/Emacs definitions and sample setup code into separate files
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
diff
changeset
|
310 (provide 'ps-samp) |
ef1369583937
Split XEmacs/Emacs definitions and sample setup code into separate files
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
diff
changeset
|
311 |
90738
a77c806ee80a
Changes from arch/CVS synchronization
Miles Bader <miles@gnu.org>
parents:
90736
diff
changeset
|
312 ;; arch-tag: 99c415d3-be39-43c6-aa32-7ee33ba19600 |
90736
ef1369583937
Split XEmacs/Emacs definitions and sample setup code into separate files
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
diff
changeset
|
313 ;;; ps-samp.el ends here |