2
|
1 ;;; w3-print.el --- Printing support for emacs-w3
|
0
|
2 ;; Author: wmperry
|
118
|
3 ;; Created: 1997/04/02 21:09:14
|
|
4 ;; Version: 1.8
|
0
|
5 ;; Keywords: faces, help, printing, hypermedia
|
|
6
|
|
7 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
2
|
8 ;;; Copyright (c) 1993 - 1996 by William M. Perry (wmperry@cs.indiana.edu)
|
82
|
9 ;;; Copyright (c) 1996, 1997 Free Software Foundation, Inc.
|
0
|
10 ;;;
|
|
11 ;;; This file is part of GNU Emacs.
|
|
12 ;;;
|
|
13 ;;; GNU Emacs is free software; you can redistribute it and/or modify
|
|
14 ;;; it under the terms of the GNU General Public License as published by
|
|
15 ;;; the Free Software Foundation; either version 2, or (at your option)
|
|
16 ;;; any later version.
|
|
17 ;;;
|
|
18 ;;; GNU Emacs is distributed in the hope that it will be useful,
|
|
19 ;;; but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
20 ;;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
21 ;;; GNU General Public License for more details.
|
|
22 ;;;
|
|
23 ;;; You should have received a copy of the GNU General Public License
|
80
|
24 ;;; along with GNU Emacs; see the file COPYING. If not, write to the
|
|
25 ;;; Free Software Foundation, Inc., 59 Temple Place - Suite 330,
|
|
26 ;;; Boston, MA 02111-1307, USA.
|
0
|
27 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
98
|
28 (defvar w3-postscript-print-function 'ps-print-buffer-with-faces
|
|
29 "*Name of the function to use to print a buffer as PostScript.
|
|
30 This should take no arguments, and act on the current buffer.
|
|
31 Possible values include:
|
|
32 ps-print-buffer-with-faces - print immediately
|
|
33 ps-spool-buffer-with-faces - spool for later")
|
0
|
34
|
|
35 (defun w3-print-this-url (&optional url format)
|
|
36 "Print out the current document (in LaTeX format)"
|
|
37 (interactive)
|
|
38 (if (not url) (setq url (url-view-url t)))
|
|
39 (let* ((completion-ignore-case t)
|
|
40 (format (or format
|
|
41 (completing-read
|
|
42 "Format: "
|
|
43 '(("HTML Source") ; The raw HTML code
|
|
44 ("Formatted Text") ; Plain ASCII rendition
|
|
45 ("PostScript") ; Pretty PostScript
|
|
46 ("LaTeX'd") ; LaTeX it, then print
|
|
47 )
|
|
48 nil t))))
|
|
49 (save-excursion
|
|
50 (cond
|
|
51 ((equal "HTML Source" format)
|
|
52 (if w3-current-source
|
|
53 (let ((x w3-current-source))
|
|
54 (set-buffer (get-buffer-create url-working-buffer))
|
|
55 (erase-buffer)
|
|
56 (insert x))
|
|
57 (url-retrieve url))
|
|
58 (lpr-buffer))
|
|
59 ((or (equal "Formatted Text" format)
|
|
60 (equal "" format))
|
|
61 (lpr-buffer))
|
|
62 ((equal "PostScript" format)
|
98
|
63 (funcall w3-postscript-print-function))
|
0
|
64 ((equal "LaTeX'd" format)
|
|
65 (w3-parse-tree-to-latex w3-current-parse url)
|
|
66 (save-window-excursion
|
|
67 (write-region (point-min) (point-max)
|
|
68 (expand-file-name "w3-tmp.latex"
|
|
69 w3-temporary-directory) nil 5)
|
|
70 (shell-command
|
|
71 (format
|
118
|
72 "cd %s ; latex w3-tmp.latex ; latex w3-tmp.latex ; %s w3-tmp.dvi ; rm -f w3-tmp*"
|
0
|
73 w3-temporary-directory
|
|
74 w3-print-command))
|
|
75 (kill-buffer "*Shell Command Output*")))))))
|
|
76
|
|
77 (defun w3-print-url-under-point ()
|
|
78 "Print out the url under point (in LaTeX format)"
|
|
79 (interactive)
|
|
80 (w3-print-this-url (w3-view-this-url t)))
|
|
81
|
|
82 (provide 'w3-print)
|