annotate lisp/tl/emu.el @ 110:fe104dbd9147 r20-1b7

Import from CVS: tag r20-1b7
author cvs
date Mon, 13 Aug 2007 09:19:45 +0200
parents 0d2f883870bc
children cca96a509cfe
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
4
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
1 ;;; emu.el --- Emulation module for each Emacs variants
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
2
98
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 86
diff changeset
3 ;; Copyright (C) 1995,1996,1997 Free Software Foundation, Inc.
4
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
4
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
5 ;; Author: MORIOKA Tomohiko <morioka@jaist.ac.jp>
110
fe104dbd9147 Import from CVS: tag r20-1b7
cvs
parents: 98
diff changeset
6 ;; Version: $Id: emu.el,v 1.5 1997/03/16 03:05:44 steve Exp $
74
54cc21c15cbb Import from CVS: tag r20-0b32
cvs
parents: 70
diff changeset
7 ;; Keywords: emulation, compatibility, NEmacs, MULE, Emacs/mule, XEmacs
4
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
8
74
54cc21c15cbb Import from CVS: tag r20-0b32
cvs
parents: 70
diff changeset
9 ;; This file is part of emu.
4
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
10
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
11 ;; This program is free software; you can redistribute it and/or
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
12 ;; modify it under the terms of the GNU General Public License as
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
13 ;; published by the Free Software Foundation; either version 2, or (at
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
14 ;; your option) any later version.
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
15
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
16 ;; This program is distributed in the hope that it will be useful, but
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
17 ;; WITHOUT ANY WARRANTY; without even the implied warranty of
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
18 ;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
19 ;; General Public License for more details.
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
20
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
21 ;; You should have received a copy of the GNU General Public License
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
22 ;; along with GNU Emacs; see the file COPYING. If not, write to the
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
23 ;; Free Software Foundation, Inc., 59 Temple Place - Suite 330,
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
24 ;; Boston, MA 02111-1307, USA.
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
25
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
26 ;;; Code:
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
27
74
54cc21c15cbb Import from CVS: tag r20-0b32
cvs
parents: 70
diff changeset
28 (defmacro defun-maybe (name &rest everything-else)
54cc21c15cbb Import from CVS: tag r20-0b32
cvs
parents: 70
diff changeset
29 (or (and (fboundp name)
54cc21c15cbb Import from CVS: tag r20-0b32
cvs
parents: 70
diff changeset
30 (not (get name 'defun-maybe))
54cc21c15cbb Import from CVS: tag r20-0b32
cvs
parents: 70
diff changeset
31 )
54cc21c15cbb Import from CVS: tag r20-0b32
cvs
parents: 70
diff changeset
32 (` (or (fboundp (quote (, name)))
54cc21c15cbb Import from CVS: tag r20-0b32
cvs
parents: 70
diff changeset
33 (progn
54cc21c15cbb Import from CVS: tag r20-0b32
cvs
parents: 70
diff changeset
34 (defun (, name) (,@ everything-else))
54cc21c15cbb Import from CVS: tag r20-0b32
cvs
parents: 70
diff changeset
35 (put (quote (, name)) 'defun-maybe t)
54cc21c15cbb Import from CVS: tag r20-0b32
cvs
parents: 70
diff changeset
36 ))
54cc21c15cbb Import from CVS: tag r20-0b32
cvs
parents: 70
diff changeset
37 )))
54cc21c15cbb Import from CVS: tag r20-0b32
cvs
parents: 70
diff changeset
38
110
fe104dbd9147 Import from CVS: tag r20-1b7
cvs
parents: 98
diff changeset
39 (defmacro defmacro-maybe (name &rest everything-else)
fe104dbd9147 Import from CVS: tag r20-1b7
cvs
parents: 98
diff changeset
40 (or (and (fboundp name)
fe104dbd9147 Import from CVS: tag r20-1b7
cvs
parents: 98
diff changeset
41 (not (get name 'defmacro-maybe))
fe104dbd9147 Import from CVS: tag r20-1b7
cvs
parents: 98
diff changeset
42 )
fe104dbd9147 Import from CVS: tag r20-1b7
cvs
parents: 98
diff changeset
43 (` (or (fboundp (quote (, name)))
fe104dbd9147 Import from CVS: tag r20-1b7
cvs
parents: 98
diff changeset
44 (progn
fe104dbd9147 Import from CVS: tag r20-1b7
cvs
parents: 98
diff changeset
45 (defmacro (, name) (,@ everything-else))
fe104dbd9147 Import from CVS: tag r20-1b7
cvs
parents: 98
diff changeset
46 (put (quote (, name)) 'defmacro-maybe t)
fe104dbd9147 Import from CVS: tag r20-1b7
cvs
parents: 98
diff changeset
47 ))
fe104dbd9147 Import from CVS: tag r20-1b7
cvs
parents: 98
diff changeset
48 )))
fe104dbd9147 Import from CVS: tag r20-1b7
cvs
parents: 98
diff changeset
49
74
54cc21c15cbb Import from CVS: tag r20-0b32
cvs
parents: 70
diff changeset
50 (put 'defun-maybe 'lisp-indent-function 'defun)
110
fe104dbd9147 Import from CVS: tag r20-1b7
cvs
parents: 98
diff changeset
51 (put 'defmacro-maybe 'lisp-indent-function 'defun)
74
54cc21c15cbb Import from CVS: tag r20-0b32
cvs
parents: 70
diff changeset
52
54cc21c15cbb Import from CVS: tag r20-0b32
cvs
parents: 70
diff changeset
53
4
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
54 (or (boundp 'emacs-major-version)
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
55 (defconst emacs-major-version (string-to-int emacs-version)))
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
56 (or (boundp 'emacs-minor-version)
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
57 (defconst emacs-minor-version
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
58 (string-to-int
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
59 (substring
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
60 emacs-version
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
61 (string-match (format "%d\\." emacs-major-version) emacs-version)
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
62 ))))
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
63
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
64 (defvar running-emacs-18 (<= emacs-major-version 18))
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
65 (defvar running-xemacs (string-match "XEmacs" emacs-version))
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
66
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
67 (defvar running-mule-merged-emacs (and (not (boundp 'MULE))
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
68 (not running-xemacs) (featurep 'mule)))
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
69 (defvar running-xemacs-with-mule (and running-xemacs (featurep 'mule)))
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
70
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
71 (defvar running-emacs-19 (and (not running-xemacs) (= emacs-major-version 19)))
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
72 (defvar running-emacs-19_29-or-later
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
73 (or (and running-emacs-19 (>= emacs-minor-version 29))
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
74 (and (not running-xemacs)(>= emacs-major-version 20))))
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
75
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
76 (defvar running-xemacs-19 (and running-xemacs
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
77 (= emacs-major-version 19)))
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
78 (defvar running-xemacs-20-or-later (and running-xemacs
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
79 (>= emacs-major-version 20)))
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
80 (defvar running-xemacs-19_14-or-later
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
81 (or (and running-xemacs-19 (>= emacs-minor-version 14))
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
82 running-xemacs-20-or-later))
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
83
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
84 (cond (running-mule-merged-emacs
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
85 ;; for mule merged EMACS
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
86 (require 'emu-e20)
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
87 )
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
88 (running-xemacs-with-mule
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
89 ;; for XEmacs/mule
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
90 (require 'emu-x20)
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
91 )
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
92 ((boundp 'MULE)
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
93 ;; for MULE 1.* and 2.*
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
94 (require 'emu-mule)
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
95 )
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
96 ((boundp 'NEMACS)
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
97 ;; for NEmacs and NEpoch
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
98 (require 'emu-nemacs)
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
99 )
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
100 (t
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
101 ;; for EMACS 19 and XEmacs 19 (without mule)
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
102 (require 'emu-e19)
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
103 ))
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
104
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
105
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
106 ;;; @ MIME charset
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
107 ;;;
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
108
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
109 (defun charsets-to-mime-charset (charsets)
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
110 "Return MIME charset from list of charset CHARSETS.
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
111 This function refers variable `charsets-mime-charset-alist'
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
112 and `default-mime-charset'. [emu.el]"
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
113 (if charsets
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
114 (or (catch 'tag
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
115 (let ((rest charsets-mime-charset-alist)
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
116 cell csl)
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
117 (while (setq cell (car rest))
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
118 (if (catch 'not-subset
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
119 (let ((set1 charsets)
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
120 (set2 (car cell))
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
121 obj)
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
122 (while set1
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
123 (setq obj (car set1))
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
124 (or (memq obj set2)
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
125 (throw 'not-subset nil)
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
126 )
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
127 (setq set1 (cdr set1))
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
128 )
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
129 t))
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
130 (throw 'tag (cdr cell))
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
131 )
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
132 (setq rest (cdr rest))
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
133 )))
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
134 default-mime-charset)))
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
135
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
136
110
fe104dbd9147 Import from CVS: tag r20-1b7
cvs
parents: 98
diff changeset
137 ;;; @ Emacs 19.29 emulation
4
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
138 ;;;
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
139
86
364816949b59 Import from CVS: tag r20-0b93
cvs
parents: 78
diff changeset
140 (defvar path-separator ":"
364816949b59 Import from CVS: tag r20-0b93
cvs
parents: 78
diff changeset
141 "Character used to separate concatenated paths.")
4
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
142
110
fe104dbd9147 Import from CVS: tag r20-1b7
cvs
parents: 98
diff changeset
143 (defun-maybe buffer-substring-no-properties (start end)
fe104dbd9147 Import from CVS: tag r20-1b7
cvs
parents: 98
diff changeset
144 "Return the characters of part of the buffer, without the text properties.
fe104dbd9147 Import from CVS: tag r20-1b7
cvs
parents: 98
diff changeset
145 The two arguments START and END are character positions;
fe104dbd9147 Import from CVS: tag r20-1b7
cvs
parents: 98
diff changeset
146 they can be in either order. [Emacs 19.29 emulating function]"
fe104dbd9147 Import from CVS: tag r20-1b7
cvs
parents: 98
diff changeset
147 (let ((string (buffer-substring start end)))
fe104dbd9147 Import from CVS: tag r20-1b7
cvs
parents: 98
diff changeset
148 (set-text-properties 0 (length string) nil string)
74
54cc21c15cbb Import from CVS: tag r20-0b32
cvs
parents: 70
diff changeset
149 string))
54cc21c15cbb Import from CVS: tag r20-0b32
cvs
parents: 70
diff changeset
150
54cc21c15cbb Import from CVS: tag r20-0b32
cvs
parents: 70
diff changeset
151 (defun-maybe match-string (num &optional string)
54cc21c15cbb Import from CVS: tag r20-0b32
cvs
parents: 70
diff changeset
152 "Return string of text matched by last search.
54cc21c15cbb Import from CVS: tag r20-0b32
cvs
parents: 70
diff changeset
153 NUM specifies which parenthesized expression in the last regexp.
54cc21c15cbb Import from CVS: tag r20-0b32
cvs
parents: 70
diff changeset
154 Value is nil if NUMth pair didn't match, or there were less than NUM pairs.
54cc21c15cbb Import from CVS: tag r20-0b32
cvs
parents: 70
diff changeset
155 Zero means the entire text matched by the whole regexp or whole string.
54cc21c15cbb Import from CVS: tag r20-0b32
cvs
parents: 70
diff changeset
156 STRING should be given if the last search was by `string-match' on STRING.
110
fe104dbd9147 Import from CVS: tag r20-1b7
cvs
parents: 98
diff changeset
157 \[Emacs 19.29 emulating function]"
74
54cc21c15cbb Import from CVS: tag r20-0b32
cvs
parents: 70
diff changeset
158 (if (match-beginning num)
54cc21c15cbb Import from CVS: tag r20-0b32
cvs
parents: 70
diff changeset
159 (if string
54cc21c15cbb Import from CVS: tag r20-0b32
cvs
parents: 70
diff changeset
160 (substring string (match-beginning num) (match-end num))
54cc21c15cbb Import from CVS: tag r20-0b32
cvs
parents: 70
diff changeset
161 (buffer-substring (match-beginning num) (match-end num)))))
4
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
162
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
163 (or running-emacs-19_29-or-later
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
164 running-xemacs
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
165 ;; for Emacs 19.28 or earlier
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
166 (fboundp 'si:read-string)
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
167 (progn
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
168 (fset 'si:read-string (symbol-function 'read-string))
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
169
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
170 (defun read-string (prompt &optional initial-input history)
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
171 "Read a string from the minibuffer, prompting with string PROMPT.
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
172 If non-nil, second arg INITIAL-INPUT is a string to insert before reading.
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
173 The third arg HISTORY, is dummy for compatibility. [emu.el]
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
174 See `read-from-minibuffer' for details of HISTORY argument."
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
175 (si:read-string prompt initial-input)
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
176 )
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
177 ))
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
178
110
fe104dbd9147 Import from CVS: tag r20-1b7
cvs
parents: 98
diff changeset
179
fe104dbd9147 Import from CVS: tag r20-1b7
cvs
parents: 98
diff changeset
180 ;;; @ Emacs 19.30 emulation
fe104dbd9147 Import from CVS: tag r20-1b7
cvs
parents: 98
diff changeset
181 ;;;
fe104dbd9147 Import from CVS: tag r20-1b7
cvs
parents: 98
diff changeset
182
74
54cc21c15cbb Import from CVS: tag r20-0b32
cvs
parents: 70
diff changeset
183 ;; This function was imported Emacs 19.30.
54cc21c15cbb Import from CVS: tag r20-0b32
cvs
parents: 70
diff changeset
184 (defun-maybe add-to-list (list-var element)
54cc21c15cbb Import from CVS: tag r20-0b32
cvs
parents: 70
diff changeset
185 "Add to the value of LIST-VAR the element ELEMENT if it isn't there yet.
4
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
186 If you want to use `add-to-list' on a variable that is not defined
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
187 until a certain package is loaded, you should put the call to `add-to-list'
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
188 into a hook function that will be run only after loading the package.
110
fe104dbd9147 Import from CVS: tag r20-1b7
cvs
parents: 98
diff changeset
189 \[Emacs 19.30 emulating function]"
74
54cc21c15cbb Import from CVS: tag r20-0b32
cvs
parents: 70
diff changeset
190 (or (member element (symbol-value list-var))
54cc21c15cbb Import from CVS: tag r20-0b32
cvs
parents: 70
diff changeset
191 (set list-var (cons element (symbol-value list-var)))
54cc21c15cbb Import from CVS: tag r20-0b32
cvs
parents: 70
diff changeset
192 ))
70
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents: 32
diff changeset
193
4
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
194 (cond ((fboundp 'insert-file-contents-literally)
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
195 )
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
196 ((boundp 'file-name-handler-alist)
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
197 (defun insert-file-contents-literally
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
198 (filename &optional visit beg end replace)
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
199 "Like `insert-file-contents', q.v., but only reads in the file.
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
200 A buffer may be modified in several ways after reading into the buffer due
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
201 to advanced Emacs features, such as file-name-handlers, format decoding,
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
202 find-file-hooks, etc.
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
203 This function ensures that none of these modifications will take place.
110
fe104dbd9147 Import from CVS: tag r20-1b7
cvs
parents: 98
diff changeset
204 \[Emacs 19.30 emulating function]"
4
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
205 (let (file-name-handler-alist)
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
206 (insert-file-contents filename visit beg end replace)
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
207 ))
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
208 )
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
209 (t
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
210 (defalias 'insert-file-contents-literally 'insert-file-contents)
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
211 ))
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
212
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
213
110
fe104dbd9147 Import from CVS: tag r20-1b7
cvs
parents: 98
diff changeset
214 ;;; @ Emacs 19.31 emulation
4
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
215 ;;;
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
216
74
54cc21c15cbb Import from CVS: tag r20-0b32
cvs
parents: 70
diff changeset
217 (defun-maybe buffer-live-p (object)
54cc21c15cbb Import from CVS: tag r20-0b32
cvs
parents: 70
diff changeset
218 "Return non-nil if OBJECT is a buffer which has not been killed.
4
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
219 Value is nil if OBJECT is not a buffer or if it has been killed.
110
fe104dbd9147 Import from CVS: tag r20-1b7
cvs
parents: 98
diff changeset
220 \[Emacs 19.31 emulating function]"
74
54cc21c15cbb Import from CVS: tag r20-0b32
cvs
parents: 70
diff changeset
221 (and object
54cc21c15cbb Import from CVS: tag r20-0b32
cvs
parents: 70
diff changeset
222 (get-buffer object)
54cc21c15cbb Import from CVS: tag r20-0b32
cvs
parents: 70
diff changeset
223 (buffer-name (get-buffer object))
54cc21c15cbb Import from CVS: tag r20-0b32
cvs
parents: 70
diff changeset
224 ))
4
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
225
110
fe104dbd9147 Import from CVS: tag r20-1b7
cvs
parents: 98
diff changeset
226 ;; This macro was imported Emacs 19.33.
fe104dbd9147 Import from CVS: tag r20-1b7
cvs
parents: 98
diff changeset
227 (defmacro-maybe save-selected-window (&rest body)
fe104dbd9147 Import from CVS: tag r20-1b7
cvs
parents: 98
diff changeset
228 "Execute BODY, then select the window that was selected before BODY.
fe104dbd9147 Import from CVS: tag r20-1b7
cvs
parents: 98
diff changeset
229 \[Emacs 19.31 emulating function]"
fe104dbd9147 Import from CVS: tag r20-1b7
cvs
parents: 98
diff changeset
230 (list 'let
fe104dbd9147 Import from CVS: tag r20-1b7
cvs
parents: 98
diff changeset
231 '((save-selected-window-window (selected-window)))
fe104dbd9147 Import from CVS: tag r20-1b7
cvs
parents: 98
diff changeset
232 (list 'unwind-protect
fe104dbd9147 Import from CVS: tag r20-1b7
cvs
parents: 98
diff changeset
233 (cons 'progn body)
fe104dbd9147 Import from CVS: tag r20-1b7
cvs
parents: 98
diff changeset
234 (list 'select-window 'save-selected-window-window))))
4
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
235
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
236
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
237 ;;; @ XEmacs emulation
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
238 ;;;
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
239
74
54cc21c15cbb Import from CVS: tag r20-0b32
cvs
parents: 70
diff changeset
240 (defun-maybe functionp (obj)
54cc21c15cbb Import from CVS: tag r20-0b32
cvs
parents: 70
diff changeset
241 "Returns t if OBJ is a function, nil otherwise.
110
fe104dbd9147 Import from CVS: tag r20-1b7
cvs
parents: 98
diff changeset
242 \[XEmacs emulating function]"
74
54cc21c15cbb Import from CVS: tag r20-0b32
cvs
parents: 70
diff changeset
243 (or (subrp obj)
54cc21c15cbb Import from CVS: tag r20-0b32
cvs
parents: 70
diff changeset
244 (byte-code-function-p obj)
54cc21c15cbb Import from CVS: tag r20-0b32
cvs
parents: 70
diff changeset
245 (and (symbolp obj)(fboundp obj))
54cc21c15cbb Import from CVS: tag r20-0b32
cvs
parents: 70
diff changeset
246 (and (consp obj)(eq (car obj) 'lambda))
54cc21c15cbb Import from CVS: tag r20-0b32
cvs
parents: 70
diff changeset
247 ))
54cc21c15cbb Import from CVS: tag r20-0b32
cvs
parents: 70
diff changeset
248
4
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
249
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
250 ;;; @ for XEmacs 20
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
251 ;;;
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
252
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
253 (or (fboundp 'char-int)
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
254 (fset 'char-int (symbol-function 'identity))
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
255 )
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
256 (or (fboundp 'int-char)
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
257 (fset 'int-char (symbol-function 'identity))
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
258 )
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
259
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
260
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
261 ;;; @ for text/richtext and text/enriched
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
262 ;;;
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
263
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
264 (cond ((or running-emacs-19_29-or-later running-xemacs-19_14-or-later)
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
265 ;; have enriched.el
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
266 (autoload 'richtext-decode "richtext")
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
267 (or (assq 'text/richtext format-alist)
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
268 (setq format-alist
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
269 (cons
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
270 (cons 'text/richtext
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
271 '("Extended MIME text/richtext format."
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
272 "Content-[Tt]ype:[ \t]*text/richtext"
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
273 richtext-decode richtext-encode t enriched-mode))
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
274 format-alist)))
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
275 )
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
276 (t
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
277 ;; don't have enriched.el
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
278 (autoload 'richtext-decode "tinyrich")
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
279 (autoload 'enriched-decode "tinyrich")
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
280 ))
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
281
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
282
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
283 ;;; @ end
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
284 ;;;
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
285
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
286 (provide 'emu)
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
287
b82b59fe008d Import from CVS: tag r19-15b3
cvs
parents:
diff changeset
288 ;;; emu.el ends here