Mercurial > emacs
annotate lisp/lpr.el @ 1050:133bad38bde1
* xfns.c (x_icon): Don't call x_wm_set_icon_positions if the user
hasn't specified the icon position. Let the window manager put
the icon where it likes.
* xfns.c (x_set_name): Use XSetWM{Name,IconName} when available
[HAVE_X11R4], or XSetIconName and XStoreName otherwise.
* xfns.c: Use the FRAME_X_WINDOW for readability.
* xfns.c (x_set_mouse_color): Use x_catch_errors, x_check_errors,
and x_uncatch errors to avoid crashing if the user selects an
odd cursor.
* xfns.c (select_visual): Use XVisualIDFromVisual when available
[HAVE_X11R4].
author | Jim Blandy <jimb@redhat.com> |
---|---|
date | Sat, 29 Aug 1992 03:25:25 +0000 |
parents | 52cd80cb5be1 |
children | 2fee5d1fe47e |
rev | line source |
---|---|
659
505130d1ddf8
*** empty log message ***
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
617
diff
changeset
|
1 ;;; lpr.el --- print Emacs buffer on line printer. |
505130d1ddf8
*** empty log message ***
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
617
diff
changeset
|
2 |
846
20674ae6bf52
*** empty log message ***
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
811
diff
changeset
|
3 ;; Copyright (C) 1985, 1988, 1992 Free Software Foundation, Inc. |
20674ae6bf52
*** empty log message ***
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
811
diff
changeset
|
4 |
807
4f28bd14272c
*** empty log message ***
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
659
diff
changeset
|
5 ;; Maintainer: FSF |
811
e694e0879463
*** empty log message ***
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
807
diff
changeset
|
6 ;; Keywords: unix |
807
4f28bd14272c
*** empty log message ***
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
659
diff
changeset
|
7 |
155 | 8 ;; This file is part of GNU Emacs. |
9 | |
10 ;; GNU Emacs is free software; you can redistribute it and/or modify | |
11 ;; it under the terms of the GNU General Public License as published by | |
807
4f28bd14272c
*** empty log message ***
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
659
diff
changeset
|
12 ;; the Free Software Foundation; either version 2, or (at your option) |
155 | 13 ;; any later version. |
14 | |
15 ;; GNU Emacs is distributed in the hope that it will be useful, | |
16 ;; but WITHOUT ANY WARRANTY; without even the implied warranty of | |
17 ;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |
18 ;; GNU General Public License for more details. | |
19 | |
20 ;; You should have received a copy of the GNU General Public License | |
21 ;; along with GNU Emacs; see the file COPYING. If not, write to | |
22 ;; the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA. | |
23 | |
807
4f28bd14272c
*** empty log message ***
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
659
diff
changeset
|
24 ;;; Code: |
155 | 25 |
269 | 26 ;;;###autoload |
27 (defconst lpr-switches nil "\ | |
28 *List of strings to pass as extra switch args to lpr when it is invoked.") | |
155 | 29 |
30 (defvar lpr-command (if (eq system-type 'usg-unix-v) | |
31 "lp" "lpr") | |
617 | 32 "*Shell command for printing a file") |
155 | 33 |
34 (defvar print-region-function nil | |
35 "Function to call to print the region on a printer. | |
216
2c663336acaf
*** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
155
diff
changeset
|
36 See definition of `print-region-1' for calling conventions.") |
155 | 37 |
256 | 38 ;;;###autoload |
155 | 39 (defun lpr-buffer () |
40 "Print buffer contents as with Unix command `lpr'. | |
41 `lpr-switches' is a list of extra switches (strings) to pass to lpr." | |
42 (interactive) | |
43 (print-region-1 (point-min) (point-max) lpr-switches nil)) | |
44 | |
256 | 45 ;;;###autoload |
155 | 46 (defun print-buffer () |
47 "Print buffer contents as with Unix command `lpr -p'. | |
48 `lpr-switches' is a list of extra switches (strings) to pass to lpr." | |
49 (interactive) | |
50 (print-region-1 (point-min) (point-max) lpr-switches t)) | |
51 | |
256 | 52 ;;;###autoload |
155 | 53 (defun lpr-region (start end) |
54 "Print region contents as with Unix command `lpr'. | |
55 `lpr-switches' is a list of extra switches (strings) to pass to lpr." | |
56 (interactive "r") | |
57 (print-region-1 start end lpr-switches nil)) | |
58 | |
256 | 59 ;;;###autoload |
155 | 60 (defun print-region (start end) |
61 "Print region contents as with Unix command `lpr -p'. | |
62 `lpr-switches' is a list of extra switches (strings) to pass to lpr." | |
63 (interactive "r") | |
64 (print-region-1 start end lpr-switches t)) | |
65 | |
66 (defun print-region-1 (start end switches page-headers) | |
67 (let ((name (concat (buffer-name) " Emacs buffer")) | |
68 (width tab-width)) | |
69 (save-excursion | |
70 (message "Spooling...") | |
71 (if (/= tab-width 8) | |
72 (progn | |
73 (print-region-new-buffer start end) | |
74 (setq tab-width width) | |
75 (untabify (point-min) (point-max)))) | |
76 (if page-headers | |
77 (if (eq system-type 'usg-unix-v) | |
78 (progn | |
922 | 79 (print-region-new-buffer start end) |
155 | 80 (call-process-region start end "pr" t t nil)) |
81 ;; On BSD, use an option to get page headers. | |
82 (setq switches (cons "-p" switches)))) | |
83 (apply (or print-region-function 'call-process-region) | |
84 (nconc (list start end lpr-command | |
85 nil nil nil) | |
86 (nconc (and (eq system-type 'berkeley-unix) | |
87 (list "-J" name "-T" name)) | |
88 switches))) | |
89 (message "Spooling...done")))) | |
90 | |
91 ;; This function copies the text between start and end | |
92 ;; into a new buffer, makes that buffer current, | |
93 ;; and sets start and end to the buffer bounds. | |
94 ;; start and end are used free. | |
922 | 95 (defun print-region-new-buffer (start end) |
155 | 96 (or (string= (buffer-name) " *spool temp*") |
97 (let ((oldbuf (current-buffer))) | |
98 (set-buffer (get-buffer-create " *spool temp*")) | |
99 (widen) (erase-buffer) | |
100 (insert-buffer-substring oldbuf start end) | |
101 (setq start (point-min) end (point-max))))) | |
659
505130d1ddf8
*** empty log message ***
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
617
diff
changeset
|
102 |
505130d1ddf8
*** empty log message ***
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
617
diff
changeset
|
103 ;;; lpr.el ends here |