Mercurial > emacs
annotate lisp/lpr.el @ 112428:5653bdbb0b32
* vc/diff.el (diff-sentinel): Doc fix (Bug#7682).
author | Chong Yidong <cyd@stupidchicken.com> |
---|---|
date | Sat, 22 Jan 2011 15:15:24 -0500 |
parents | ef719132ddfa |
children |
rev | line source |
---|---|
38412
253f761ad37b
Some fixes to follow coding conventions in files maintained by FSF.
Pavel Janík <Pavel@Janik.cz>
parents:
36420
diff
changeset
|
1 ;;; lpr.el --- print Emacs buffer on line printer |
659
505130d1ddf8
*** empty log message ***
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
617
diff
changeset
|
2 |
64762
41bb365f41c4
Update years in copyright notice; nfc.
Thien-Thi Nguyen <ttn@gnuvola.org>
parents:
64091
diff
changeset
|
3 ;; Copyright (C) 1985, 1988, 1992, 1994, 2001, 2002, 2003, |
112218
376148b31b5e
Add 2011 to FSF/AIST copyright years.
Glenn Morris <rgm@gnu.org>
parents:
111748
diff
changeset
|
4 ;; 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011 Free Software Foundation, Inc. |
846
20674ae6bf52
*** empty log message ***
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
811
diff
changeset
|
5 |
38412
253f761ad37b
Some fixes to follow coding conventions in files maintained by FSF.
Pavel Janík <Pavel@Janik.cz>
parents:
36420
diff
changeset
|
6 ;; Maintainer: FSF |
253f761ad37b
Some fixes to follow coding conventions in files maintained by FSF.
Pavel Janík <Pavel@Janik.cz>
parents:
36420
diff
changeset
|
7 ;; Keywords: unix |
807
4f28bd14272c
*** empty log message ***
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
659
diff
changeset
|
8 |
155 | 9 ;; This file is part of GNU Emacs. |
10 | |
94678
ee5932bf781d
Switch to recommended form of GPLv3 permissions notice.
Glenn Morris <rgm@gnu.org>
parents:
93975
diff
changeset
|
11 ;; GNU Emacs is free software: you can redistribute it and/or modify |
155 | 12 ;; it under the terms of the GNU General Public License as published by |
94678
ee5932bf781d
Switch to recommended form of GPLv3 permissions notice.
Glenn Morris <rgm@gnu.org>
parents:
93975
diff
changeset
|
13 ;; 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:
93975
diff
changeset
|
14 ;; (at your option) any later version. |
155 | 15 |
16 ;; GNU Emacs is distributed in the hope that it will be useful, | |
17 ;; but WITHOUT ANY WARRANTY; without even the implied warranty of | |
18 ;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |
19 ;; GNU General Public License for more details. | |
20 | |
21 ;; You should have received a copy of the GNU General Public License | |
94678
ee5932bf781d
Switch to recommended form of GPLv3 permissions notice.
Glenn Morris <rgm@gnu.org>
parents:
93975
diff
changeset
|
22 ;; along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>. |
155 | 23 |
2307
10e417efb12a
Added or corrected Commentary sections
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
1671
diff
changeset
|
24 ;;; Commentary: |
10e417efb12a
Added or corrected Commentary sections
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
1671
diff
changeset
|
25 |
35743
4db4ab2d1dd4
(lpr-windows-system, lpr-lp-system): Add autoload cookies.
Gerd Moellmann <gerd@gnu.org>
parents:
35724
diff
changeset
|
26 ;; Commands to send the region or a buffer to your printer. Entry points |
45461 | 27 ;; are `lpr-buffer', `print-buffer', `lpr-region', or `print-region'; option |
22679
08902da4c832
(printer-name): New variable.
Richard M. Stallman <rms@gnu.org>
parents:
21569
diff
changeset
|
28 ;; variables include `printer-name', `lpr-switches' and `lpr-command'. |
2307
10e417efb12a
Added or corrected Commentary sections
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
1671
diff
changeset
|
29 |
807
4f28bd14272c
*** empty log message ***
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
659
diff
changeset
|
30 ;;; Code: |
155 | 31 |
35743
4db4ab2d1dd4
(lpr-windows-system, lpr-lp-system): Add autoload cookies.
Gerd Moellmann <gerd@gnu.org>
parents:
35724
diff
changeset
|
32 ;;;###autoload |
35724
f2e26e453776
XEmacs compatibility and doc fixes from Vinicius Jose Latorre
Eli Zaretskii <eliz@gnu.org>
parents:
30101
diff
changeset
|
33 (defvar lpr-windows-system |
104552
10c38084881d
Remove code for defunct system-types emx, macos, mswindows,
Glenn Morris <rgm@gnu.org>
parents:
100908
diff
changeset
|
34 (memq system-type '(ms-dos windows-nt))) |
35724
f2e26e453776
XEmacs compatibility and doc fixes from Vinicius Jose Latorre
Eli Zaretskii <eliz@gnu.org>
parents:
30101
diff
changeset
|
35 |
35743
4db4ab2d1dd4
(lpr-windows-system, lpr-lp-system): Add autoload cookies.
Gerd Moellmann <gerd@gnu.org>
parents:
35724
diff
changeset
|
36 ;;;###autoload |
35724
f2e26e453776
XEmacs compatibility and doc fixes from Vinicius Jose Latorre
Eli Zaretskii <eliz@gnu.org>
parents:
30101
diff
changeset
|
37 (defvar lpr-lp-system |
87595
4c6c79916238
* configure.in: Remove references to unsupported systems.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
78236
diff
changeset
|
38 (memq system-type '(usg-unix-v hpux irix))) |
35724
f2e26e453776
XEmacs compatibility and doc fixes from Vinicius Jose Latorre
Eli Zaretskii <eliz@gnu.org>
parents:
30101
diff
changeset
|
39 |
f2e26e453776
XEmacs compatibility and doc fixes from Vinicius Jose Latorre
Eli Zaretskii <eliz@gnu.org>
parents:
30101
diff
changeset
|
40 |
17414
f967f12c8ec8
Add defgroup's; use defcustom for user vars.
Richard M. Stallman <rms@gnu.org>
parents:
14188
diff
changeset
|
41 (defgroup lpr nil |
64015
d2af21b7c1a4
(lpr): Finish `defgroup' description with period.
Juanma Barranquero <lekktu@gmail.com>
parents:
52401
diff
changeset
|
42 "Print Emacs buffer on line printer." |
17414
f967f12c8ec8
Add defgroup's; use defcustom for user vars.
Richard M. Stallman <rms@gnu.org>
parents:
14188
diff
changeset
|
43 :group 'wp) |
f967f12c8ec8
Add defgroup's; use defcustom for user vars.
Richard M. Stallman <rms@gnu.org>
parents:
14188
diff
changeset
|
44 |
35724
f2e26e453776
XEmacs compatibility and doc fixes from Vinicius Jose Latorre
Eli Zaretskii <eliz@gnu.org>
parents:
30101
diff
changeset
|
45 |
22679
08902da4c832
(printer-name): New variable.
Richard M. Stallman <rms@gnu.org>
parents:
21569
diff
changeset
|
46 ;;;###autoload |
08902da4c832
(printer-name): New variable.
Richard M. Stallman <rms@gnu.org>
parents:
21569
diff
changeset
|
47 (defcustom printer-name |
104552
10c38084881d
Remove code for defunct system-types emx, macos, mswindows,
Glenn Morris <rgm@gnu.org>
parents:
100908
diff
changeset
|
48 (and (eq system-type 'ms-dos) "PRN") |
100171 | 49 "The name of a local printer to which data is sent for printing. |
22679
08902da4c832
(printer-name): New variable.
Richard M. Stallman <rms@gnu.org>
parents:
21569
diff
changeset
|
50 \(Note that PostScript files are sent to `ps-printer-name', which see.\) |
08902da4c832
(printer-name): New variable.
Richard M. Stallman <rms@gnu.org>
parents:
21569
diff
changeset
|
51 |
08902da4c832
(printer-name): New variable.
Richard M. Stallman <rms@gnu.org>
parents:
21569
diff
changeset
|
52 On Unix-like systems, a string value should be a name understood by |
24091
1874c3236349
(printer-name): Update docstring about usage on MS-DOS
Andrew Innes <andrewi@gnu.org>
parents:
23264
diff
changeset
|
53 lpr's -P option; otherwise the value should be nil. |
22679
08902da4c832
(printer-name): New variable.
Richard M. Stallman <rms@gnu.org>
parents:
21569
diff
changeset
|
54 |
24091
1874c3236349
(printer-name): Update docstring about usage on MS-DOS
Andrew Innes <andrewi@gnu.org>
parents:
23264
diff
changeset
|
55 On MS-DOS and MS-Windows systems, a string value is taken as the name of |
1874c3236349
(printer-name): Update docstring about usage on MS-DOS
Andrew Innes <andrewi@gnu.org>
parents:
23264
diff
changeset
|
56 a printer device or port, provided `lpr-command' is set to \"\". |
1874c3236349
(printer-name): Update docstring about usage on MS-DOS
Andrew Innes <andrewi@gnu.org>
parents:
23264
diff
changeset
|
57 Typical non-default settings would be \"LPT1\" to \"LPT3\" for parallel |
1874c3236349
(printer-name): Update docstring about usage on MS-DOS
Andrew Innes <andrewi@gnu.org>
parents:
23264
diff
changeset
|
58 printers, or \"COM1\" to \"COM4\" or \"AUX\" for serial printers, or |
1874c3236349
(printer-name): Update docstring about usage on MS-DOS
Andrew Innes <andrewi@gnu.org>
parents:
23264
diff
changeset
|
59 \"//hostname/printer\" for a shared network printer. You can also set |
1874c3236349
(printer-name): Update docstring about usage on MS-DOS
Andrew Innes <andrewi@gnu.org>
parents:
23264
diff
changeset
|
60 it to the name of a file, in which case the output gets appended to that |
1874c3236349
(printer-name): Update docstring about usage on MS-DOS
Andrew Innes <andrewi@gnu.org>
parents:
23264
diff
changeset
|
61 file. If you want to discard the printed output, set this to \"NUL\"." |
35724
f2e26e453776
XEmacs compatibility and doc fixes from Vinicius Jose Latorre
Eli Zaretskii <eliz@gnu.org>
parents:
30101
diff
changeset
|
62 :type '(choice :menu-tag "Printer Name" |
f2e26e453776
XEmacs compatibility and doc fixes from Vinicius Jose Latorre
Eli Zaretskii <eliz@gnu.org>
parents:
30101
diff
changeset
|
63 :tag "Printer Name" |
f2e26e453776
XEmacs compatibility and doc fixes from Vinicius Jose Latorre
Eli Zaretskii <eliz@gnu.org>
parents:
30101
diff
changeset
|
64 (const :tag "Default" nil) |
f2e26e453776
XEmacs compatibility and doc fixes from Vinicius Jose Latorre
Eli Zaretskii <eliz@gnu.org>
parents:
30101
diff
changeset
|
65 ;; could use string but then we lose completion for files. |
f2e26e453776
XEmacs compatibility and doc fixes from Vinicius Jose Latorre
Eli Zaretskii <eliz@gnu.org>
parents:
30101
diff
changeset
|
66 (file :tag "Name")) |
22679
08902da4c832
(printer-name): New variable.
Richard M. Stallman <rms@gnu.org>
parents:
21569
diff
changeset
|
67 :group 'lpr) |
17414
f967f12c8ec8
Add defgroup's; use defcustom for user vars.
Richard M. Stallman <rms@gnu.org>
parents:
14188
diff
changeset
|
68 |
269 | 69 ;;;###autoload |
35724
f2e26e453776
XEmacs compatibility and doc fixes from Vinicius Jose Latorre
Eli Zaretskii <eliz@gnu.org>
parents:
30101
diff
changeset
|
70 (defcustom lpr-switches nil |
100171 | 71 "List of strings to pass as extra options for the printer program. |
22679
08902da4c832
(printer-name): New variable.
Richard M. Stallman <rms@gnu.org>
parents:
21569
diff
changeset
|
72 It is recommended to set `printer-name' instead of including an explicit |
08902da4c832
(printer-name): New variable.
Richard M. Stallman <rms@gnu.org>
parents:
21569
diff
changeset
|
73 switch on this list. |
17414
f967f12c8ec8
Add defgroup's; use defcustom for user vars.
Richard M. Stallman <rms@gnu.org>
parents:
14188
diff
changeset
|
74 See `lpr-command'." |
f967f12c8ec8
Add defgroup's; use defcustom for user vars.
Richard M. Stallman <rms@gnu.org>
parents:
14188
diff
changeset
|
75 :type '(repeat (string :tag "Argument")) |
f967f12c8ec8
Add defgroup's; use defcustom for user vars.
Richard M. Stallman <rms@gnu.org>
parents:
14188
diff
changeset
|
76 :group 'lpr) |
5267
f7ea27a729b8
(lpr-headers-switches): Treat hpux like usg-unix-v.
Richard M. Stallman <rms@gnu.org>
parents:
5004
diff
changeset
|
77 |
36420
213d5ac23246
(lpr-add-switches): Default to t on gnu/linux.
Richard M. Stallman <rms@gnu.org>
parents:
36419
diff
changeset
|
78 (defcustom lpr-add-switches (memq system-type '(berkeley-unix gnu/linux)) |
100171 | 79 "Non-nil means construct `-T' and `-J' options for the printer program. |
13803
e0bae9f528fe
(lpr-switches, lpr-add-switches): Doc fixes.
Karl Heuer <kwzh@gnu.org>
parents:
11831
diff
changeset
|
80 These are made assuming that the program is `lpr'; |
e0bae9f528fe
(lpr-switches, lpr-add-switches): Doc fixes.
Karl Heuer <kwzh@gnu.org>
parents:
11831
diff
changeset
|
81 if you are using some other incompatible printer program, |
17414
f967f12c8ec8
Add defgroup's; use defcustom for user vars.
Richard M. Stallman <rms@gnu.org>
parents:
14188
diff
changeset
|
82 this variable should be nil." |
f967f12c8ec8
Add defgroup's; use defcustom for user vars.
Richard M. Stallman <rms@gnu.org>
parents:
14188
diff
changeset
|
83 :type 'boolean |
f967f12c8ec8
Add defgroup's; use defcustom for user vars.
Richard M. Stallman <rms@gnu.org>
parents:
14188
diff
changeset
|
84 :group 'lpr) |
155 | 85 |
35724
f2e26e453776
XEmacs compatibility and doc fixes from Vinicius Jose Latorre
Eli Zaretskii <eliz@gnu.org>
parents:
30101
diff
changeset
|
86 (defcustom lpr-printer-switch |
f2e26e453776
XEmacs compatibility and doc fixes from Vinicius Jose Latorre
Eli Zaretskii <eliz@gnu.org>
parents:
30101
diff
changeset
|
87 (if lpr-lp-system |
f2e26e453776
XEmacs compatibility and doc fixes from Vinicius Jose Latorre
Eli Zaretskii <eliz@gnu.org>
parents:
30101
diff
changeset
|
88 "-d " |
f2e26e453776
XEmacs compatibility and doc fixes from Vinicius Jose Latorre
Eli Zaretskii <eliz@gnu.org>
parents:
30101
diff
changeset
|
89 "-P") |
100171 | 90 "Printer switch, that is, something like \"-P\", \"-d \", \"/D:\", etc. |
35724
f2e26e453776
XEmacs compatibility and doc fixes from Vinicius Jose Latorre
Eli Zaretskii <eliz@gnu.org>
parents:
30101
diff
changeset
|
91 This switch is used in conjunction with `printer-name'." |
f2e26e453776
XEmacs compatibility and doc fixes from Vinicius Jose Latorre
Eli Zaretskii <eliz@gnu.org>
parents:
30101
diff
changeset
|
92 :type '(choice :menu-tag "Printer Name Switch" |
f2e26e453776
XEmacs compatibility and doc fixes from Vinicius Jose Latorre
Eli Zaretskii <eliz@gnu.org>
parents:
30101
diff
changeset
|
93 :tag "Printer Name Switch" |
f2e26e453776
XEmacs compatibility and doc fixes from Vinicius Jose Latorre
Eli Zaretskii <eliz@gnu.org>
parents:
30101
diff
changeset
|
94 (const :tag "None" nil) |
f2e26e453776
XEmacs compatibility and doc fixes from Vinicius Jose Latorre
Eli Zaretskii <eliz@gnu.org>
parents:
30101
diff
changeset
|
95 (string :tag "Printer Switch")) |
f2e26e453776
XEmacs compatibility and doc fixes from Vinicius Jose Latorre
Eli Zaretskii <eliz@gnu.org>
parents:
30101
diff
changeset
|
96 :group 'lpr) |
f2e26e453776
XEmacs compatibility and doc fixes from Vinicius Jose Latorre
Eli Zaretskii <eliz@gnu.org>
parents:
30101
diff
changeset
|
97 |
1068 | 98 ;;;###autoload |
17414
f967f12c8ec8
Add defgroup's; use defcustom for user vars.
Richard M. Stallman <rms@gnu.org>
parents:
14188
diff
changeset
|
99 (defcustom lpr-command |
105939
a0f778f4a995
* term/x-win.el (x-gtk-stock-map):
Dan Nicolaescu <dann@ics.uci.edu>
parents:
104552
diff
changeset
|
100 (purecopy |
24091
1874c3236349
(printer-name): Update docstring about usage on MS-DOS
Andrew Innes <andrewi@gnu.org>
parents:
23264
diff
changeset
|
101 (cond |
35724
f2e26e453776
XEmacs compatibility and doc fixes from Vinicius Jose Latorre
Eli Zaretskii <eliz@gnu.org>
parents:
30101
diff
changeset
|
102 (lpr-windows-system |
24091
1874c3236349
(printer-name): Update docstring about usage on MS-DOS
Andrew Innes <andrewi@gnu.org>
parents:
23264
diff
changeset
|
103 "") |
35724
f2e26e453776
XEmacs compatibility and doc fixes from Vinicius Jose Latorre
Eli Zaretskii <eliz@gnu.org>
parents:
30101
diff
changeset
|
104 (lpr-lp-system |
24091
1874c3236349
(printer-name): Update docstring about usage on MS-DOS
Andrew Innes <andrewi@gnu.org>
parents:
23264
diff
changeset
|
105 "lp") |
1874c3236349
(printer-name): Update docstring about usage on MS-DOS
Andrew Innes <andrewi@gnu.org>
parents:
23264
diff
changeset
|
106 (t |
105939
a0f778f4a995
* term/x-win.el (x-gtk-stock-map):
Dan Nicolaescu <dann@ics.uci.edu>
parents:
104552
diff
changeset
|
107 "lpr"))) |
100171 | 108 "Name of program for printing a file. |
24091
1874c3236349
(printer-name): Update docstring about usage on MS-DOS
Andrew Innes <andrewi@gnu.org>
parents:
23264
diff
changeset
|
109 |
1874c3236349
(printer-name): Update docstring about usage on MS-DOS
Andrew Innes <andrewi@gnu.org>
parents:
23264
diff
changeset
|
110 On MS-DOS and MS-Windows systems, if the value is an empty string then |
1874c3236349
(printer-name): Update docstring about usage on MS-DOS
Andrew Innes <andrewi@gnu.org>
parents:
23264
diff
changeset
|
111 Emacs will write directly to the printer port named by `printer-name'. |
1874c3236349
(printer-name): Update docstring about usage on MS-DOS
Andrew Innes <andrewi@gnu.org>
parents:
23264
diff
changeset
|
112 The programs `print' and `nprint' (the standard print programs on |
1874c3236349
(printer-name): Update docstring about usage on MS-DOS
Andrew Innes <andrewi@gnu.org>
parents:
23264
diff
changeset
|
113 Windows NT and Novell Netware respectively) are handled specially, using |
1874c3236349
(printer-name): Update docstring about usage on MS-DOS
Andrew Innes <andrewi@gnu.org>
parents:
23264
diff
changeset
|
114 `printer-name' as the destination for output; any other program is |
1874c3236349
(printer-name): Update docstring about usage on MS-DOS
Andrew Innes <andrewi@gnu.org>
parents:
23264
diff
changeset
|
115 treated like `lpr' except that an explicit filename is given as the last |
1874c3236349
(printer-name): Update docstring about usage on MS-DOS
Andrew Innes <andrewi@gnu.org>
parents:
23264
diff
changeset
|
116 argument." |
17414
f967f12c8ec8
Add defgroup's; use defcustom for user vars.
Richard M. Stallman <rms@gnu.org>
parents:
14188
diff
changeset
|
117 :type 'string |
f967f12c8ec8
Add defgroup's; use defcustom for user vars.
Richard M. Stallman <rms@gnu.org>
parents:
14188
diff
changeset
|
118 :group 'lpr) |
155 | 119 |
10637
6e25c10f6fe8
(lpr-headers-switches): Default is nil.
Richard M. Stallman <rms@gnu.org>
parents:
10054
diff
changeset
|
120 ;; Default is nil, because that enables us to use pr -f |
6e25c10f6fe8
(lpr-headers-switches): Default is nil.
Richard M. Stallman <rms@gnu.org>
parents:
10054
diff
changeset
|
121 ;; which is more reliable than pr with no args, which is what lpr -p does. |
17414
f967f12c8ec8
Add defgroup's; use defcustom for user vars.
Richard M. Stallman <rms@gnu.org>
parents:
14188
diff
changeset
|
122 (defcustom lpr-headers-switches nil |
100171 | 123 "List of strings of options to request page headings in the printer program. |
10637
6e25c10f6fe8
(lpr-headers-switches): Default is nil.
Richard M. Stallman <rms@gnu.org>
parents:
10054
diff
changeset
|
124 If nil, we run `lpr-page-header-program' to make page headings |
17414
f967f12c8ec8
Add defgroup's; use defcustom for user vars.
Richard M. Stallman <rms@gnu.org>
parents:
14188
diff
changeset
|
125 and print the result." |
f967f12c8ec8
Add defgroup's; use defcustom for user vars.
Richard M. Stallman <rms@gnu.org>
parents:
14188
diff
changeset
|
126 :type '(repeat (string :tag "Argument")) |
f967f12c8ec8
Add defgroup's; use defcustom for user vars.
Richard M. Stallman <rms@gnu.org>
parents:
14188
diff
changeset
|
127 :group 'lpr) |
5267
f7ea27a729b8
(lpr-headers-switches): Treat hpux like usg-unix-v.
Richard M. Stallman <rms@gnu.org>
parents:
5004
diff
changeset
|
128 |
17414
f967f12c8ec8
Add defgroup's; use defcustom for user vars.
Richard M. Stallman <rms@gnu.org>
parents:
14188
diff
changeset
|
129 (defcustom print-region-function nil |
155 | 130 "Function to call to print the region on a printer. |
17414
f967f12c8ec8
Add defgroup's; use defcustom for user vars.
Richard M. Stallman <rms@gnu.org>
parents:
14188
diff
changeset
|
131 See definition of `print-region-1' for calling conventions." |
35969
db288677db54
(print-region-function): Fix :type.
Dave Love <fx@gnu.org>
parents:
35743
diff
changeset
|
132 :type '(choice (const nil) function) |
17414
f967f12c8ec8
Add defgroup's; use defcustom for user vars.
Richard M. Stallman <rms@gnu.org>
parents:
14188
diff
changeset
|
133 :group 'lpr) |
155 | 134 |
17414
f967f12c8ec8
Add defgroup's; use defcustom for user vars.
Richard M. Stallman <rms@gnu.org>
parents:
14188
diff
changeset
|
135 (defcustom lpr-page-header-program "pr" |
100171 | 136 "Name of program for adding page headers to a file." |
17414
f967f12c8ec8
Add defgroup's; use defcustom for user vars.
Richard M. Stallman <rms@gnu.org>
parents:
14188
diff
changeset
|
137 :type 'string |
f967f12c8ec8
Add defgroup's; use defcustom for user vars.
Richard M. Stallman <rms@gnu.org>
parents:
14188
diff
changeset
|
138 :group 'lpr) |
9187
8cf9181c119e
(print-region-1): Use them instead of just pr.
Richard M. Stallman <rms@gnu.org>
parents:
8598
diff
changeset
|
139 |
17813
2e13bced7aff
(lpr-page-header-switches): Use -F, not -f.
Richard M. Stallman <rms@gnu.org>
parents:
17695
diff
changeset
|
140 ;; Berkeley systems support -F, and GNU pr supports both -f and -F, |
2e13bced7aff
(lpr-page-header-switches): Use -F, not -f.
Richard M. Stallman <rms@gnu.org>
parents:
17695
diff
changeset
|
141 ;; So it looks like -F is a better default. |
78021
e12f9e8fde4d
(lpr-page-header-switches): Move %s to separate element for correct
Glenn Morris <rgm@gnu.org>
parents:
75347
diff
changeset
|
142 (defcustom lpr-page-header-switches '("-h" "%s" "-F") |
100171 | 143 "List of strings to use as options for the page-header-generating program. |
78021
e12f9e8fde4d
(lpr-page-header-switches): Move %s to separate element for correct
Glenn Morris <rgm@gnu.org>
parents:
75347
diff
changeset
|
144 If `%s' appears in any of the strings, it is substituted by the page title. |
e12f9e8fde4d
(lpr-page-header-switches): Move %s to separate element for correct
Glenn Morris <rgm@gnu.org>
parents:
75347
diff
changeset
|
145 Note that for correct quoting, `%s' should normally be a separate element. |
17414
f967f12c8ec8
Add defgroup's; use defcustom for user vars.
Richard M. Stallman <rms@gnu.org>
parents:
14188
diff
changeset
|
146 The variable `lpr-page-header-program' specifies the program to use." |
f967f12c8ec8
Add defgroup's; use defcustom for user vars.
Richard M. Stallman <rms@gnu.org>
parents:
14188
diff
changeset
|
147 :type '(repeat string) |
f967f12c8ec8
Add defgroup's; use defcustom for user vars.
Richard M. Stallman <rms@gnu.org>
parents:
14188
diff
changeset
|
148 :group 'lpr) |
9187
8cf9181c119e
(print-region-1): Use them instead of just pr.
Richard M. Stallman <rms@gnu.org>
parents:
8598
diff
changeset
|
149 |
256 | 150 ;;;###autoload |
155 | 151 (defun lpr-buffer () |
27007
2d337fafb392
(lpr-buffer, print-buffer, lpr-region, print-region): Doc fixes.
Richard M. Stallman <rms@gnu.org>
parents:
26219
diff
changeset
|
152 "Print buffer contents without pagination or page headers. |
2d337fafb392
(lpr-buffer, print-buffer, lpr-region, print-region): Doc fixes.
Richard M. Stallman <rms@gnu.org>
parents:
26219
diff
changeset
|
153 See the variables `lpr-switches' and `lpr-command' |
2d337fafb392
(lpr-buffer, print-buffer, lpr-region, print-region): Doc fixes.
Richard M. Stallman <rms@gnu.org>
parents:
26219
diff
changeset
|
154 for customization of the printer command." |
111748
acd0ffe11c18
Prompt before running print commands.
Chong Yidong <cyd@stupidchicken.com>
parents:
106815
diff
changeset
|
155 (interactive |
acd0ffe11c18
Prompt before running print commands.
Chong Yidong <cyd@stupidchicken.com>
parents:
106815
diff
changeset
|
156 (unless (y-or-n-p "Send current buffer to default printer? ") |
acd0ffe11c18
Prompt before running print commands.
Chong Yidong <cyd@stupidchicken.com>
parents:
106815
diff
changeset
|
157 (error "Cancelled"))) |
155 | 158 (print-region-1 (point-min) (point-max) lpr-switches nil)) |
159 | |
256 | 160 ;;;###autoload |
155 | 161 (defun print-buffer () |
26219
af8d23cd7220
(print-buffer): Doc-string fix.
Gerd Moellmann <gerd@gnu.org>
parents:
24091
diff
changeset
|
162 "Paginate and print buffer contents. |
27007
2d337fafb392
(lpr-buffer, print-buffer, lpr-region, print-region): Doc fixes.
Richard M. Stallman <rms@gnu.org>
parents:
26219
diff
changeset
|
163 |
2d337fafb392
(lpr-buffer, print-buffer, lpr-region, print-region): Doc fixes.
Richard M. Stallman <rms@gnu.org>
parents:
26219
diff
changeset
|
164 The variable `lpr-headers-switches' controls how to paginate. |
2d337fafb392
(lpr-buffer, print-buffer, lpr-region, print-region): Doc fixes.
Richard M. Stallman <rms@gnu.org>
parents:
26219
diff
changeset
|
165 If it is nil (the default), we run the `pr' program (or whatever program |
2d337fafb392
(lpr-buffer, print-buffer, lpr-region, print-region): Doc fixes.
Richard M. Stallman <rms@gnu.org>
parents:
26219
diff
changeset
|
166 `lpr-page-header-program' specifies) to paginate. |
2d337fafb392
(lpr-buffer, print-buffer, lpr-region, print-region): Doc fixes.
Richard M. Stallman <rms@gnu.org>
parents:
26219
diff
changeset
|
167 `lpr-page-header-switches' specifies the switches for that program. |
26219
af8d23cd7220
(print-buffer): Doc-string fix.
Gerd Moellmann <gerd@gnu.org>
parents:
24091
diff
changeset
|
168 |
27007
2d337fafb392
(lpr-buffer, print-buffer, lpr-region, print-region): Doc fixes.
Richard M. Stallman <rms@gnu.org>
parents:
26219
diff
changeset
|
169 Otherwise, the switches in `lpr-headers-switches' are used |
2d337fafb392
(lpr-buffer, print-buffer, lpr-region, print-region): Doc fixes.
Richard M. Stallman <rms@gnu.org>
parents:
26219
diff
changeset
|
170 in the print command itself; we expect them to request pagination. |
49597
e88404e8f2cf
Trailing whitespace deleted.
Juanma Barranquero <lekktu@gmail.com>
parents:
45461
diff
changeset
|
171 |
27007
2d337fafb392
(lpr-buffer, print-buffer, lpr-region, print-region): Doc fixes.
Richard M. Stallman <rms@gnu.org>
parents:
26219
diff
changeset
|
172 See the variables `lpr-switches' and `lpr-command' |
2d337fafb392
(lpr-buffer, print-buffer, lpr-region, print-region): Doc fixes.
Richard M. Stallman <rms@gnu.org>
parents:
26219
diff
changeset
|
173 for further customization of the printer command." |
111748
acd0ffe11c18
Prompt before running print commands.
Chong Yidong <cyd@stupidchicken.com>
parents:
106815
diff
changeset
|
174 (interactive |
acd0ffe11c18
Prompt before running print commands.
Chong Yidong <cyd@stupidchicken.com>
parents:
106815
diff
changeset
|
175 (unless (y-or-n-p "Send current buffer to default printer? ") |
acd0ffe11c18
Prompt before running print commands.
Chong Yidong <cyd@stupidchicken.com>
parents:
106815
diff
changeset
|
176 (error "Cancelled"))) |
155 | 177 (print-region-1 (point-min) (point-max) lpr-switches t)) |
178 | |
256 | 179 ;;;###autoload |
155 | 180 (defun lpr-region (start end) |
27007
2d337fafb392
(lpr-buffer, print-buffer, lpr-region, print-region): Doc fixes.
Richard M. Stallman <rms@gnu.org>
parents:
26219
diff
changeset
|
181 "Print region contents without pagination or page headers. |
2d337fafb392
(lpr-buffer, print-buffer, lpr-region, print-region): Doc fixes.
Richard M. Stallman <rms@gnu.org>
parents:
26219
diff
changeset
|
182 See the variables `lpr-switches' and `lpr-command' |
2d337fafb392
(lpr-buffer, print-buffer, lpr-region, print-region): Doc fixes.
Richard M. Stallman <rms@gnu.org>
parents:
26219
diff
changeset
|
183 for customization of the printer command." |
111748
acd0ffe11c18
Prompt before running print commands.
Chong Yidong <cyd@stupidchicken.com>
parents:
106815
diff
changeset
|
184 (interactive |
acd0ffe11c18
Prompt before running print commands.
Chong Yidong <cyd@stupidchicken.com>
parents:
106815
diff
changeset
|
185 (if (y-or-n-p "Send selected text to default printer? ") |
acd0ffe11c18
Prompt before running print commands.
Chong Yidong <cyd@stupidchicken.com>
parents:
106815
diff
changeset
|
186 (list (region-beginning) (region-end)) |
acd0ffe11c18
Prompt before running print commands.
Chong Yidong <cyd@stupidchicken.com>
parents:
106815
diff
changeset
|
187 (error "Cancelled"))) |
155 | 188 (print-region-1 start end lpr-switches nil)) |
189 | |
256 | 190 ;;;###autoload |
155 | 191 (defun print-region (start end) |
27007
2d337fafb392
(lpr-buffer, print-buffer, lpr-region, print-region): Doc fixes.
Richard M. Stallman <rms@gnu.org>
parents:
26219
diff
changeset
|
192 "Paginate and print the region contents. |
2d337fafb392
(lpr-buffer, print-buffer, lpr-region, print-region): Doc fixes.
Richard M. Stallman <rms@gnu.org>
parents:
26219
diff
changeset
|
193 |
2d337fafb392
(lpr-buffer, print-buffer, lpr-region, print-region): Doc fixes.
Richard M. Stallman <rms@gnu.org>
parents:
26219
diff
changeset
|
194 The variable `lpr-headers-switches' controls how to paginate. |
2d337fafb392
(lpr-buffer, print-buffer, lpr-region, print-region): Doc fixes.
Richard M. Stallman <rms@gnu.org>
parents:
26219
diff
changeset
|
195 If it is nil (the default), we run the `pr' program (or whatever program |
2d337fafb392
(lpr-buffer, print-buffer, lpr-region, print-region): Doc fixes.
Richard M. Stallman <rms@gnu.org>
parents:
26219
diff
changeset
|
196 `lpr-page-header-program' specifies) to paginate. |
2d337fafb392
(lpr-buffer, print-buffer, lpr-region, print-region): Doc fixes.
Richard M. Stallman <rms@gnu.org>
parents:
26219
diff
changeset
|
197 `lpr-page-header-switches' specifies the switches for that program. |
2d337fafb392
(lpr-buffer, print-buffer, lpr-region, print-region): Doc fixes.
Richard M. Stallman <rms@gnu.org>
parents:
26219
diff
changeset
|
198 |
2d337fafb392
(lpr-buffer, print-buffer, lpr-region, print-region): Doc fixes.
Richard M. Stallman <rms@gnu.org>
parents:
26219
diff
changeset
|
199 Otherwise, the switches in `lpr-headers-switches' are used |
2d337fafb392
(lpr-buffer, print-buffer, lpr-region, print-region): Doc fixes.
Richard M. Stallman <rms@gnu.org>
parents:
26219
diff
changeset
|
200 in the print command itself; we expect them to request pagination. |
49597
e88404e8f2cf
Trailing whitespace deleted.
Juanma Barranquero <lekktu@gmail.com>
parents:
45461
diff
changeset
|
201 |
27007
2d337fafb392
(lpr-buffer, print-buffer, lpr-region, print-region): Doc fixes.
Richard M. Stallman <rms@gnu.org>
parents:
26219
diff
changeset
|
202 See the variables `lpr-switches' and `lpr-command' |
2d337fafb392
(lpr-buffer, print-buffer, lpr-region, print-region): Doc fixes.
Richard M. Stallman <rms@gnu.org>
parents:
26219
diff
changeset
|
203 for further customization of the printer command." |
111748
acd0ffe11c18
Prompt before running print commands.
Chong Yidong <cyd@stupidchicken.com>
parents:
106815
diff
changeset
|
204 (interactive |
acd0ffe11c18
Prompt before running print commands.
Chong Yidong <cyd@stupidchicken.com>
parents:
106815
diff
changeset
|
205 (if (y-or-n-p "Send selected text to default printer? ") |
acd0ffe11c18
Prompt before running print commands.
Chong Yidong <cyd@stupidchicken.com>
parents:
106815
diff
changeset
|
206 (list (region-beginning) (region-end)) |
acd0ffe11c18
Prompt before running print commands.
Chong Yidong <cyd@stupidchicken.com>
parents:
106815
diff
changeset
|
207 (error "Cancelled"))) |
155 | 208 (print-region-1 start end lpr-switches t)) |
209 | |
210 (defun print-region-1 (start end switches page-headers) | |
8113
6a12a2845ccc
(print-region-1): Essentially undo previous change.
Richard M. Stallman <rms@gnu.org>
parents:
8021
diff
changeset
|
211 ;; On some MIPS system, having a space in the job name |
6a12a2845ccc
(print-region-1): Essentially undo previous change.
Richard M. Stallman <rms@gnu.org>
parents:
8021
diff
changeset
|
212 ;; crashes the printer demon. But using dashes looks ugly |
6a12a2845ccc
(print-region-1): Essentially undo previous change.
Richard M. Stallman <rms@gnu.org>
parents:
8021
diff
changeset
|
213 ;; and it seems to annoying to do for that MIPS system. |
35724
f2e26e453776
XEmacs compatibility and doc fixes from Vinicius Jose Latorre
Eli Zaretskii <eliz@gnu.org>
parents:
30101
diff
changeset
|
214 (let ((name (concat (buffer-name) " Emacs buffer")) |
8020
23deb92071c6
(print-region-1): Don't include a space in the job name.
Richard M. Stallman <rms@gnu.org>
parents:
7300
diff
changeset
|
215 (title (concat (buffer-name) " Emacs buffer")) |
21569
c1f86e273a38
(print-region-1): Stop using binary-process-{in,out}put,
Eli Zaretskii <eliz@gnu.org>
parents:
20278
diff
changeset
|
216 ;; Make pipes use the same coding system as |
c1f86e273a38
(print-region-1): Stop using binary-process-{in,out}put,
Eli Zaretskii <eliz@gnu.org>
parents:
20278
diff
changeset
|
217 ;; writing the buffer to a file would. |
35724
f2e26e453776
XEmacs compatibility and doc fixes from Vinicius Jose Latorre
Eli Zaretskii <eliz@gnu.org>
parents:
30101
diff
changeset
|
218 (coding-system-for-write (or coding-system-for-write |
f2e26e453776
XEmacs compatibility and doc fixes from Vinicius Jose Latorre
Eli Zaretskii <eliz@gnu.org>
parents:
30101
diff
changeset
|
219 buffer-file-coding-system)) |
f2e26e453776
XEmacs compatibility and doc fixes from Vinicius Jose Latorre
Eli Zaretskii <eliz@gnu.org>
parents:
30101
diff
changeset
|
220 (coding-system-for-read (or coding-system-for-read |
f2e26e453776
XEmacs compatibility and doc fixes from Vinicius Jose Latorre
Eli Zaretskii <eliz@gnu.org>
parents:
30101
diff
changeset
|
221 buffer-file-coding-system)) |
10708
8a15461d4f64
(print-region-1): Include print options in echo area msgs.
Richard M. Stallman <rms@gnu.org>
parents:
10700
diff
changeset
|
222 (width tab-width) |
35724
f2e26e453776
XEmacs compatibility and doc fixes from Vinicius Jose Latorre
Eli Zaretskii <eliz@gnu.org>
parents:
30101
diff
changeset
|
223 nswitches |
10708
8a15461d4f64
(print-region-1): Include print options in echo area msgs.
Richard M. Stallman <rms@gnu.org>
parents:
10700
diff
changeset
|
224 switch-string) |
155 | 225 (save-excursion |
35724
f2e26e453776
XEmacs compatibility and doc fixes from Vinicius Jose Latorre
Eli Zaretskii <eliz@gnu.org>
parents:
30101
diff
changeset
|
226 (and page-headers lpr-headers-switches |
f2e26e453776
XEmacs compatibility and doc fixes from Vinicius Jose Latorre
Eli Zaretskii <eliz@gnu.org>
parents:
30101
diff
changeset
|
227 ;; It's possible to use an lpr option to get page headers. |
f2e26e453776
XEmacs compatibility and doc fixes from Vinicius Jose Latorre
Eli Zaretskii <eliz@gnu.org>
parents:
30101
diff
changeset
|
228 (setq switches (append (if (stringp lpr-headers-switches) |
f2e26e453776
XEmacs compatibility and doc fixes from Vinicius Jose Latorre
Eli Zaretskii <eliz@gnu.org>
parents:
30101
diff
changeset
|
229 (list lpr-headers-switches) |
f2e26e453776
XEmacs compatibility and doc fixes from Vinicius Jose Latorre
Eli Zaretskii <eliz@gnu.org>
parents:
30101
diff
changeset
|
230 lpr-headers-switches) |
f2e26e453776
XEmacs compatibility and doc fixes from Vinicius Jose Latorre
Eli Zaretskii <eliz@gnu.org>
parents:
30101
diff
changeset
|
231 switches))) |
f2e26e453776
XEmacs compatibility and doc fixes from Vinicius Jose Latorre
Eli Zaretskii <eliz@gnu.org>
parents:
30101
diff
changeset
|
232 (setq nswitches (lpr-flatten-list |
f2e26e453776
XEmacs compatibility and doc fixes from Vinicius Jose Latorre
Eli Zaretskii <eliz@gnu.org>
parents:
30101
diff
changeset
|
233 (mapcar 'lpr-eval-switch ; Dynamic evaluation |
f2e26e453776
XEmacs compatibility and doc fixes from Vinicius Jose Latorre
Eli Zaretskii <eliz@gnu.org>
parents:
30101
diff
changeset
|
234 switches)) |
f2e26e453776
XEmacs compatibility and doc fixes from Vinicius Jose Latorre
Eli Zaretskii <eliz@gnu.org>
parents:
30101
diff
changeset
|
235 switch-string (if switches |
f2e26e453776
XEmacs compatibility and doc fixes from Vinicius Jose Latorre
Eli Zaretskii <eliz@gnu.org>
parents:
30101
diff
changeset
|
236 (concat " with options " |
f2e26e453776
XEmacs compatibility and doc fixes from Vinicius Jose Latorre
Eli Zaretskii <eliz@gnu.org>
parents:
30101
diff
changeset
|
237 (mapconcat 'identity switches " ")) |
f2e26e453776
XEmacs compatibility and doc fixes from Vinicius Jose Latorre
Eli Zaretskii <eliz@gnu.org>
parents:
30101
diff
changeset
|
238 "")) |
10708
8a15461d4f64
(print-region-1): Include print options in echo area msgs.
Richard M. Stallman <rms@gnu.org>
parents:
10700
diff
changeset
|
239 (message "Spooling%s..." switch-string) |
155 | 240 (if (/= tab-width 8) |
10700
f6f235bc26ba
(print-region-new-buffer): Return new start and end.
Richard M. Stallman <rms@gnu.org>
parents:
10670
diff
changeset
|
241 (let ((new-coords (print-region-new-buffer start end))) |
35724
f2e26e453776
XEmacs compatibility and doc fixes from Vinicius Jose Latorre
Eli Zaretskii <eliz@gnu.org>
parents:
30101
diff
changeset
|
242 (setq start (car new-coords) |
f2e26e453776
XEmacs compatibility and doc fixes from Vinicius Jose Latorre
Eli Zaretskii <eliz@gnu.org>
parents:
30101
diff
changeset
|
243 end (cdr new-coords) |
f2e26e453776
XEmacs compatibility and doc fixes from Vinicius Jose Latorre
Eli Zaretskii <eliz@gnu.org>
parents:
30101
diff
changeset
|
244 tab-width width) |
4446
ff1f9d7addd9
(print-region-1): Make END a marker so untabify relocates it.
Richard M. Stallman <rms@gnu.org>
parents:
2382
diff
changeset
|
245 (save-excursion |
ff1f9d7addd9
(print-region-1): Make END a marker so untabify relocates it.
Richard M. Stallman <rms@gnu.org>
parents:
2382
diff
changeset
|
246 (goto-char end) |
ff1f9d7addd9
(print-region-1): Make END a marker so untabify relocates it.
Richard M. Stallman <rms@gnu.org>
parents:
2382
diff
changeset
|
247 (setq end (point-marker))) |
155 | 248 (untabify (point-min) (point-max)))) |
249 (if page-headers | |
5267
f7ea27a729b8
(lpr-headers-switches): Treat hpux like usg-unix-v.
Richard M. Stallman <rms@gnu.org>
parents:
5004
diff
changeset
|
250 (if lpr-headers-switches |
10708
8a15461d4f64
(print-region-1): Include print options in echo area msgs.
Richard M. Stallman <rms@gnu.org>
parents:
10700
diff
changeset
|
251 ;; We handled this above by modifying SWITCHES. |
8a15461d4f64
(print-region-1): Include print options in echo area msgs.
Richard M. Stallman <rms@gnu.org>
parents:
10700
diff
changeset
|
252 nil |
10637
6e25c10f6fe8
(lpr-headers-switches): Default is nil.
Richard M. Stallman <rms@gnu.org>
parents:
10054
diff
changeset
|
253 ;; Run a separate program to get page headers. |
10700
f6f235bc26ba
(print-region-new-buffer): Return new start and end.
Richard M. Stallman <rms@gnu.org>
parents:
10670
diff
changeset
|
254 (let ((new-coords (print-region-new-buffer start end))) |
35724
f2e26e453776
XEmacs compatibility and doc fixes from Vinicius Jose Latorre
Eli Zaretskii <eliz@gnu.org>
parents:
30101
diff
changeset
|
255 (apply 'call-process-region (car new-coords) (cdr new-coords) |
f2e26e453776
XEmacs compatibility and doc fixes from Vinicius Jose Latorre
Eli Zaretskii <eliz@gnu.org>
parents:
30101
diff
changeset
|
256 lpr-page-header-program t t nil |
72747
4dea9a34fd2e
(lpr-page-header-switches): Page title switch is one of them.
Eli Zaretskii <eliz@gnu.org>
parents:
68651
diff
changeset
|
257 (mapcar (lambda (e) (format e title)) |
4dea9a34fd2e
(lpr-page-header-switches): Page title switch is one of them.
Eli Zaretskii <eliz@gnu.org>
parents:
68651
diff
changeset
|
258 lpr-page-header-switches))) |
35724
f2e26e453776
XEmacs compatibility and doc fixes from Vinicius Jose Latorre
Eli Zaretskii <eliz@gnu.org>
parents:
30101
diff
changeset
|
259 (setq start (point-min) |
f2e26e453776
XEmacs compatibility and doc fixes from Vinicius Jose Latorre
Eli Zaretskii <eliz@gnu.org>
parents:
30101
diff
changeset
|
260 end (point-max)))) |
f2e26e453776
XEmacs compatibility and doc fixes from Vinicius Jose Latorre
Eli Zaretskii <eliz@gnu.org>
parents:
30101
diff
changeset
|
261 (apply (or print-region-function 'call-process-region) |
f2e26e453776
XEmacs compatibility and doc fixes from Vinicius Jose Latorre
Eli Zaretskii <eliz@gnu.org>
parents:
30101
diff
changeset
|
262 (nconc (list start end lpr-command |
f2e26e453776
XEmacs compatibility and doc fixes from Vinicius Jose Latorre
Eli Zaretskii <eliz@gnu.org>
parents:
30101
diff
changeset
|
263 nil nil nil) |
f2e26e453776
XEmacs compatibility and doc fixes from Vinicius Jose Latorre
Eli Zaretskii <eliz@gnu.org>
parents:
30101
diff
changeset
|
264 (and lpr-add-switches |
f2e26e453776
XEmacs compatibility and doc fixes from Vinicius Jose Latorre
Eli Zaretskii <eliz@gnu.org>
parents:
30101
diff
changeset
|
265 (list "-J" name)) |
f2e26e453776
XEmacs compatibility and doc fixes from Vinicius Jose Latorre
Eli Zaretskii <eliz@gnu.org>
parents:
30101
diff
changeset
|
266 ;; These belong in pr if we are using that. |
f2e26e453776
XEmacs compatibility and doc fixes from Vinicius Jose Latorre
Eli Zaretskii <eliz@gnu.org>
parents:
30101
diff
changeset
|
267 (and lpr-add-switches lpr-headers-switches |
f2e26e453776
XEmacs compatibility and doc fixes from Vinicius Jose Latorre
Eli Zaretskii <eliz@gnu.org>
parents:
30101
diff
changeset
|
268 (list "-T" title)) |
f2e26e453776
XEmacs compatibility and doc fixes from Vinicius Jose Latorre
Eli Zaretskii <eliz@gnu.org>
parents:
30101
diff
changeset
|
269 (and (stringp printer-name) |
f2e26e453776
XEmacs compatibility and doc fixes from Vinicius Jose Latorre
Eli Zaretskii <eliz@gnu.org>
parents:
30101
diff
changeset
|
270 (list (concat lpr-printer-switch |
f2e26e453776
XEmacs compatibility and doc fixes from Vinicius Jose Latorre
Eli Zaretskii <eliz@gnu.org>
parents:
30101
diff
changeset
|
271 printer-name))) |
f2e26e453776
XEmacs compatibility and doc fixes from Vinicius Jose Latorre
Eli Zaretskii <eliz@gnu.org>
parents:
30101
diff
changeset
|
272 nswitches)) |
4446
ff1f9d7addd9
(print-region-1): Make END a marker so untabify relocates it.
Richard M. Stallman <rms@gnu.org>
parents:
2382
diff
changeset
|
273 (if (markerp end) |
ff1f9d7addd9
(print-region-1): Make END a marker so untabify relocates it.
Richard M. Stallman <rms@gnu.org>
parents:
2382
diff
changeset
|
274 (set-marker end nil)) |
10708
8a15461d4f64
(print-region-1): Include print options in echo area msgs.
Richard M. Stallman <rms@gnu.org>
parents:
10700
diff
changeset
|
275 (message "Spooling%s...done" switch-string)))) |
155 | 276 |
277 ;; This function copies the text between start and end | |
10700
f6f235bc26ba
(print-region-new-buffer): Return new start and end.
Richard M. Stallman <rms@gnu.org>
parents:
10670
diff
changeset
|
278 ;; into a new buffer, makes that buffer current. |
f6f235bc26ba
(print-region-new-buffer): Return new start and end.
Richard M. Stallman <rms@gnu.org>
parents:
10670
diff
changeset
|
279 ;; It returns the new range to print from the new current buffer |
f6f235bc26ba
(print-region-new-buffer): Return new start and end.
Richard M. Stallman <rms@gnu.org>
parents:
10670
diff
changeset
|
280 ;; as (START . END). |
f6f235bc26ba
(print-region-new-buffer): Return new start and end.
Richard M. Stallman <rms@gnu.org>
parents:
10670
diff
changeset
|
281 |
5267
f7ea27a729b8
(lpr-headers-switches): Treat hpux like usg-unix-v.
Richard M. Stallman <rms@gnu.org>
parents:
5004
diff
changeset
|
282 (defun print-region-new-buffer (ostart oend) |
10700
f6f235bc26ba
(print-region-new-buffer): Return new start and end.
Richard M. Stallman <rms@gnu.org>
parents:
10670
diff
changeset
|
283 (if (string= (buffer-name) " *spool temp*") |
f6f235bc26ba
(print-region-new-buffer): Return new start and end.
Richard M. Stallman <rms@gnu.org>
parents:
10670
diff
changeset
|
284 (cons ostart oend) |
f6f235bc26ba
(print-region-new-buffer): Return new start and end.
Richard M. Stallman <rms@gnu.org>
parents:
10670
diff
changeset
|
285 (let ((oldbuf (current-buffer))) |
f6f235bc26ba
(print-region-new-buffer): Return new start and end.
Richard M. Stallman <rms@gnu.org>
parents:
10670
diff
changeset
|
286 (set-buffer (get-buffer-create " *spool temp*")) |
35724
f2e26e453776
XEmacs compatibility and doc fixes from Vinicius Jose Latorre
Eli Zaretskii <eliz@gnu.org>
parents:
30101
diff
changeset
|
287 (widen) |
f2e26e453776
XEmacs compatibility and doc fixes from Vinicius Jose Latorre
Eli Zaretskii <eliz@gnu.org>
parents:
30101
diff
changeset
|
288 (erase-buffer) |
10700
f6f235bc26ba
(print-region-new-buffer): Return new start and end.
Richard M. Stallman <rms@gnu.org>
parents:
10670
diff
changeset
|
289 (insert-buffer-substring oldbuf ostart oend) |
f6f235bc26ba
(print-region-new-buffer): Return new start and end.
Richard M. Stallman <rms@gnu.org>
parents:
10670
diff
changeset
|
290 (cons (point-min) (point-max))))) |
659
505130d1ddf8
*** empty log message ***
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
617
diff
changeset
|
291 |
2382
030b76db285a
(printify-buffer) Added, debugged from Roland McGrath's printify-buffer code
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
2307
diff
changeset
|
292 (defun printify-region (begin end) |
17695
5788aa5f0fd0
(printify-region): Doc fix.
Richard M. Stallman <rms@gnu.org>
parents:
17414
diff
changeset
|
293 "Replace nonprinting characters in region with printable representations. |
5788aa5f0fd0
(printify-region): Doc fix.
Richard M. Stallman <rms@gnu.org>
parents:
17414
diff
changeset
|
294 The printable representations use ^ (for ASCII control characters) or hex. |
5788aa5f0fd0
(printify-region): Doc fix.
Richard M. Stallman <rms@gnu.org>
parents:
17414
diff
changeset
|
295 The characters tab, linefeed, space, return and formfeed are not affected." |
2382
030b76db285a
(printify-buffer) Added, debugged from Roland McGrath's printify-buffer code
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
2307
diff
changeset
|
296 (interactive "r") |
030b76db285a
(printify-buffer) Added, debugged from Roland McGrath's printify-buffer code
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
2307
diff
changeset
|
297 (save-excursion |
52098
6e131215906b
printify-region fix
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
49597
diff
changeset
|
298 (save-restriction |
6e131215906b
printify-region fix
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
49597
diff
changeset
|
299 (narrow-to-region begin end) |
6e131215906b
printify-region fix
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
49597
diff
changeset
|
300 (goto-char (point-min)) |
6e131215906b
printify-region fix
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
49597
diff
changeset
|
301 (let (c) |
6e131215906b
printify-region fix
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
49597
diff
changeset
|
302 (while (re-search-forward "[\^@-\^h\^k\^n-\^_\177-\377]" nil t) |
6e131215906b
printify-region fix
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
49597
diff
changeset
|
303 (setq c (preceding-char)) |
108765
d835100c3e8b
Replace Lisp calls to delete-backward-char by delete-char.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
106815
diff
changeset
|
304 (delete-char -1) |
64015
d2af21b7c1a4
(lpr): Finish `defgroup' description with period.
Juanma Barranquero <lekktu@gmail.com>
parents:
52401
diff
changeset
|
305 (insert (if (< c ?\s) |
52098
6e131215906b
printify-region fix
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
49597
diff
changeset
|
306 (format "\\^%c" (+ c ?@)) |
6e131215906b
printify-region fix
Vinicius Jose Latorre <viniciusjl@ig.com.br>
parents:
49597
diff
changeset
|
307 (format "\\%02x" c)))))))) |
35724
f2e26e453776
XEmacs compatibility and doc fixes from Vinicius Jose Latorre
Eli Zaretskii <eliz@gnu.org>
parents:
30101
diff
changeset
|
308 |
f2e26e453776
XEmacs compatibility and doc fixes from Vinicius Jose Latorre
Eli Zaretskii <eliz@gnu.org>
parents:
30101
diff
changeset
|
309 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; |
f2e26e453776
XEmacs compatibility and doc fixes from Vinicius Jose Latorre
Eli Zaretskii <eliz@gnu.org>
parents:
30101
diff
changeset
|
310 ;; Functions hacked from `ps-print' package. |
f2e26e453776
XEmacs compatibility and doc fixes from Vinicius Jose Latorre
Eli Zaretskii <eliz@gnu.org>
parents:
30101
diff
changeset
|
311 |
f2e26e453776
XEmacs compatibility and doc fixes from Vinicius Jose Latorre
Eli Zaretskii <eliz@gnu.org>
parents:
30101
diff
changeset
|
312 ;; Dynamic evaluation |
f2e26e453776
XEmacs compatibility and doc fixes from Vinicius Jose Latorre
Eli Zaretskii <eliz@gnu.org>
parents:
30101
diff
changeset
|
313 (defun lpr-eval-switch (arg) |
f2e26e453776
XEmacs compatibility and doc fixes from Vinicius Jose Latorre
Eli Zaretskii <eliz@gnu.org>
parents:
30101
diff
changeset
|
314 (cond ((stringp arg) arg) |
f2e26e453776
XEmacs compatibility and doc fixes from Vinicius Jose Latorre
Eli Zaretskii <eliz@gnu.org>
parents:
30101
diff
changeset
|
315 ((functionp arg) (apply arg nil)) |
f2e26e453776
XEmacs compatibility and doc fixes from Vinicius Jose Latorre
Eli Zaretskii <eliz@gnu.org>
parents:
30101
diff
changeset
|
316 ((symbolp arg) (symbol-value arg)) |
f2e26e453776
XEmacs compatibility and doc fixes from Vinicius Jose Latorre
Eli Zaretskii <eliz@gnu.org>
parents:
30101
diff
changeset
|
317 ((consp arg) (apply (car arg) (cdr arg))) |
f2e26e453776
XEmacs compatibility and doc fixes from Vinicius Jose Latorre
Eli Zaretskii <eliz@gnu.org>
parents:
30101
diff
changeset
|
318 (t nil))) |
f2e26e453776
XEmacs compatibility and doc fixes from Vinicius Jose Latorre
Eli Zaretskii <eliz@gnu.org>
parents:
30101
diff
changeset
|
319 |
f2e26e453776
XEmacs compatibility and doc fixes from Vinicius Jose Latorre
Eli Zaretskii <eliz@gnu.org>
parents:
30101
diff
changeset
|
320 ;; `lpr-flatten-list' is defined here (copied from "message.el" and |
f2e26e453776
XEmacs compatibility and doc fixes from Vinicius Jose Latorre
Eli Zaretskii <eliz@gnu.org>
parents:
30101
diff
changeset
|
321 ;; enhanced to handle dotted pairs as well) until we can get some |
f2e26e453776
XEmacs compatibility and doc fixes from Vinicius Jose Latorre
Eli Zaretskii <eliz@gnu.org>
parents:
30101
diff
changeset
|
322 ;; sensible autoloads, or `flatten-list' gets put somewhere decent. |
f2e26e453776
XEmacs compatibility and doc fixes from Vinicius Jose Latorre
Eli Zaretskii <eliz@gnu.org>
parents:
30101
diff
changeset
|
323 |
f2e26e453776
XEmacs compatibility and doc fixes from Vinicius Jose Latorre
Eli Zaretskii <eliz@gnu.org>
parents:
30101
diff
changeset
|
324 ;; (lpr-flatten-list '((a . b) c (d . e) (f g h) i . j)) |
f2e26e453776
XEmacs compatibility and doc fixes from Vinicius Jose Latorre
Eli Zaretskii <eliz@gnu.org>
parents:
30101
diff
changeset
|
325 ;; => (a b c d e f g h i j) |
f2e26e453776
XEmacs compatibility and doc fixes from Vinicius Jose Latorre
Eli Zaretskii <eliz@gnu.org>
parents:
30101
diff
changeset
|
326 |
f2e26e453776
XEmacs compatibility and doc fixes from Vinicius Jose Latorre
Eli Zaretskii <eliz@gnu.org>
parents:
30101
diff
changeset
|
327 (defun lpr-flatten-list (&rest list) |
f2e26e453776
XEmacs compatibility and doc fixes from Vinicius Jose Latorre
Eli Zaretskii <eliz@gnu.org>
parents:
30101
diff
changeset
|
328 (lpr-flatten-list-1 list)) |
f2e26e453776
XEmacs compatibility and doc fixes from Vinicius Jose Latorre
Eli Zaretskii <eliz@gnu.org>
parents:
30101
diff
changeset
|
329 |
f2e26e453776
XEmacs compatibility and doc fixes from Vinicius Jose Latorre
Eli Zaretskii <eliz@gnu.org>
parents:
30101
diff
changeset
|
330 (defun lpr-flatten-list-1 (list) |
f2e26e453776
XEmacs compatibility and doc fixes from Vinicius Jose Latorre
Eli Zaretskii <eliz@gnu.org>
parents:
30101
diff
changeset
|
331 (cond |
f2e26e453776
XEmacs compatibility and doc fixes from Vinicius Jose Latorre
Eli Zaretskii <eliz@gnu.org>
parents:
30101
diff
changeset
|
332 ((null list) (list)) |
f2e26e453776
XEmacs compatibility and doc fixes from Vinicius Jose Latorre
Eli Zaretskii <eliz@gnu.org>
parents:
30101
diff
changeset
|
333 ((consp list) |
f2e26e453776
XEmacs compatibility and doc fixes from Vinicius Jose Latorre
Eli Zaretskii <eliz@gnu.org>
parents:
30101
diff
changeset
|
334 (append (lpr-flatten-list-1 (car list)) |
f2e26e453776
XEmacs compatibility and doc fixes from Vinicius Jose Latorre
Eli Zaretskii <eliz@gnu.org>
parents:
30101
diff
changeset
|
335 (lpr-flatten-list-1 (cdr list)))) |
f2e26e453776
XEmacs compatibility and doc fixes from Vinicius Jose Latorre
Eli Zaretskii <eliz@gnu.org>
parents:
30101
diff
changeset
|
336 (t (list list)))) |
2382
030b76db285a
(printify-buffer) Added, debugged from Roland McGrath's printify-buffer code
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
2307
diff
changeset
|
337 |
11831 | 338 (provide 'lpr) |
339 | |
659
505130d1ddf8
*** empty log message ***
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
617
diff
changeset
|
340 ;;; lpr.el ends here |