annotate lisp/apel/emu.el @ 192:9d35321dd38c

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