Mercurial > emacs
annotate lisp/ps-samp.el @ 94170:089e514d4665
*** empty log message ***
author | Juanma Barranquero <lekktu@gmail.com> |
---|---|
date | Fri, 18 Apr 2008 10:39:01 +0000 |
parents | 64def2c58ad1 |
children | ee5932bf781d |
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 |
ef1369583937
Split XEmacs/Emacs definitions and sample setup code into separate files
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
diff
changeset
|
16 ;; GNU Emacs is free software; you can redistribute it and/or modify it under |
ef1369583937
Split XEmacs/Emacs definitions and sample setup code into separate files
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
diff
changeset
|
17 ;; the terms of the GNU General Public License as published by the Free |
91074
40e293a4f795
Replace GPL version 2 by 3
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
90779
diff
changeset
|
18 ;; Software Foundation; either version 3, or (at your option) any later |
90736
ef1369583937
Split XEmacs/Emacs definitions and sample setup code into separate files
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
diff
changeset
|
19 ;; version. |
ef1369583937
Split XEmacs/Emacs definitions and sample setup code into separate files
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
diff
changeset
|
20 |
ef1369583937
Split XEmacs/Emacs definitions and sample setup code into separate files
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
diff
changeset
|
21 ;; GNU Emacs is distributed in the hope that it will be useful, but WITHOUT ANY |
ef1369583937
Split XEmacs/Emacs definitions and sample setup code into separate files
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
diff
changeset
|
22 ;; WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS |
ef1369583937
Split XEmacs/Emacs definitions and sample setup code into separate files
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
diff
changeset
|
23 ;; FOR A PARTICULAR PURPOSE. See the GNU General Public License for more |
ef1369583937
Split XEmacs/Emacs definitions and sample setup code into separate files
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
diff
changeset
|
24 ;; details. |
ef1369583937
Split XEmacs/Emacs definitions and sample setup code into separate files
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
diff
changeset
|
25 |
ef1369583937
Split XEmacs/Emacs definitions and sample setup code into separate files
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
diff
changeset
|
26 ;; You should have received a copy of the GNU General Public License along with |
ef1369583937
Split XEmacs/Emacs definitions and sample setup code into separate files
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
diff
changeset
|
27 ;; GNU Emacs; see the file COPYING. If not, write to the Free Software |
ef1369583937
Split XEmacs/Emacs definitions and sample setup code into separate files
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
diff
changeset
|
28 ;; Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. |
ef1369583937
Split XEmacs/Emacs definitions and sample setup code into separate files
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
diff
changeset
|
29 |
ef1369583937
Split XEmacs/Emacs definitions and sample setup code into separate files
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
diff
changeset
|
30 ;;; Commentary: |
ef1369583937
Split XEmacs/Emacs definitions and sample setup code into separate files
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
diff
changeset
|
31 |
ef1369583937
Split XEmacs/Emacs definitions and sample setup code into separate files
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
diff
changeset
|
32 ;; 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
|
33 |
ef1369583937
Split XEmacs/Emacs definitions and sample setup code into separate files
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
diff
changeset
|
34 ;;; Code: |
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 |
ef1369583937
Split XEmacs/Emacs definitions and sample setup code into separate files
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
diff
changeset
|
37 (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
|
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 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; |
ef1369583937
Split XEmacs/Emacs definitions and sample setup code into separate files
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
diff
changeset
|
41 ;;; 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
|
42 |
ef1369583937
Split XEmacs/Emacs definitions and sample setup code into separate files
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
diff
changeset
|
43 |
ef1369583937
Split XEmacs/Emacs definitions and sample setup code into separate files
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
diff
changeset
|
44 ;; 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
|
45 ;; 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
|
46 ;; 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
|
47 |
ef1369583937
Split XEmacs/Emacs definitions and sample setup code into separate files
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
diff
changeset
|
48 ;; 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
|
49 ;; 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
|
50 |
90779
6ea6d3d1508d
Some code fix.
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
90738
diff
changeset
|
51 ;; 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
|
52 |
ef1369583937
Split XEmacs/Emacs definitions and sample setup code into separate files
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
diff
changeset
|
53 ;; 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
|
54 ;; `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
|
55 (defun ps-rmail-mode-hook () |
90779
6ea6d3d1508d
Some code fix.
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
90738
diff
changeset
|
56 (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
|
57 (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
|
58 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
|
59 ;; 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
|
60 ;; 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
|
61 '(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
|
62 |
ef1369583937
Split XEmacs/Emacs definitions and sample setup code into separate files
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
diff
changeset
|
63 ;; 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
|
64 ;; 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
|
65 (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
|
66 (interactive) |
ef1369583937
Split XEmacs/Emacs definitions and sample setup code into separate files
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
diff
changeset
|
67 (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
|
68 |
ef1369583937
Split XEmacs/Emacs definitions and sample setup code into separate files
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
diff
changeset
|
69 ;; 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
|
70 ;; `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
|
71 (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
|
72 (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
|
73 (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
|
74 summary-default))) |
ef1369583937
Split XEmacs/Emacs definitions and sample setup code into separate files
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
diff
changeset
|
75 (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
|
76 (save-excursion |
ef1369583937
Split XEmacs/Emacs definitions and sample setup code into separate files
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
diff
changeset
|
77 (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
|
78 (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
|
79 |
ef1369583937
Split XEmacs/Emacs definitions and sample setup code into separate files
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
diff
changeset
|
80 ;; 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
|
81 ;; 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
|
82 (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
|
83 (save-excursion |
ef1369583937
Split XEmacs/Emacs definitions and sample setup code into separate files
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
diff
changeset
|
84 (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
|
85 (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
|
86 (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
|
87 "Subject ???"))) |
ef1369583937
Split XEmacs/Emacs definitions and sample setup code into separate files
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
diff
changeset
|
88 |
ef1369583937
Split XEmacs/Emacs definitions and sample setup code into separate files
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
diff
changeset
|
89 ;; 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
|
90 ;; 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
|
91 ;; 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
|
92 (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
|
93 (save-excursion |
ef1369583937
Split XEmacs/Emacs definitions and sample setup code into separate files
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
diff
changeset
|
94 (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
|
95 (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
|
96 (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
|
97 (cond |
ef1369583937
Split XEmacs/Emacs definitions and sample setup code into separate files
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
diff
changeset
|
98 |
ef1369583937
Split XEmacs/Emacs definitions and sample setup code into separate files
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
diff
changeset
|
99 ;; 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
|
100 ;; 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
|
101 ((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
|
102 (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
|
103 |
ef1369583937
Split XEmacs/Emacs definitions and sample setup code into separate files
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
diff
changeset
|
104 ;; 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
|
105 ;; 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
|
106 ;; "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
|
107 ((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
|
108 (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
|
109 |
ef1369583937
Split XEmacs/Emacs definitions and sample setup code into separate files
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
diff
changeset
|
110 ;; 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
|
111 (t fromstring))) |
ef1369583937
Split XEmacs/Emacs definitions and sample setup code into separate files
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
diff
changeset
|
112 "From ???"))) |
ef1369583937
Split XEmacs/Emacs definitions and sample setup code into separate files
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
diff
changeset
|
113 |
ef1369583937
Split XEmacs/Emacs definitions and sample setup code into separate files
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
diff
changeset
|
114 ;; 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
|
115 ;; `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
|
116 ;; `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
|
117 ;; 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
|
118 ;; 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
|
119 ;; 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
|
120 (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
|
121 (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
|
122 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
|
123 ;; 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
|
124 ;; 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
|
125 '(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
|
126 |
ef1369583937
Split XEmacs/Emacs definitions and sample setup code into separate files
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
diff
changeset
|
127 ;; 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
|
128 ;; `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
|
129 (defun ps-vm-mode-hook () |
90779
6ea6d3d1508d
Some code fix.
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
90738
diff
changeset
|
130 (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
|
131 (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
|
132 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
|
133 ;; 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
|
134 ;; 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
|
135 '(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
|
136 |
ef1369583937
Split XEmacs/Emacs definitions and sample setup code into separate files
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
diff
changeset
|
137 ;; 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
|
138 ;; 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
|
139 ;; 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
|
140 ;; 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
|
141 ;; buffers first. |
ef1369583937
Split XEmacs/Emacs definitions and sample setup code into separate files
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
diff
changeset
|
142 ;; 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
|
143 (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
|
144 (interactive) |
ef1369583937
Split XEmacs/Emacs definitions and sample setup code into separate files
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
diff
changeset
|
145 (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
|
146 |
ef1369583937
Split XEmacs/Emacs definitions and sample setup code into separate files
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
diff
changeset
|
147 ;; 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
|
148 ;; 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
|
149 (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
|
150 (interactive) |
ef1369583937
Split XEmacs/Emacs definitions and sample setup code into separate files
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
diff
changeset
|
151 (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
|
152 |
ef1369583937
Split XEmacs/Emacs definitions and sample setup code into separate files
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
diff
changeset
|
153 ;; 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
|
154 ;; prsc. |
ef1369583937
Split XEmacs/Emacs definitions and sample setup code into separate files
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
diff
changeset
|
155 (defun ps-gnus-summary-setup () |
90779
6ea6d3d1508d
Some code fix.
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
90738
diff
changeset
|
156 (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
|
157 |
ef1369583937
Split XEmacs/Emacs definitions and sample setup code into separate files
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
diff
changeset
|
158 ;; 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
|
159 ;; 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
|
160 (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
|
161 (save-excursion |
ef1369583937
Split XEmacs/Emacs definitions and sample setup code into separate files
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
diff
changeset
|
162 (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
|
163 (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
|
164 (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
|
165 "File ???"))) |
ef1369583937
Split XEmacs/Emacs definitions and sample setup code into separate files
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
diff
changeset
|
166 |
ef1369583937
Split XEmacs/Emacs definitions and sample setup code into separate files
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
diff
changeset
|
167 ;; 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
|
168 ;; 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
|
169 (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
|
170 (save-excursion |
ef1369583937
Split XEmacs/Emacs definitions and sample setup code into separate files
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
diff
changeset
|
171 (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
|
172 (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
|
173 (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
|
174 "Node ???"))) |
ef1369583937
Split XEmacs/Emacs definitions and sample setup code into separate files
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
diff
changeset
|
175 |
ef1369583937
Split XEmacs/Emacs definitions and sample setup code into separate files
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
diff
changeset
|
176 (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
|
177 (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
|
178 ;; 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
|
179 '(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
|
180 |
ef1369583937
Split XEmacs/Emacs definitions and sample setup code into separate files
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
diff
changeset
|
181 ;; 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
|
182 ;; 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
|
183 ;; 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
|
184 ;; 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
|
185 ;; modification.) |
ef1369583937
Split XEmacs/Emacs definitions and sample setup code into separate files
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
diff
changeset
|
186 |
ef1369583937
Split XEmacs/Emacs definitions and sample setup code into separate files
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
diff
changeset
|
187 (defun ps-jts-ps-setup () |
90779
6ea6d3d1508d
Some code fix.
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
90738
diff
changeset
|
188 (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
|
189 (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
|
190 (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
|
191 (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
|
192 (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
|
193 (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
|
194 (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
|
195 (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
|
196 (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
|
197 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
|
198 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
|
199 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
|
200 '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
|
201 |
ef1369583937
Split XEmacs/Emacs definitions and sample setup code into separate files
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
diff
changeset
|
202 ;; 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
|
203 ;; 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
|
204 ;; (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
|
205 ;; 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
|
206 ;; without modification.) |
ef1369583937
Split XEmacs/Emacs definitions and sample setup code into separate files
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
diff
changeset
|
207 |
ef1369583937
Split XEmacs/Emacs definitions and sample setup code into separate files
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
diff
changeset
|
208 (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
|
209 (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
|
210 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
|
211 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
|
212 |
ef1369583937
Split XEmacs/Emacs definitions and sample setup code into separate files
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
diff
changeset
|
213 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
|
214 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
|
215 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
|
216 |
ef1369583937
Split XEmacs/Emacs definitions and sample setup code into separate files
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
diff
changeset
|
217 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
|
218 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
|
219 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
|
220 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
|
221 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
|
222 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
|
223 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
|
224 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
|
225 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
|
226 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
|
227 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
|
228 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
|
229 |
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-family 'Courier |
ef1369583937
Split XEmacs/Emacs definitions and sample setup code into separate files
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
diff
changeset
|
231 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
|
232 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
|
233 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
|
234 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
|
235 '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
|
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 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; |
ef1369583937
Split XEmacs/Emacs definitions and sample setup code into separate files
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
diff
changeset
|
239 |
93873
64def2c58ad1
* ps-samp.el (ps-add-printer, ps-remove-printer)
Michael Albinus <michael.albinus@gmx.de>
parents:
91332
diff
changeset
|
240 ;; 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
|
241 ;; "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
|
242 ;; are added or removed. |
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 ;; Preconditions: |
64def2c58ad1
* ps-samp.el (ps-add-printer, ps-remove-printer)
Michael Albinus <michael.albinus@gmx.de>
parents:
91332
diff
changeset
|
245 ;; |
64def2c58ad1
* ps-samp.el (ps-add-printer, ps-remove-printer)
Michael Albinus <michael.albinus@gmx.de>
parents:
91332
diff
changeset
|
246 ;; * 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
|
247 ;; 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
|
248 ;; --with-dbus option. |
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 ;; * 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
|
251 ;; |
64def2c58ad1
* ps-samp.el (ps-add-printer, ps-remove-printer)
Michael Albinus <michael.albinus@gmx.de>
parents:
91332
diff
changeset
|
252 ;; * 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
|
253 ;; 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
|
254 |
64def2c58ad1
* ps-samp.el (ps-add-printer, ps-remove-printer)
Michael Albinus <michael.albinus@gmx.de>
parents:
91332
diff
changeset
|
255 (eval-when-compile |
64def2c58ad1
* ps-samp.el (ps-add-printer, ps-remove-printer)
Michael Albinus <michael.albinus@gmx.de>
parents:
91332
diff
changeset
|
256 (require 'cl)) |
64def2c58ad1
* ps-samp.el (ps-add-printer, ps-remove-printer)
Michael Albinus <michael.albinus@gmx.de>
parents:
91332
diff
changeset
|
257 |
64def2c58ad1
* ps-samp.el (ps-add-printer, ps-remove-printer)
Michael Albinus <michael.albinus@gmx.de>
parents:
91332
diff
changeset
|
258 (eval-and-compile |
64def2c58ad1
* ps-samp.el (ps-add-printer, ps-remove-printer)
Michael Albinus <michael.albinus@gmx.de>
parents:
91332
diff
changeset
|
259 (require 'printing) |
64def2c58ad1
* ps-samp.el (ps-add-printer, ps-remove-printer)
Michael Albinus <michael.albinus@gmx.de>
parents:
91332
diff
changeset
|
260 (require 'zeroconf)) |
64def2c58ad1
* ps-samp.el (ps-add-printer, ps-remove-printer)
Michael Albinus <michael.albinus@gmx.de>
parents:
91332
diff
changeset
|
261 |
64def2c58ad1
* ps-samp.el (ps-add-printer, ps-remove-printer)
Michael Albinus <michael.albinus@gmx.de>
parents:
91332
diff
changeset
|
262 ;; 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
|
263 (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
|
264 (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
|
265 (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
|
266 (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
|
267 (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
|
268 is-ps cups-queue) |
64def2c58ad1
* ps-samp.el (ps-add-printer, ps-remove-printer)
Michael Albinus <michael.albinus@gmx.de>
parents:
91332
diff
changeset
|
269 ;; `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
|
270 (dolist (string text) |
64def2c58ad1
* ps-samp.el (ps-add-printer, ps-remove-printer)
Michael Albinus <michael.albinus@gmx.de>
parents:
91332
diff
changeset
|
271 (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
|
272 ;; 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
|
273 ;; "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
|
274 (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
|
275 (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
|
276 (setq is-ps t)) |
64def2c58ad1
* ps-samp.el (ps-add-printer, ps-remove-printer)
Michael Albinus <michael.albinus@gmx.de>
parents:
91332
diff
changeset
|
277 ;; 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
|
278 (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
|
279 (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
|
280 (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
|
281 ;; Add the printer. |
64def2c58ad1
* ps-samp.el (ps-add-printer, ps-remove-printer)
Michael Albinus <michael.albinus@gmx.de>
parents:
91332
diff
changeset
|
282 (when is-ps |
64def2c58ad1
* ps-samp.el (ps-add-printer, ps-remove-printer)
Michael Albinus <michael.albinus@gmx.de>
parents:
91332
diff
changeset
|
283 (if cups-queue |
64def2c58ad1
* ps-samp.el (ps-add-printer, ps-remove-printer)
Michael Albinus <michael.albinus@gmx.de>
parents:
91332
diff
changeset
|
284 (add-to-list |
64def2c58ad1
* ps-samp.el (ps-add-printer, ps-remove-printer)
Michael Albinus <michael.albinus@gmx.de>
parents:
91332
diff
changeset
|
285 '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
|
286 ;; 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
|
287 (add-to-list |
64def2c58ad1
* ps-samp.el (ps-add-printer, ps-remove-printer)
Michael Albinus <michael.albinus@gmx.de>
parents:
91332
diff
changeset
|
288 '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
|
289 '("-P" "default") |
64def2c58ad1
* ps-samp.el (ps-add-printer, ps-remove-printer)
Michael Albinus <michael.albinus@gmx.de>
parents:
91332
diff
changeset
|
290 "-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
|
291 (pr-update-menus t)))) |
64def2c58ad1
* ps-samp.el (ps-add-printer, ps-remove-printer)
Michael Albinus <michael.albinus@gmx.de>
parents:
91332
diff
changeset
|
292 |
64def2c58ad1
* ps-samp.el (ps-add-printer, ps-remove-printer)
Michael Albinus <michael.albinus@gmx.de>
parents:
91332
diff
changeset
|
293 ;; 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
|
294 (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
|
295 (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
|
296 (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
|
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-ps-printer-alist)) |
64def2c58ad1
* ps-samp.el (ps-add-printer, ps-remove-printer)
Michael Albinus <michael.albinus@gmx.de>
parents:
91332
diff
changeset
|
299 (pr-update-menus t)) |
64def2c58ad1
* ps-samp.el (ps-add-printer, ps-remove-printer)
Michael Albinus <michael.albinus@gmx.de>
parents:
91332
diff
changeset
|
300 |
64def2c58ad1
* ps-samp.el (ps-add-printer, ps-remove-printer)
Michael Albinus <michael.albinus@gmx.de>
parents:
91332
diff
changeset
|
301 ;; 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
|
302 (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
|
303 (when (featurep 'dbusbind) |
64def2c58ad1
* ps-samp.el (ps-add-printer, ps-remove-printer)
Michael Albinus <michael.albinus@gmx.de>
parents:
91332
diff
changeset
|
304 (zeroconf-init) |
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" :new 'ps-add-printer) |
64def2c58ad1
* ps-samp.el (ps-add-printer, ps-remove-printer)
Michael Albinus <michael.albinus@gmx.de>
parents:
91332
diff
changeset
|
306 (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
|
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 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; |
64def2c58ad1
* ps-samp.el (ps-add-printer, ps-remove-printer)
Michael Albinus <michael.albinus@gmx.de>
parents:
91332
diff
changeset
|
310 |
90736
ef1369583937
Split XEmacs/Emacs definitions and sample setup code into separate files
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
diff
changeset
|
311 (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
|
312 |
90738
a77c806ee80a
Changes from arch/CVS synchronization
Miles Bader <miles@gnu.org>
parents:
90736
diff
changeset
|
313 ;; 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
|
314 ;;; ps-samp.el ends here |