]> code.delx.au - gnu-emacs/blobdiff - lisp/mh-e/mh-folder.el
Merge from emacs--rel--22
[gnu-emacs] / lisp / mh-e / mh-folder.el
index 5339363df199032d983cd3c3c130974028cad283..ab4be1a6c9487b58bbf31e165662608e5d0ccf19 100644 (file)
@@ -1,6 +1,6 @@
 ;;; mh-folder.el --- MH-Folder mode
 
-;; Copyright (C) 2002, 2003, 2005, 2006 Free Software Foundation, Inc.
+;; Copyright (C) 2002, 2003, 2005, 2006, 2007, 2008 Free Software Foundation, Inc.
 
 ;; Author: Bill Wohler <wohler@newt.com>
 ;; Maintainer: Bill Wohler <wohler@newt.com>
@@ -11,7 +11,7 @@
 
 ;; 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)
+;; the Free Software Foundation; either version 3, or (at your option)
 ;; any later version.
 
 ;; GNU Emacs is distributed in the hope that it will be useful,
@@ -36,8 +36,9 @@
 (require 'mh-scan)
 (mh-require-cl)
 
-;; Dynamically-created function not found in mh-loaddefs.el.
+;; Dynamically-created functions not found in mh-loaddefs.el.
 (autoload 'mh-tool-bar-folder-buttons-init "mh-tool-bar")
+(autoload 'mh-tool-bar-init "mh-tool-bar")
 
 (require 'gnus-util)
 (autoload 'message-fetch-field "message")
@@ -155,6 +156,8 @@ annotation.")
   '("Message"
     ["Show Message"                     mh-show (mh-get-msg-num nil)]
     ["Show Message with Header"         mh-header-display (mh-get-msg-num nil)]
+    ["Show Message with Preferred Alternative"
+                                        mh-show-preferred-alternative (mh-get-msg-num nil)]
     ["Next Message"                     mh-next-undeleted-msg t]
     ["Previous Message"                 mh-previous-undeleted-msg t]
     ["Go to First Message"              mh-first-msg t]
@@ -224,6 +227,7 @@ annotation.")
   "'"           mh-toggle-tick
   ","           mh-header-display
   "."           mh-alt-show
+  ":"           mh-show-preferred-alternative
   ";"           mh-toggle-mh-decode-mime-flag
   ">"           mh-write-msg-to-file
   "?"           mh-help
@@ -347,7 +351,7 @@ annotation.")
   "\M-\t"       mh-prev-button)
 
 (cond
- (mh-xemacs-flag
+ ((featurep 'xemacs)
   (define-key mh-folder-mode-map [button2] 'mh-show-mouse))
  (t
   (define-key mh-folder-mode-map [mouse-2] 'mh-show-mouse)))
@@ -509,24 +513,21 @@ font-lock is done highlighting.")
 
 (defmacro mh-remove-xemacs-horizontal-scrollbar ()
   "Get rid of the horizontal scrollbar that XEmacs insists on putting in."
-  (when mh-xemacs-flag
+  (when (featurep 'xemacs)
     `(if (and (featurep 'scrollbar)
               (fboundp 'set-specifier))
          (set-specifier horizontal-scrollbar-visible-p nil
                         (cons (current-buffer) nil)))))
 
 ;; Register mh-folder-mode as supporting which-function-mode...
-(require 'which-func nil t)
+(mh-require 'which-func nil t)
 (when (boundp 'which-func-modes)
   (add-to-list 'which-func-modes 'mh-folder-mode))
 
 ;; Shush compiler.
-(eval-when-compile
-  (defvar desktop-save-buffer)
-  (defvar font-lock-auto-fontify)
-  (mh-do-in-xemacs (defvar font-lock-defaults)))
-
-(defvar mh-folder-buttons-init-flag nil)
+(defvar desktop-save-buffer)
+(defvar font-lock-auto-fontify)
+(defvar font-lock-defaults)             ; XEmacs
 
 ;; Ensure new buffers won't get this mode if default-major-mode is nil.
 (put 'mh-folder-mode 'mode-class 'special)
@@ -589,9 +590,11 @@ perform the operation on all messages in that region.
 
 \\{mh-folder-mode-map}"
   (mh-do-in-gnu-emacs
-   (unless mh-folder-buttons-init-flag
-     (mh-tool-bar-folder-buttons-init)
-     (setq mh-folder-buttons-init-flag t)))
+    (unless mh-folder-tool-bar-map
+        (mh-tool-bar-folder-buttons-init))
+    (set (make-local-variable 'tool-bar-map) mh-folder-tool-bar-map))
+  (mh-do-in-xemacs
+    (mh-tool-bar-init :folder))
   (make-local-variable 'font-lock-defaults)
   (setq font-lock-defaults '(mh-folder-font-lock-keywords t))
   (make-local-variable 'desktop-save-buffer)
@@ -652,10 +655,8 @@ perform the operation on all messages in that region.
   (easy-menu-add mh-folder-message-menu)
   (easy-menu-add mh-folder-folder-menu)
   (mh-inc-spool-make)
-  (set (make-local-variable 'tool-bar-map) mh-folder-tool-bar-map)
-  (mh-funcall-if-exists mh-tool-bar-init :folder)
   (mh-set-help mh-folder-mode-help-messages)
-  (if (and mh-xemacs-flag
+  (if (and (featurep 'xemacs)
            font-lock-auto-fontify)
       (turn-on-font-lock)))             ; Force font-lock in XEmacs.
 
@@ -715,7 +716,7 @@ Many MH-E commands that may affect the numbering of the
 messages (such as \\[mh-rescan-folder] or \\[mh-pack-folder])
 will ask if you want to process refiles or deletes first and then
 either run this command for you or undo the pending refiles and
-deletes, which are lost.
+deletes.
 
 This function runs `mh-before-commands-processed-hook' before the
 commands are processed and `mh-after-commands-processed-hook'
@@ -1123,7 +1124,7 @@ interactive use.
 
 This command will ask if you want to process refiles or deletes first
 and then either run \\[mh-execute-commands] for you or undo the
-pending refiles and deletes, which are lost.
+pending refiles and deletes.
 
 In a program, the processing of outstanding commands is not performed
 if DONT-EXEC-PENDING is non-nil."
@@ -1497,7 +1498,7 @@ function doesn't recenter the folder buffer."
 
 (defun mh-update-unseen ()
   "Synchronize the unseen sequence with MH.
-Return non-nil iff the MH folder was set.
+Return non-nil if the MH folder was set.
 The hook `mh-unseen-updated-hook' is called after the unseen sequence
 is updated."
   (if mh-seen-list