diff lisp/mh-e/mh-identity.el @ 66356:131366a2e19b

* mh-identity.el (mh-assoc-ignore-case): New macro that uses assoc-string (if the function is available) and falls back on assoc-ignore-case if assoc-string is not found. (mh-identity-field-handler): Use mh-assoc-ignore-case since assoc-ignore-case is a obsolete function in Emacs 22. * mh-e.el (mh-folder-buttons-init-flag): New variable that keeps track of whether the tool-bar in mh-folder-mode has been initialized yet. (mh-folder-mode): Initialize the tool-bar for folders the first time we get into mh-letter-mode. * mh-customize.el (mh-buffer-exists-p): New function which tests presence of buffers of a given mode. (mh-tool-bar-define): New functions mh-tool-bar-folder-buttons-init and mh-tool-bar-letter-buttons-init are defined. These functions are used to create the tool-bar from the corresponding customizable variables. * mh-comp.el (mh-letter-buttons-init-flag): New variable that keeps track of whether the tool-bar in mh-letter-mode has been initialized yet. (mh-letter-mode): Initialize the tool-bar for drafts the first time we get into mh-letter-mode.
author Satyaki Das <satyaki@theforce.stanford.edu>
date Sun, 23 Oct 2005 22:34:34 +0000
parents aec7b3bb973f
children f5ade15d46f2
line wrap: on
line diff
--- a/lisp/mh-e/mh-identity.el	Sun Oct 23 21:50:34 2005 +0000
+++ b/lisp/mh-e/mh-identity.el	Sun Oct 23 22:34:34 2005 +0000
@@ -118,13 +118,20 @@
 (defvar mh-identity-signature-end nil
   "Marker for the end of a signature inserted by `mh-insert-identity'.")
 
+(defmacro mh-assoc-ignore-case (key alist)
+  "Compatibility macro for emacs versions that lack `assoc-string'.
+Check if KEY is present in ALIST while ignoring case to do the comparison."
+  (if (fboundp 'assoc-string)
+      `(assoc-string ,key ,alist t)
+    `(assoc-ignore-case ,key ,alist)))
+
 (defun mh-identity-field-handler (field)
   "Return the handler for header FIELD or nil if none set.
 The field name is downcased. If the FIELD begins with the character
 `:', then it must have a special handler defined in
 `mh-identity-handlers', else return an error since it is not a valid
 header field."
-  (or (cdr (assoc-ignore-case field mh-identity-handlers))
+  (or (cdr (mh-assoc-ignore-case field mh-identity-handlers))
       (and (eq (aref field 0) ?:)
            (error "Field %s - unknown mh-identity-handler" field))
       (cdr (assoc ":default" mh-identity-handlers))