diff lisp/mh-e/mh-xface.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 d81780942bb8
line wrap: on
line diff
--- a/lisp/mh-e/mh-xface.el	Tue Jan 31 20:19:50 2006 +0000
+++ b/lisp/mh-e/mh-xface.el	Tue Jan 31 20:46:15 2006 +0000
@@ -59,32 +59,6 @@
                  mh-clean-message-header-flag))
     (funcall mh-show-xface-function)))
 
-(defmacro mh-face-foreground-compat (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 INHERIT.
-
-Calls `face-foreground' correctly in older environments. Versions
-of Emacs prior to version 22 lacked an INHERIT argument which
-when t tells `face-foreground' to consider an inherited value for
-the foreground if the face does not define one itself."
-  (if (>= emacs-major-version 22)
-      `(face-foreground ,face ,frame ,inherit)
-    `(face-foreground ,face ,frame)))
-
-(defmacro mh-face-background-compat(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.
-
-Calls `face-background' correctly in older environments. Versions
-of Emacs prior to version 22 lacked an INHERIT argument which
-when t tells `face-background' to consider an inherited value for
-the background if the face does not define one itself."
-  (if (>= emacs-major-version 22)
-      `(face-background ,face ,frame ,inherit)
-    `(face-background ,face ,frame)))
-
 ;; Shush compiler.
 (eval-when-compile
   (mh-do-in-xemacs (defvar default-enable-multibyte-characters)))
@@ -120,9 +94,9 @@
                insert-image (create-image
                              raw type t
                              :foreground
-                             (mh-face-foreground-compat 'mh-show-xface nil t)
+                             (mh-face-foreground 'mh-show-xface nil t)
                              :background
-                             (mh-face-background-compat 'mh-show-xface nil t))
+                             (mh-face-background 'mh-show-xface nil t))
                " ")))
           ;; XEmacs
           (mh-do-in-xemacs
@@ -386,41 +360,17 @@
 (defun mh-x-image-url-cache-canonicalize (url)
   "Canonicalize URL.
 Replace the ?/ character with a ?! character and append .png.
-Also replaces special characters with `url-hexify-string' since
-not all characters, such as :, are legal within Windows
-filenames. See URL `http://msdn.microsoft.com/library/default.asp?url=/library/en-us/fileio/fs/naming_a_file.asp'."
+Also replaces special characters with `mh-url-hexify-string'
+since not all characters, such as :, are legal within Windows
+filenames. See URL
+`http://msdn.microsoft.com/library/default.asp?url=/library/en-us/fileio/fs/naming_a_file.asp'."
   (format "%s/%s.png" mh-x-image-cache-directory
-          (url-hexify-string
+          (mh-url-hexify-string
            (with-temp-buffer
              (insert url)
              (mh-replace-string "/" "!")
              (buffer-string)))))
 
-;; Copy of constant from url-util.el in Emacs 22; needed by Emacs 21.
-(if (not (boundp 'url-unreserved-chars))
-    (defconst url-unreserved-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 url-hexify-string (str)
-  "Escape characters in a string.
-This is a copy of the function of the same name from url-util.el
-in Emacs 22; needed by Emacs 21."
-  (mapconcat
-   (lambda (char)
-     ;; Fixme: use a char table instead.
-     (if (not (memq char url-unreserved-chars))
-         (if (> char 255)
-               (error "Hexifying multibyte character %s" str)
-           (format "%%%02X" char))
-       (char-to-string char)))
-   str ""))
-
 (defun mh-x-image-get-download-state (file)
   "Check the state of FILE by following any symbolic links."
   (unless (file-exists-p mh-x-image-cache-directory)