comparison lisp/mh-e/mh-compat.el @ 90385:72dea2ff0142

Revision: emacs@sv.gnu.org/emacs--unicode--0--patch-57 Merge from emacs--devo--0 Patches applied: * emacs--devo--0 (patch 226-238) - Update from CVS - Merge from gnus--rel--5.10 - Update from CVS: lisp/progmodes/python.el (python-mode): Fix typo. * gnus--rel--5.10 (patch 86-90) - Update from CVS - Merge from emacs--devo--0
author Miles Bader <miles@gnu.org>
date Fri, 21 Apr 2006 05:39:14 +0000
parents c156f6a9e7b5 b3ab71ac7f4e
children 95d0cdf160ea
comparison
equal deleted inserted replaced
90384:c156f6a9e7b5 90385:72dea2ff0142
60 (if (not (featurep feature)) 60 (if (not (featurep feature))
61 (if filename 61 (if filename
62 (load filename noerror t) 62 (load filename noerror t)
63 (load (format "%s" feature) noerror t))))) 63 (load (format "%s" feature) noerror t)))))
64 64
65 (mh-defun-compat mh-assoc-string assoc-string (key list case-fold) 65 (defun-mh mh-assoc-string assoc-string (key list case-fold)
66 "Like `assoc' but specifically for strings. 66 "Like `assoc' but specifically for strings.
67 Case is ignored if CASE-FOLD is non-nil. 67 Case is ignored if CASE-FOLD is non-nil.
68 This function is used by Emacs versions that lack `assoc-string', 68 This function is used by Emacs versions that lack `assoc-string',
69 introduced in Emacs 22." 69 introduced in Emacs 22."
70 (if case-fold 70 (if case-fold
75 (defalias 'mh-cancel-timer 75 (defalias 'mh-cancel-timer
76 (if (fboundp 'cancel-timer) 76 (if (fboundp 'cancel-timer)
77 'cancel-timer 77 'cancel-timer
78 'delete-itimer)) 78 'delete-itimer))
79 79
80 (mh-defun-compat mh-display-color-cells display-color-cells (&optional display) 80 (defun-mh mh-display-color-cells display-color-cells (&optional display)
81 "Return the number of color cells supported by DISPLAY. 81 "Return the number of color cells supported by DISPLAY.
82 This function is used by XEmacs to return 2 when 82 This function is used by XEmacs to return 2 when
83 `device-color-cells' returns nil. This happens when compiling or 83 `device-color-cells' returns nil. This happens when compiling or
84 running on a tty and causes errors since `display-color-cells' is 84 running on a tty and causes errors since `display-color-cells' is
85 expected to return an integer." 85 expected to return an integer."
113 introduced in Emacs 22." 113 introduced in Emacs 22."
114 (if (< emacs-major-version 22) 114 (if (< emacs-major-version 22)
115 `(face-background ,face ,frame) 115 `(face-background ,face ,frame)
116 `(face-background ,face ,frame ,inherit))) 116 `(face-background ,face ,frame ,inherit)))
117 117
118 (mh-defun-compat mh-font-lock-add-keywords font-lock-add-keywords 118 (defun-mh mh-font-lock-add-keywords font-lock-add-keywords
119 (mode keywords &optional how) 119 (mode keywords &optional how)
120 "XEmacs does not have `font-lock-add-keywords'. 120 "XEmacs does not have `font-lock-add-keywords'.
121 This function returns nil on that system.") 121 This function returns nil on that system.")
122 122
123 (mh-defun-compat mh-image-load-path-for-library 123 (defun-mh mh-image-load-path-for-library
124 image-load-path-for-library (library image &optional path no-error) 124 image-load-path-for-library (library image &optional path no-error)
125 "Return a suitable search path for images used by LIBRARY. 125 "Return a suitable search path for images used by LIBRARY.
126 126
127 It searches for IMAGE in `image-load-path' (excluding 127 It searches for IMAGE in `image-load-path' (excluding
128 \"`data-directory'/images\") and `load-path', followed by a path 128 \"`data-directory'/images\") and `load-path', followed by a path
213 213
214 ;; Return an augmented `path' or `load-path'. 214 ;; Return an augmented `path' or `load-path'.
215 (nconc (list image-directory) 215 (nconc (list image-directory)
216 (delete image-directory (copy-sequence (or path load-path)))))) 216 (delete image-directory (copy-sequence (or path load-path))))))
217 217
218 (mh-defun-compat mh-image-search-load-path 218 (defun-mh mh-image-search-load-path
219 image-search-load-path (file &optional path) 219 image-search-load-path (file &optional path)
220 "Emacs 21 and XEmacs don't have `image-search-load-path'. 220 "Emacs 21 and XEmacs don't have `image-search-load-path'.
221 This function returns nil on those systems." 221 This function returns nil on those systems."
222 nil) 222 nil)
223 223
232 (if (fboundp 'line-end-position) 232 (if (fboundp 'line-end-position)
233 'line-end-position 233 'line-end-position
234 'point-at-eol)) 234 'point-at-eol))
235 235
236 (mh-require 'mailabbrev nil t) 236 (mh-require 'mailabbrev nil t)
237 (mh-defun-compat mh-mail-abbrev-make-syntax-table 237 (defun-mh mh-mail-abbrev-make-syntax-table
238 mail-abbrev-make-syntax-table () 238 mail-abbrev-make-syntax-table ()
239 "Emacs 21 and XEmacs don't have `mail-abbrev-make-syntax-table'. 239 "Emacs 21 and XEmacs don't have `mail-abbrev-make-syntax-table'.
240 This function returns nil on those systems." 240 This function returns nil on those systems."
241 nil) 241 nil)
242 242
243 (mh-defun-compat mh-match-string-no-properties 243 (defun-mh mh-match-string-no-properties
244 match-string-no-properties (num &optional string) 244 match-string-no-properties (num &optional string)
245 "Return string of text matched by last search, without text properties. 245 "Return string of text matched by last search, without text properties.
246 This function is used by XEmacs that lacks `match-string-no-properties'. 246 This function is used by XEmacs that lacks `match-string-no-properties'.
247 The function `buffer-substring-no-properties' is used instead. 247 The function `buffer-substring-no-properties' is used instead.
248 The argument STRING is ignored." 248 The argument STRING is ignored."
249 (buffer-substring-no-properties 249 (buffer-substring-no-properties
250 (match-beginning num) (match-end num))) 250 (match-beginning num) (match-end num)))
251 251
252 (mh-defun-compat mh-replace-regexp-in-string replace-regexp-in-string 252 (defun-mh mh-replace-regexp-in-string replace-regexp-in-string
253 (regexp rep string &optional fixedcase literal subexp start) 253 (regexp rep string &optional fixedcase literal subexp start)
254 "Replace REGEXP with REP everywhere in STRING and return result. 254 "Replace REGEXP with REP everywhere in STRING and return result.
255 This function is used by XEmacs that lacks `replace-regexp-in-string'. 255 This function is used by XEmacs that lacks `replace-regexp-in-string'.
256 The function `replace-in-string' is used instead. 256 The function `replace-in-string' is used instead.
257 The arguments FIXEDCASE, SUBEXP, and START, used by 257 The arguments FIXEDCASE, SUBEXP, and START, used by
267 ?0 ?1 ?2 ?3 ?4 ?5 ?6 ?7 ?8 ?9 267 ?0 ?1 ?2 ?3 ?4 ?5 ?6 ?7 ?8 ?9
268 ?- ?_ ?. ?! ?~ ?* ?' ?\( ?\)) 268 ?- ?_ ?. ?! ?~ ?* ?' ?\( ?\))
269 "A list of characters that are _NOT_ reserved in the URL spec. 269 "A list of characters that are _NOT_ reserved in the URL spec.
270 This is taken from RFC 2396.")) 270 This is taken from RFC 2396."))
271 271
272 (mh-defun-compat mh-url-hexify-string url-hexify-string (str) 272 (defun-mh mh-url-hexify-string url-hexify-string (str)
273 "Escape characters in a string. 273 "Escape characters in a string.
274 This is a copy of `url-hexify-string' from url-util.el in Emacs 274 This is a copy of `url-hexify-string' from url-util.el in Emacs
275 22; needed by Emacs 21." 275 22; needed by Emacs 21."
276 (mapconcat 276 (mapconcat
277 (lambda (char) 277 (lambda (char)
281 (error "Hexifying multibyte character %s" str) 281 (error "Hexifying multibyte character %s" str)
282 (format "%%%02X" char)) 282 (format "%%%02X" char))
283 (char-to-string char))) 283 (char-to-string char)))
284 str "")) 284 str ""))
285 285
286 (mh-defun-compat mh-view-mode-enter 286 (defun-mh mh-view-mode-enter
287 view-mode-enter (&optional return-to exit-action) 287 view-mode-enter (&optional return-to exit-action)
288 "Enter View mode. 288 "Enter View mode.
289 This function is used by XEmacs that lacks `view-mode-enter'. 289 This function is used by XEmacs that lacks `view-mode-enter'.
290 The function `view-mode' is used instead. 290 The function `view-mode' is used instead.
291 The arguments RETURN-TO and EXIT-ACTION are ignored." 291 The arguments RETURN-TO and EXIT-ACTION are ignored."