annotate lisp/w3/w3-print.el @ 118:7d55a9ba150c r20-1b11

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