comparison lisp/w3/w3-xem20.el @ 2:ac2d302a0011 r19-15b2

Import from CVS: tag r19-15b2
author cvs
date Mon, 13 Aug 2007 08:46:35 +0200
parents
children
comparison
equal deleted inserted replaced
1:c0c6a60d29db 2:ac2d302a0011
1 ;;; w3-xem20.el,v --- XEmacs 20.0 with Mule specific functions
2 ;; Author: MORIOKA Tomohiko
3 ;; Created: 1996/06/14 16:44:59
4 ;; Version: 1.1
5 ;; Keywords: faces, help, i18n, mouse, hypermedia
6
7 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
8 ;;; Copyright (c) 1996 by MORIOKA Tomohiko
9 ;;;
10 ;;; This file is part of GNU Emacs.
11 ;;;
12 ;;; GNU Emacs is free software; you can redistribute it and/or modify
13 ;;; it under the terms of the GNU General Public License as published by
14 ;;; the Free Software Foundation; either version 2, or (at your option)
15 ;;; any later version.
16 ;;;
17 ;;; GNU Emacs is distributed in the hope that it will be useful,
18 ;;; but WITHOUT ANY WARRANTY; without even the implied warranty of
19 ;;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
20 ;;; GNU General Public License for more details.
21 ;;;
22 ;;; You should have received a copy of the GNU General Public License
23 ;;; along with GNU Emacs; see the file COPYING. If not, write to
24 ;;; the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.
25 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
26
27 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
28 ;;; Printing a mule buffer as postscript. Requires m2ps
29 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
30 (defun w3-m2ps-buffer (&optional buffer)
31 "Print a buffer by passing it through m2ps and lpr."
32 (or buffer (setq buffer (current-buffer)))
33 (let ((x (save-excursion (set-buffer buffer) tab-width)))
34 (save-excursion
35 (set-buffer (get-buffer-create " *mule-print*"))
36 (erase-buffer)
37 (insert-buffer buffer)
38 (if (/= x tab-width)
39 (progn
40 (setq tab-width x)
41 (message "Converting tabs")
42 (untabify (point-min) (point-max))))
43 (setq file-coding-system *internal*)
44 (shell-command-on-region (point-min) (point-max)
45 "m2ps | lpr" t))))
46
47 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
48 ;;; Multi-Lingual Emacs (MULE) Specific Functions
49 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
50 (defvar attributed-region nil
51 "Bogus definition to get rid of compile-time warnings.")
52
53 (defun w3-inhibit-code-conversion (proc buf)
54 "Inhibit Mule's subprocess PROC from code converting in BUF."
55 (save-excursion
56 (set-buffer buf)
57 (setq mc-flag nil))
58 (set-process-input-coding-system proc url-mule-no-coding-system)
59 (set-process-output-coding-system proc url-mule-no-coding-system))
60
61 (defvar w3-mime-list-for-code-conversion
62 '("text/plain" "text/html")
63 "List of MIME types that require Mules' code conversion.")
64 (make-variable-buffer-local 'w3-mime-list-for-code-conversion)
65
66 (defun w3-convert-code-for-mule (mmtype)
67 "Convert current data into the appropriate coding system"
68 (and (or (not mmtype) (member mmtype w3-mime-list-for-code-conversion))
69 (let* ((c (detect-coding-region (point-min) (point-max)))
70 (code (or (and (listp c) (car c)) c)))
71 (setq mc-flag t)
72 (decode-coding-region (point-min) (point-max) code)
73 (set-file-coding-system code)
74 )))
75
76 (provide 'w3-xem20)