emacs-commit
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Emacs-commit] emacs/lisp/mh-e ChangeLog mh-comp.el mh-customi...


From: Satyaki Das
Subject: [Emacs-commit] emacs/lisp/mh-e ChangeLog mh-comp.el mh-customi...
Date: Sun, 23 Oct 2005 18:34:34 -0400

CVSROOT:        /cvsroot/emacs
Module name:    emacs
Branch:         
Changes by:     Satyaki Das <address@hidden>    05/10/23 22:34:34

Modified files:
        lisp/mh-e      : ChangeLog mh-comp.el mh-customize.el mh-e.el 
                         mh-identity.el 

Log message:
        * 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.

CVSWeb URLs:
http://savannah.gnu.org/cgi-bin/viewcvs/emacs/emacs/lisp/mh-e/ChangeLog.diff?tr1=1.46&tr2=1.47&r1=text&r2=text
http://savannah.gnu.org/cgi-bin/viewcvs/emacs/emacs/lisp/mh-e/mh-comp.el.diff?tr1=1.18&tr2=1.19&r1=text&r2=text
http://savannah.gnu.org/cgi-bin/viewcvs/emacs/emacs/lisp/mh-e/mh-customize.el.diff?tr1=1.22&tr2=1.23&r1=text&r2=text
http://savannah.gnu.org/cgi-bin/viewcvs/emacs/emacs/lisp/mh-e/mh-e.el.diff?tr1=1.28&tr2=1.29&r1=text&r2=text
http://savannah.gnu.org/cgi-bin/viewcvs/emacs/emacs/lisp/mh-e/mh-identity.el.diff?tr1=1.16&tr2=1.17&r1=text&r2=text

Patches:
Index: emacs/lisp/mh-e/ChangeLog
diff -u emacs/lisp/mh-e/ChangeLog:1.46 emacs/lisp/mh-e/ChangeLog:1.47
--- emacs/lisp/mh-e/ChangeLog:1.46      Sun Oct 23 21:26:17 2005
+++ emacs/lisp/mh-e/ChangeLog   Sun Oct 23 22:34:33 2005
@@ -1,3 +1,31 @@
+2005-10-23  Satyaki Das  <address@hidden>
+
+       * 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.
+
 2005-10-23  Bill Wohler  <address@hidden>
 
        * mh-comp.el (mh-letter-menu): Rename
Index: emacs/lisp/mh-e/mh-comp.el
diff -u emacs/lisp/mh-e/mh-comp.el:1.18 emacs/lisp/mh-e/mh-comp.el:1.19
--- emacs/lisp/mh-e/mh-comp.el:1.18     Sun Oct 23 21:26:17 2005
+++ emacs/lisp/mh-e/mh-comp.el  Sun Oct 23 22:34:33 2005
@@ -871,6 +871,8 @@
   (defvar tool-bar-mode)
   (defvar tool-bar-map))
 
