comparison lisp/w3/w3-mule.el @ 0:376386a54a3c r19-14

Import from CVS: tag r19-14
author cvs
date Mon, 13 Aug 2007 08:45:50 +0200
parents
children ac2d302a0011
comparison
equal deleted inserted replaced
-1:000000000000 0:376386a54a3c
1 ;;; w3-mule.el,v --- MULE 18/19 specific functions for emacs-w3
2 ;; Author: wmperry
3 ;; Created: 1996/04/25 14:41:19
4 ;; Version: 1.15
5 ;; Keywords: faces, help, i18n, mouse, hypermedia
6
7 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
8 ;;; Copyright (c) 1993, 1994, 1995 by William M. Perry (wmperry@spry.com)
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-coding-system proc *noconv* *noconv*))
59
60 (defvar w3-mime-list-for-code-conversion
61 '("text/plain" "text/html")
62 "List of MIME types that require Mules' code conversion.")
63 (make-variable-buffer-local 'w3-mime-list-for-code-conversion)
64
65 (defun w3-convert-code-for-mule (mmtype)
66 "Convert current data into the appropriate coding system"
67 (and (or (not mmtype) (member mmtype w3-mime-list-for-code-conversion))
68 (let* ((c (code-detect-region (point-min) (point-max)))
69 (code (or (and (listp c) (car c)) c)))
70 (setq mc-flag t)
71 (code-convert-region (point-min) (point-max) code *internal*)
72 (set-file-coding-system code))))
73
74 (provide 'w3-mule)