Mercurial > emacs
view lisp/mh-e/mh-compat.el @ 68520:6a7173abcf59
* mh-acros.el (mh-defun-compat, mh-defmacro-compat): Add name argument
since compatibility functions should have our package prefix (mh-) by
Emacs convention and to avoid messing up checks for the same functions
in other packages. Use explicit argument instead of forming name by
adding mh-e prefix so that one can grep and find the definition.
* mh-alias.el (mh-alias-local-users, mh-alias-reload)
(mh-alias-expand, mh-alias-minibuffer-confirm-address): Use
mh-assoc-string instead of assoc-string.
* mh-compat.el (assoc-string): Rename to mh-assoc-string.
(mh-mail-abbrev-make-syntax-table, mh-url-hexify-string): Move here
from mh-utils.el.
(mh-display-completion-list): Move here from mh-comp.el.
(mh-face-foreground, mh-face-background): Move here from mh-xface.el.
(mh-write-file-functions): Move here from mh-folder.el
* mh-folder.el (mh-write-file-functions-compat): Move to mh-compat.el
and rename to mh-write-file-functions.
(mh-folder-mode): Use the new name.
* mh-gnus.el (gnus-local-map-property): Rename to
mh-gnus-local-map-property.
(mm-merge-handles): Rename to mh-mm-merge-handles.
(mm-set-handle-multipart-parameter): Rename to
mh-mm-set-handle-multipart-parameter.
(mm-inline-text-vcard): Rename to mh-mm-inline-text-vcard.
(mm-possibly-verify-or-decrypt): Rename to
mh-mm-possibly-verify-or-decrypt.
(mm-handle-multipart-ctl-parameter): Rename to
mh-mm-handle-multipart-ctl-parameter.
(mm-readable-p): Rename to mh-mm-readable-p.
(mm-long-lines-p): Rename to mh-mm-long-lines-p.
(mm-keep-viewer-alive-p): Rename to mh-mm-keep-viewer-alive-p.
(mm-destroy-parts): Rename to mh-mm-destroy-parts.
(mm-uu-dissect-text-parts): Rename to mh-mm-uu-dissect-text-parts.
(mml-minibuffer-read-disposition): Rename to
mh-mml-minibuffer-read-disposition.
* mh-identity.el (mh-identity-field-handler): Use mh-assoc-string
instead of assoc-string.
* mh-mime.el (mh-mm-inline-media-tests, mh-mm-inline-message)
(mh-mime-display, mh-mime-display-security) (mh-insert-mime-button,
mh-insert-mime-security-button) (mh-handle-set-external-undisplayer)
(mh-mime-security-press-button, mh-mime-security-show-details)
(mh-mml-attach-file, mh-mime-cleanup)
(mh-destroy-postponed-handles): Use new mh-* names for compatibility
functions.
* mh-utils.el (mail-abbrev-make-syntax-table): Move to mh-compat.el
and rename to mh-mail-abbrev-make-syntax-table.
(mh-beginning-of-word): Use the new name.
(mh-get-field): Delete ancient alias.
* mh-xface.el (mh-face-foreground-compat): Move to mh-compat.el and
rename to mh-face-foreground
(mh-face-background-compat): Move to mh-compat.el and rename to
mh-face-background.
(mh-face-display-function): Use the new names.
(mh-x-image-url-cache-canonicalize): Use mh-url-hexify-string instead
of url-hexify-string.
(url-unreserved-chars): Move to mh-compat.el and rename to
mh-url-unreserved-chars.
(url-hexify-string): Move to mh-compat.el and rename to
mh-url-hexify-string.
author | Bill Wohler <wohler@newt.com> |
---|---|
date | Tue, 31 Jan 2006 20:46:15 +0000 |
parents | 4bd450a8dbe2 |
children | 7daec5f4a289 |
line wrap: on
line source
;;; mh-compat.el --- make MH-E compatibile with various versions of Emacs ;; Copyright (C) 2006 Free Software Foundation, Inc. ;; Author: Bill Wohler <wohler@newt.com> ;; Maintainer: Bill Wohler <wohler@newt.com> ;; Keywords: mail ;; See: mh-e.el ;; This file is part of GNU Emacs. ;; GNU Emacs is free software; you can redistribute it and/or modify ;; it under the terms of the GNU General Public License as published by ;; the Free Software Foundation; either version 2, or (at your option) ;; any later version. ;; GNU Emacs is distributed in the hope that it will be useful, ;; but WITHOUT ANY WARRANTY; without even the implied warranty of ;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the ;; GNU General Public License for more details. ;; You should have received a copy of the GNU General Public License ;; along with GNU Emacs; see the file COPYING. If not, write to the ;; Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, ;; Boston, MA 02110-1301, USA. ;;; Commentary: ;;; Change Log: ;;; Code: ;; This is a good place to gather code that is used for compatibility ;; between different versions of Emacs. Please document which versions ;; of Emacs that the defsubst, defalias, or defmacro applies. That ;; way, it's easy to occasionally go through this file and see which ;; macros we can retire. ;; Please use mh-gnus.el when providing compatibility with different ;; versions of Gnus and mh-xemacs.el for compatibility with XEmacs. ;; Items are listed alphabetically. (mh-defun-compat mh-assoc-string assoc-string (key list case-fold) "Like `assoc' but specifically for strings. Case is ignored if CASE-FOLD is non-nil. This function added by MH-E for Emacs versions that lack `assoc-string', introduced in Emacs 22." (if case-fold (assoc-ignore-case key list) (assoc key list))) (require 'mailabbrev nil t) (mh-defun-compat mh-mail-abbrev-make-syntax-table mail-abbrev-make-syntax-table () "Emacs 21 and XEmacs don't have this function." nil) (defmacro mh-display-completion-list (completions &optional common-substring) "Display the list of COMPLETIONS. See documentation for `display-completion-list' for a description of the arguments COMPLETIONS and perhaps COMMON-SUBSTRING. This macro added by MH-E for Emacs versions that lack a COMMON-SUBSTRING argument, introduced in Emacs 22." (if (< emacs-major-version 22) `(display-completion-list ,completions) `(display-completion-list ,completions ,common-substring))) (defmacro mh-face-foreground (face &optional frame inherit) "Return the foreground color name of FACE, or nil if unspecified. See documentation for `face-foreground' for a description of the arguments FACE, FRAME, and perhaps INHERIT. This macro added by MH-E for Emacs versions that lack an INHERIT argument, introduced in Emacs 22." (if (< emacs-major-version 22) `(face-foreground ,face ,frame) `(face-foreground ,face ,frame ,inherit))) (defmacro mh-face-background (face &optional frame inherit) "Return the background color name of face, or nil if unspecified. See documentation for `back-foreground' for a description of the arguments FACE, FRAME, and INHERIT. This macro added by MH-E for Emacs versions that lack an INHERIT argument, introduced in Emacs 22." (if (< emacs-major-version 22) `(face-background ,face ,frame) `(face-background ,face ,frame ,inherit))) ;; Copy of constant from url-util.el in Emacs 22; needed by Emacs 21. (if (not (boundp 'url-unreserved-chars)) (defconst mh-url-unresrved-chars '( ?a ?b ?c ?d ?e ?f ?g ?h ?i ?j ?k ?l ?m ?n ?o ?p ?q ?r ?s ?t ?u ?v ?w ?x ?y ?z ?A ?B ?C ?D ?E ?F ?G ?H ?I ?J ?K ?L ?M ?N ?O ?P ?Q ?R ?S ?T ?U ?V ?W ?X ?Y ?Z ?0 ?1 ?2 ?3 ?4 ?5 ?6 ?7 ?8 ?9 ?- ?_ ?. ?! ?~ ?* ?' ?\( ?\)) "A list of characters that are _NOT_ reserved in the URL spec. This is taken from RFC 2396.")) (mh-defun-compat mh-url-hexify-string url-hexify-string (str) "Escape characters in a string. This is a copy of `url-hexify-string' from url-util.el in Emacs 22; needed by Emacs 21." (mapconcat (lambda (char) ;; Fixme: use a char table instead. (if (not (memq char mh-url-unreserved-chars)) (if (> char 255) (error "Hexifying multibyte character %s" str) (format "%%%02X" char)) (char-to-string char))) str "")) (defmacro mh-write-file-functions () "Return `write-file-functions' if it exists. Otherwise return `local-write-file-hooks'. This macro exists purely for compatibility. The former symbol is used in Emacs 22 onward while the latter is used in previous versions and XEmacs." (if (boundp 'write-file-functions) ''write-file-functions ;Emacs 22 on ''local-write-file-hooks)) ;XEmacs (provide 'mh-compat) ;; Local Variables: ;; no-byte-compile: t ;; indent-tabs-mode: nil ;; sentence-end-double-space: nil ;; End: ;; arch-tag: 577b0eab-a5cd-45e1-8d9f-c1a426f4d73c ;;; mh-compat.el ends here