+(defvar mh-letter-buttons-init-flag nil)
+
 ;;;###autoload
 (define-derived-mode mh-letter-mode text-mode "MH-Letter"
   "Mode for composing letters in MH-E.\\<mh-letter-mode-map>
@@ -897,6 +899,10 @@
   (make-local-variable 'mh-previous-window-config)
   (make-local-variable 'mh-sent-from-folder)
   (make-local-variable 'mh-sent-from-msg)
+  (mh-do-in-gnu-emacs
+   (unless mh-letter-buttons-init-flag
+     (mh-tool-bar-letter-buttons-init)
+     (setq mh-letter-buttons-init-flag t)))
   ;; Set the local value of mh-mail-header-separator according to what is
   ;; present in the buffer...
   (set (make-local-variable 'mh-mail-header-separator)
Index: emacs/lisp/mh-e/mh-customize.el
diff -u emacs/lisp/mh-e/mh-customize.el:1.22 
emacs/lisp/mh-e/mh-customize.el:1.23
--- emacs/lisp/mh-e/mh-customize.el:1.22        Sun Oct 23 21:26:17 2005
+++ emacs/lisp/mh-e/mh-customize.el     Sun Oct 23 22:34:33 2005
@@ -1673,6 +1673,14 @@
                   (const :tag "Don't use a toolbar" nil))
     :group 'mh-toolbar))
 
+(defun mh-buffer-exists-p (mode)
+  "Test whether a buffer with major mode MODE is present."
+  (loop for buf in (buffer-list)
+        when (save-excursion
+               (set-buffer buf)
+               (eq major-mode mode))
+        return t))
+
 (defmacro mh-tool-bar-define (defaults &rest buttons)
   "Define a tool bar for MH-E.
 DEFAULTS is the list of buttons that are present by default. It is a list of
@@ -1804,33 +1812,42 @@
        (defvar mh-letter-tool-bar-map nil)
        ;; GNU Emacs tool bar specific code
        (mh-do-in-gnu-emacs
+         ;; Tool bar initialization functions
+         (defun mh-tool-bar-folder-buttons-init ()
+           (when (mh-buffer-exists-p 'mh-folder-mode)
+             (mh-image-load-path)
+             (setq mh-folder-tool-bar-map
+                   (let ((tool-bar-map (make-sparse-keymap)))
+                     ,@(nreverse folder-button-setter)
+                     tool-bar-map))
+             (setq mh-show-tool-bar-map
+                   (let ((tool-bar-map (make-sparse-keymap)))
+                     ,@(nreverse show-button-setter)
+                     tool-bar-map))
+             (setq mh-show-seq-tool-bar-map
+                   (let ((tool-bar-map (copy-keymap mh-show-tool-bar-map)))
+                     ,@(nreverse show-seq-button-setter)
+                     tool-bar-map))
+             (setq mh-folder-seq-tool-bar-map
+                   (let ((tool-bar-map (copy-keymap mh-folder-tool-bar-map)))
+                     ,@(nreverse sequence-button-setter)
+                     tool-bar-map))))
+         (defun mh-tool-bar-letter-buttons-init ()
+           (when (mh-buffer-exists-p 'mh-letter-mode)
+             (mh-image-load-path)
+             (setq mh-letter-tool-bar-map
+                   (let ((tool-bar-map (make-sparse-keymap)))
+                     ,@(nreverse letter-button-setter)
+                     tool-bar-map))))
          ;; Custom setter functions
          (defun mh-tool-bar-folder-buttons-set (symbol value)
            "Construct toolbar for `mh-folder-mode' and `mh-show-mode'."
            (set-default symbol value)
-           (setq mh-folder-tool-bar-map
-                 (let ((tool-bar-map (make-sparse-keymap)))
-                   ,@(nreverse folder-button-setter)
-                   tool-bar-map))
-           (setq mh-show-tool-bar-map
-                 (let ((tool-bar-map (make-sparse-keymap)))
-                   ,@(nreverse show-button-setter)
-                   tool-bar-map))
-           (setq mh-show-seq-tool-bar-map
-                 (let ((tool-bar-map (copy-keymap mh-show-tool-bar-map)))
-                   ,@(nreverse show-seq-button-setter)
-                   tool-bar-map))
-           (setq mh-folder-seq-tool-bar-map
-                 (let ((tool-bar-map (copy-keymap mh-folder-tool-bar-map)))
-                   ,@(nreverse sequence-button-setter)
-                   tool-bar-map)))
+           (mh-tool-bar-folder-buttons-init))
          (defun mh-tool-bar-letter-buttons-set (symbol value)
            "Construct toolbar for `mh-letter-mode'."
            (set-default symbol value)
-           (setq mh-letter-tool-bar-map
-                 (let ((tool-bar-map (make-sparse-keymap)))
-                   ,@(nreverse letter-button-setter)
-                   tool-bar-map))))
+           (mh-tool-bar-letter-buttons-init)))
        ;; XEmacs specific code
        (mh-do-in-xemacs
          (defvar mh-toolbar-folder-vector-map
Index: emacs/lisp/mh-e/mh-e.el
diff -u emacs/lisp/mh-e/mh-e.el:1.28 emacs/lisp/mh-e/mh-e.el:1.29
--- emacs/lisp/mh-e/mh-e.el:1.28        Sun Oct 16 03:24:54 2005
+++ emacs/lisp/mh-e/mh-e.el     Sun Oct 23 22:34:33 2005
@@ -1507,6 +1507,8 @@
            (not (member 'mh-folder-mode which-func-modes)))
   (push 'mh-folder-mode which-func-modes))
 
+(defvar mh-folder-buttons-init-flag nil)
+
 ;; Autoload cookie needed by desktop.el
 ;;;###autoload
 (define-derived-mode mh-folder-mode fundamental-mode "MH-Folder"
@@ -1560,8 +1562,10 @@
 messages in that region.
 
 \\{mh-folder-mode-map}"
-
-  (mh-image-load-path)
+  (mh-do-in-gnu-emacs
+   (unless mh-folder-buttons-init-flag
+     (mh-tool-bar-folder-buttons-init)
+     (setq mh-folder-buttons-init-flag t)))
   (make-local-variable 'font-lock-defaults)
   (setq font-lock-defaults '(mh-folder-font-lock-keywords t))
   (make-local-variable 'desktop-save-buffer)
Index: emacs/lisp/mh-e/mh-identity.el
diff -u emacs/lisp/mh-e/mh-identity.el:1.16 emacs/lisp/mh-e/mh-identity.el:1.17
--- emacs/lisp/mh-e/mh-identity.el:1.16 Tue Oct 18 00:51:43 2005
+++ emacs/lisp/mh-e/mh-identity.el      Sun Oct 23 22:34:34 2005
@@ -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))




reply via email to

[Prev in Thread] Current Thread [Next in Thread]