2
|
1 ;;; w3-mule.el --- MULE 18/19 specific functions for emacs-w3
|
0
|
2 ;; Author: wmperry
|
2
|
3 ;; Created: 1996/06/30 18:09:59
|
|
4 ;; Version: 1.2
|
0
|
5 ;; Keywords: faces, help, i18n, mouse, hypermedia
|
|
6
|
|
7 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
2
|
8 ;;; Copyright (c) 1993 - 1996 by William M. Perry (wmperry@cs.indiana.edu)
|
0
|
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)
|