Mercurial > emacs
annotate lisp/ps-samp.el @ 112063:4bb564da3320
Enable display mode of MIME message in rmail.
author | Kenichi Handa <handa@m17n.org> |
---|---|
date | Fri, 24 Dec 2010 13:40:42 +0900 |
parents | 1d1d5d9bd884 |
children | 280c8ae2476d 376148b31b5e |
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 |
106815 | 3 ;; Copyright (C) 2007, 2008, 2009, 2010 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) |
105994
009383a57ce8
* x-dnd.el (x-dnd-maybe-call-test-function):
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
100908
diff
changeset
|
75 (with-current-buffer ps-buf |
90736
ef1369583937
Split XEmacs/Emacs definitions and sample setup code into separate files
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
diff
changeset
|
76 (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
|
77 |
ef1369583937
Split XEmacs/Emacs definitions and sample setup code into separate files
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
diff
changeset
|
78 ;; 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
|
79 ;; 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
|
80 (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
|
81 (save-excursion |
ef1369583937
Split XEmacs/Emacs definitions and sample setup code into separate files
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
diff
changeset
|
82 (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
|
83 (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
|
84 (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
|
85 "Subject ???"))) |
ef1369583937
Split XEmacs/Emacs definitions and sample setup code into separate files
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
diff
changeset
|
86 |
ef1369583937
Split XEmacs/Emacs definitions and sample setup code into separate files
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
diff
changeset
|
87 ;; 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
|
88 ;; 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
|
89 ;; 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
|
90 (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
|
91 (save-excursion |
ef1369583937
Split XEmacs/Emacs definitions and sample setup code into separate files
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
diff
changeset
|
92 (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
|
93 (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
|
94 (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
|
95 (cond |
ef1369583937
Split XEmacs/Emacs definitions and sample setup code into separate files
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
diff
changeset
|
96 |
ef1369583937
Split XEmacs/Emacs definitions and sample setup code into separate files
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
diff
changeset
|
97 ;; 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
|
98 ;; 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
|
99 ((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
|
100 (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
|
101 |
ef1369583937
Split XEmacs/Emacs definitions and sample setup code into separate files
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
diff
changeset
|
102 ;; 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
|
103 ;; 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
|
104 ;; "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
|
105 ((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
|
106 (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
|
107 |
ef1369583937
Split XEmacs/Emacs definitions and sample setup code into separate files
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
diff
changeset
|
108 ;; 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
|
109 (t fromstring))) |
ef1369583937
Split XEmacs/Emacs definitions and sample setup code into separate files
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
diff
changeset
|
110 "From ???"))) |
ef1369583937
Split XEmacs/Emacs definitions and sample setup code into separate files
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
diff
changeset
|
111 |
ef1369583937
Split XEmacs/Emacs definitions and sample setup code into separate files
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
diff
changeset
|
112 ;; 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
|
113 ;; `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
|
114 ;; `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
|
115 ;; 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
|
116 ;; 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
|
117 ;; 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
|
118 (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
|
119 (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
|
120 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
|
121 ;; 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
|
122 ;; 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
|
123 '(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
|
124 |
ef1369583937
Split XEmacs/Emacs definitions and sample setup code into separate files
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
diff
changeset
|
125 ;; 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
|
126 ;; `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
|
127 (defun ps-vm-mode-hook () |
90779
6ea6d3d1508d
Some code fix.
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
90738
diff
changeset
|
128 (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
|
129 (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
|
130 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
|
131 ;; 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
|
132 ;; 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
|
133 '(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
|
134 |
ef1369583937
Split XEmacs/Emacs definitions and sample setup code into separate files
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
diff
changeset
|
135 ;; 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
|
136 ;; 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
|
137 ;; 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
|
138 ;; 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
|
139 ;; buffers first. |
ef1369583937
Split XEmacs/Emacs definitions and sample setup code into separate files
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
diff
changeset
|
140 ;; 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
|
141 (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
|
142 (interactive) |
ef1369583937
Split XEmacs/Emacs definitions and sample setup code into separate files
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
diff
changeset
|
143 (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
|
144 |
ef1369583937
Split XEmacs/Emacs definitions and sample setup code into separate files
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
diff
changeset
|
145 ;; 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
|
146 ;; 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
|
147 (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
|
148 (interactive) |
ef1369583937
Split XEmacs/Emacs definitions and sample setup code into separate files
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
diff
changeset
|
149 (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
|
150 |
ef1369583937
Split XEmacs/Emacs definitions and sample setup code into separate files
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
diff
changeset
|
151 ;; 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
|
152 ;; prsc. |
ef1369583937
Split XEmacs/Emacs definitions and sample setup code into separate files
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
diff
changeset
|
153 (defun ps-gnus-summary-setup () |
90779
6ea6d3d1508d
Some code fix.
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
90738
diff
changeset
|
154 (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
|
155 |
ef1369583937
Split XEmacs/Emacs definitions and sample setup code into separate files
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
diff
changeset
|
156 ;; 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
|
157 ;; 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
|
158 (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
|
159 (save-excursion |
ef1369583937
Split XEmacs/Emacs definitions and sample setup code into separate files
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
diff
changeset
|
160 (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
|
161 (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
|
162 (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
|
163 "File ???"))) |
ef1369583937
Split XEmacs/Emacs definitions and sample setup code into separate files
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
diff
changeset
|
164 |
ef1369583937
Split XEmacs/Emacs definitions and sample setup code into separate files
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
diff
changeset
|
165 ;; 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
|
166 ;; 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
|
167 (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
|
168 (save-excursion |
ef1369583937
Split XEmacs/Emacs definitions and sample setup code into separate files
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
diff
changeset
|
169 (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
|
170 (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
|
171 (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
|
172 "Node ???"))) |
ef1369583937
Split XEmacs/Emacs definitions and sample setup code into separate files
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
diff
changeset
|
173 |
ef1369583937
Split XEmacs/Emacs definitions and sample setup code into separate files
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
diff
changeset
|
174 (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
|
175 (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
|
176 ;; 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
|
177 '(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
|
178 |
ef1369583937
Split XEmacs/Emacs definitions and sample setup code into separate files
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
diff
changeset
|
179 ;; 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
|
180 ;; 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
|
181 ;; 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
|
182 ;; 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
|
183 ;; modification.) |
ef1369583937
Split XEmacs/Emacs definitions and sample setup code into separate files
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
diff
changeset
|
184 |
ef1369583937
Split XEmacs/Emacs definitions and sample setup code into separate files
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
diff
changeset
|
185 (defun ps-jts-ps-setup () |
90779
6ea6d3d1508d
Some code fix.
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
90738
diff
changeset
|
186 (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
|
187 (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
|
188 (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
|
189 (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
|
190 (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
|
191 (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
|
192 (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
|
193 (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
|
194 (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
|
195 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
|
196 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
|
197 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
|
198 '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
|
199 |
ef1369583937
Split XEmacs/Emacs definitions and sample setup code into separate files
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
diff
changeset
|
200 ;; 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
|
201 ;; 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
|
202 ;; (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
|
203 ;; 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
|
204 ;; without modification.) |
ef1369583937
Split XEmacs/Emacs definitions and sample setup code into separate files
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
diff
changeset
|
205 |
ef1369583937
Split XEmacs/Emacs definitions and sample setup code into separate files
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
diff
changeset
|
206 (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
|
207 (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
|
208 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
|
209 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
|
210 |
ef1369583937
Split XEmacs/Emacs definitions and sample setup code into separate files
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
diff
changeset
|
211 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
|
212 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
|
213 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
|
214 |
ef1369583937
Split XEmacs/Emacs definitions and sample setup code into separate files
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
diff
changeset
|
215 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
|
216 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
|
217 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
|
218 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
|
219 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
|
220 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
|
221 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
|
222 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
|
223 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
|
224 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
|
225 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
|
226 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
|
227 |
ef1369583937
Split XEmacs/Emacs definitions and sample setup code into separate files
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
diff
changeset
|
228 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
|
229 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
|
230 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
|
231 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
|
232 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
|
233 '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
|
234 |
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 |
93873
64def2c58ad1
* ps-samp.el (ps-add-printer, ps-remove-printer)
Michael Albinus <michael.albinus@gmx.de>
parents:
91332
diff
changeset
|
238 ;; 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
|
239 ;; "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
|
240 ;; are added or removed. |
64def2c58ad1
* ps-samp.el (ps-add-printer, ps-remove-printer)
Michael Albinus <michael.albinus@gmx.de>
parents:
91332
diff
changeset
|
241 |
64def2c58ad1
* ps-samp.el (ps-add-printer, ps-remove-printer)
Michael Albinus <michael.albinus@gmx.de>
parents:
91332
diff
changeset
|
242 ;; Preconditions: |
64def2c58ad1
* ps-samp.el (ps-add-printer, ps-remove-printer)
Michael Albinus <michael.albinus@gmx.de>
parents:
91332
diff
changeset
|
243 ;; |
64def2c58ad1
* ps-samp.el (ps-add-printer, ps-remove-printer)
Michael Albinus <michael.albinus@gmx.de>
parents:
91332
diff
changeset
|
244 ;; * 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
|
245 ;; 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
|
246 ;; --with-dbus option. |
64def2c58ad1
* ps-samp.el (ps-add-printer, ps-remove-printer)
Michael Albinus <michael.albinus@gmx.de>
parents:
91332
diff
changeset
|
247 ;; |
64def2c58ad1
* ps-samp.el (ps-add-printer, ps-remove-printer)
Michael Albinus <michael.albinus@gmx.de>
parents:
91332
diff
changeset
|
248 ;; * 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
|
249 ;; |
64def2c58ad1
* ps-samp.el (ps-add-printer, ps-remove-printer)
Michael Albinus <michael.albinus@gmx.de>
parents:
91332
diff
changeset
|
250 ;; * 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
|
251 ;; 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
|
252 |
64def2c58ad1
* ps-samp.el (ps-add-printer, ps-remove-printer)
Michael Albinus <michael.albinus@gmx.de>
parents:
91332
diff
changeset
|
253 (eval-when-compile |
64def2c58ad1
* ps-samp.el (ps-add-printer, ps-remove-printer)
Michael Albinus <michael.albinus@gmx.de>
parents:
91332
diff
changeset
|
254 (require 'cl)) |
64def2c58ad1
* ps-samp.el (ps-add-printer, ps-remove-printer)
Michael Albinus <michael.albinus@gmx.de>
parents:
91332
diff
changeset
|
255 |
64def2c58ad1
* ps-samp.el (ps-add-printer, ps-remove-printer)
Michael Albinus <michael.albinus@gmx.de>
parents:
91332
diff
changeset
|
256 (eval-and-compile |
64def2c58ad1
* ps-samp.el (ps-add-printer, ps-remove-printer)
Michael Albinus <michael.albinus@gmx.de>
parents:
91332
diff
changeset
|
257 (require 'printing) |
64def2c58ad1
* ps-samp.el (ps-add-printer, ps-remove-printer)
Michael Albinus <michael.albinus@gmx.de>
parents:
91332
diff
changeset
|
258 (require 'zeroconf)) |
64def2c58ad1
* ps-samp.el (ps-add-printer, ps-remove-printer)
Michael Albinus <michael.albinus@gmx.de>
parents:
91332
diff
changeset
|
259 |
64def2c58ad1
* ps-samp.el (ps-add-printer, ps-remove-printer)
Michael Albinus <michael.albinus@gmx.de>
parents:
91332
diff
changeset
|
260 ;; 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
|
261 (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
|
262 (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
|
263 (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
|
264 (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
|
265 (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
|
266 is-ps cups-queue) |
64def2c58ad1
* ps-samp.el (ps-add-printer, ps-remove-printer)
Michael Albinus <michael.albinus@gmx.de>
parents:
91332
diff
changeset
|
267 ;; `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
|
268 (dolist (string text) |
64def2c58ad1
* ps-samp.el (ps-add-printer, ps-remove-printer)
Michael Albinus <michael.albinus@gmx.de>
parents:
91332
diff
changeset
|
269 (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
|
270 ;; 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
|
271 ;; "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
|
272 (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
|
273 (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
|
274 (setq is-ps t)) |
64def2c58ad1
* ps-samp.el (ps-add-printer, ps-remove-printer)
Michael Albinus <michael.albinus@gmx.de>
parents:
91332
diff
changeset
|
275 ;; 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
|
276 (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
|
277 (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
|
278 (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
|
279 ;; Add the printer. |
64def2c58ad1
* ps-samp.el (ps-add-printer, ps-remove-printer)
Michael Albinus <michael.albinus@gmx.de>
parents:
91332
diff
changeset
|
280 (when is-ps |
64def2c58ad1
* ps-samp.el (ps-add-printer, ps-remove-printer)
Michael Albinus <michael.albinus@gmx.de>
parents:
91332
diff
changeset
|
281 (if cups-queue |
64def2c58ad1
* ps-samp.el (ps-add-printer, ps-remove-printer)
Michael Albinus <michael.albinus@gmx.de>
parents:
91332
diff
changeset
|
282 (add-to-list |
64def2c58ad1
* ps-samp.el (ps-add-printer, ps-remove-printer)
Michael Albinus <michael.albinus@gmx.de>
parents:
91332
diff
changeset
|
283 '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
|
284 ;; 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
|
285 (add-to-list |
64def2c58ad1
* ps-samp.el (ps-add-printer, ps-remove-printer)
Michael Albinus <michael.albinus@gmx.de>
parents:
91332
diff
changeset
|
286 '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
|
287 '("-P" "default") |
64def2c58ad1
* ps-samp.el (ps-add-printer, ps-remove-printer)
Michael Albinus <michael.albinus@gmx.de>
parents:
91332
diff
changeset
|
288 "-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
|
289 (pr-update-menus t)))) |
64def2c58ad1
* ps-samp.el (ps-add-printer, ps-remove-printer)
Michael Albinus <michael.albinus@gmx.de>
parents:
91332
diff
changeset
|
290 |
64def2c58ad1
* ps-samp.el (ps-add-printer, ps-remove-printer)
Michael Albinus <michael.albinus@gmx.de>
parents:
91332
diff
changeset
|
291 ;; 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
|
292 (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
|
293 (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
|
294 (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
|
295 pr-ps-printer-alist) |
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-update-menus t)) |
64def2c58ad1
* ps-samp.el (ps-add-printer, ps-remove-printer)
Michael Albinus <michael.albinus@gmx.de>
parents:
91332
diff
changeset
|
298 |
64def2c58ad1
* ps-samp.el (ps-add-printer, ps-remove-printer)
Michael Albinus <michael.albinus@gmx.de>
parents:
91332
diff
changeset
|
299 ;; 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
|
300 (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
|
301 (when (featurep 'dbusbind) |
64def2c58ad1
* ps-samp.el (ps-add-printer, ps-remove-printer)
Michael Albinus <michael.albinus@gmx.de>
parents:
91332
diff
changeset
|
302 (zeroconf-init) |
64def2c58ad1
* ps-samp.el (ps-add-printer, ps-remove-printer)
Michael Albinus <michael.albinus@gmx.de>
parents:
91332
diff
changeset
|
303 (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
|
304 (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
|
305 |
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 |
90736
ef1369583937
Split XEmacs/Emacs definitions and sample setup code into separate files
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
diff
changeset
|
309 (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
|
310 |
90738
a77c806ee80a
Changes from arch/CVS synchronization
Miles Bader <miles@gnu.org>
parents:
90736
diff
changeset
|
311 ;; 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
|
312 ;;; ps-samp.el ends here |