/[emacs]/emacs/lisp/mh-e/mh-e.el
ViewVC logotype

Diff of /emacs/lisp/mh-e/mh-e.el

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 1.2.4.5 by miles, Sat Jul 17 02:51:48 2004 UTC revision 1.2.4.6 by miles, Sat Sep 4 09:22:56 2004 UTC
# Line 5  Line 5 
5    
6  ;; Author: Bill Wohler <wohler@newt.com>  ;; Author: Bill Wohler <wohler@newt.com>
7  ;; Maintainer: Bill Wohler <wohler@newt.com>  ;; Maintainer: Bill Wohler <wohler@newt.com>
8  ;; Version: 7.4.4  ;; Version: 7.4.80
9  ;; Keywords: mail  ;; Keywords: mail
10    
11  ;; This file is part of GNU Emacs.  ;; This file is part of GNU Emacs.
# Line 75  Line 75 
75    
76  ;; Original version for Gosling emacs by Brian Reid, Stanford, 1982.  ;; Original version for Gosling emacs by Brian Reid, Stanford, 1982.
77  ;; Modified by James Larus, BBN, July 1984 and UCB, 1984 & 1985.  ;; Modified by James Larus, BBN, July 1984 and UCB, 1984 & 1985.
78  ;; Rewritten for GNU Emacs, James Larus 1985.  larus@ginger.berkeley.edu  ;; Rewritten for GNU Emacs, James Larus, 1985.
79  ;; Modified by Stephen Gildea 1988.  gildea@lcs.mit.edu  ;; Modified by Stephen Gildea, 1988.
80  ;; Maintenance picked up by Bill Wohler <wohler@newt.com> and the  ;; Maintenance picked up by Bill Wohler and the
81  ;; SourceForge Crew <http://mh-e.sourceforge.net/>. 2001.  ;; SourceForge Crew <http://mh-e.sourceforge.net/>, 2001.
82    
83  ;;; Code:  ;;; Code:
84    
85  (provide 'mh-e)  (provide 'mh-e)
 (require 'mh-utils)  
 (mh-require-cl)  
   
 (defvar recursive-load-depth-limit)  
 (eval-when (compile load eval)  
   (if (and (boundp 'recursive-load-depth-limit)  
            (integerp recursive-load-depth-limit)  
            (> 50 recursive-load-depth-limit))  
       (setq recursive-load-depth-limit 50)))  
86    
87    (eval-when-compile (require 'mh-acros))
88    (mh-require-cl)
89    (require 'mh-utils)
90    (require 'mh-init)
91  (require 'mh-inc)  (require 'mh-inc)
92  (require 'gnus-util)  (require 'gnus-util)
93  (require 'easymenu)  (require 'easymenu)
# Line 101  Line 96 
96  (defvar font-lock-auto-fontify)  (defvar font-lock-auto-fontify)
97  (defvar font-lock-defaults)  (defvar font-lock-defaults)
98    
99  (defconst mh-version "7.4.4" "Version number of MH-E.")  (defconst mh-version "7.4.80" "Version number of MH-E.")
100    
101  ;;; Autoloads  ;;; Autoloads
102  (autoload 'Info-goto-node "info")  (autoload 'Info-goto-node "info")
103    
   
   
 (defvar mh-note-deleted "D"  
   "String whose first character is used to notate deleted messages.")  
   
 (defvar mh-note-refiled "^"  
   "String whose first character is used to notate refiled messages.")  
   
 (defvar mh-note-cur "+"  
   "String whose first character is used to notate the current message.")  
   
104  (defvar mh-partial-folder-mode-line-annotation "select"  (defvar mh-partial-folder-mode-line-annotation "select"
105    "Annotation when displaying part of a folder.    "Annotation when displaying part of a folder.
106  The string is displayed after the folder's name.  nil for no annotation.")  The string is displayed after the folder's name.  nil for no annotation.")
107    
108    
109    ;;; Scan Line Formats
110    
111  ;;; Parameterize MH-E to work with different scan formats.  The defaults work  ;;; Parameterize MH-E to work with different scan formats.  The defaults work
112  ;;; with the standard MH scan listings, in which the first 4 characters on  ;;; with the standard MH scan listings, in which the first 4 characters on
113  ;;; the line are the message number, followed by two places for notations.  ;;; the line are the message number, followed by two places for notations.
114    
115  ;; The following scan formats are passed to the scan program if the  ;; The following scan formats are passed to the scan program if the setting of
116  ;; setting of `mh-scan-format-file' above is nil.  They are identical  ;; `mh-scan-format-file' is t. They are identical except the later one makes
117  ;; except the later one makes use of the nmh `decode' function to  ;; use of the nmh `decode' function to decode RFC 2047 encodings. If you just
118  ;; decode RFC 2047 encodings. If you just want to change the width of  ;; want to change the width of the msg number, use the `mh-set-cmd-note'
119  ;; the msg number, use the `mh-set-cmd-note' function.  ;; function.
120    
121  (defvar mh-scan-format-mh  (defvar mh-scan-format-mh
122    (concat    (concat
# Line 150  This format is identical to the default Line 137  This format is identical to the default
137  fontification have been added to the fifth column (remember that in Emacs, the  fontification have been added to the fifth column (remember that in Emacs, the
138  first column is 0).  first column is 0).
139    
140  The values of the fifth column, in priority order, are: `-' if the  The values of the fifth column, in priority order, are: `-' if the message has
141  message has been replied to, t if an address on the To: line matches  been replied to, t if an address on the To: line matches one of the
142  one of the mailboxes of the current user, `c' if the Cc: line matches,  mailboxes of the current user, `c' if the Cc: line matches, `b' if the Bcc:
143  `b' if the Bcc: line matches, and `n' if a non-empty Newsgroups: header  line matches, and `n' if a non-empty Newsgroups: header is present.")
 is present.")  
144    
145  (defvar mh-scan-format-nmh  (defvar mh-scan-format-nmh
146    (concat    (concat
# Line 176  This format is identical to the default Line 162  This format is identical to the default
162  fontification have been added to the fifth column (remember that in Emacs, the  fontification have been added to the fifth column (remember that in Emacs, the
163  first column is 0).  first column is 0).
164    
165  The values of the fifth column, in priority order, are: `-' if the  The values of the fifth column, in priority order, are: `-' if the message has
166  message has been replied to, t if an address on the To: line matches  been replied to, t if an address on the To: field matches one of the
167  one of the mailboxes of the current user, `c' if the Cc: line matches,  mailboxes of the current user, `c' if the Cc: field matches, `b' if the Bcc:
168  `b' if the Bcc: line matches, and `n' if a non-empty Newsgroups: header  field matches, and `n' if a non-empty Newsgroups: field is present.")
169  is present.")  
170    (defvar mh-note-deleted ?D
171      "Deleted messages are marked by this character.
172    See also `mh-scan-deleted-msg-regexp'.")
173    
174    (defvar mh-note-refiled ?^
175      "Refiled messages are marked by this character.
176    See also `mh-scan-refiled-msg-regexp'.")
177    
178    (defvar mh-note-cur ?+
179      "The current message (in MH) is marked by this character.
180    See also `mh-scan-cur-msg-number-regexp'.")
181    
182  (defvar mh-scan-good-msg-regexp  "^\\( *[0-9]+\\)[^D^0-9]"  (defvar mh-scan-good-msg-regexp  "^\\( *[0-9]+\\)[^D^0-9]"
183    "Regexp specifying the scan lines that are 'good' messages.    "This regexp specifies the scan lines that are 'good' messages.
184  The default `mh-folder-font-lock-keywords' expects this expression to contain  Note that the default setting of `mh-folder-font-lock-keywords' expects this
185  at least one parenthesized expression which matches the message number.")  expression to contain at least one parenthesized expression which matches the
186    message number as in the default of \"^\\\\( *[0-9]+\\\\)[^D^0-9]\".")
187    
188  (defvar mh-scan-deleted-msg-regexp "^\\( *[0-9]+\\)D"  (defvar mh-scan-deleted-msg-regexp "^\\( *[0-9]+\\)D"
189    "Regexp matching scan lines of deleted messages.    "This regexp matches deleted messages.
190  The default `mh-folder-font-lock-keywords' expects this expression to contain  Note that the default setting of `mh-folder-font-lock-keywords' expects this
191  at least one parenthesized expression which matches the message number.")  expression to contain at least one parenthesized expression which matches the
192    message number as in the default of \"^\\\\( *[0-9]+\\\\)D\".
193    See also `mh-note-deleted'.")
194    
195  (defvar mh-scan-refiled-msg-regexp  "^\\( *[0-9]+\\)\\^"  (defvar mh-scan-refiled-msg-regexp  "^\\( *[0-9]+\\)\\^"
196    "Regexp matching scan lines of refiled messages.    "This regexp matches refiled messages.
197  The default `mh-folder-font-lock-keywords' expects this expression to contain  Note that the default setting of `mh-folder-font-lock-keywords' expects this
198  at least one parenthesized expression which matches the message number.")  expression to contain at least one parenthesized expression which matches the
199    message number as in the default of \"^\\\\( *[0-9]+\\\\)\\\\^\".
200    See also `mh-note-refiled'.")
201    
202  (defvar mh-scan-valid-regexp "^ *[0-9]"  (defvar mh-scan-valid-regexp "^ *[0-9]"
203    "Regexp matching scan lines for messages (not error messages).")    "This regexp matches scan lines for messages (not error messages).")
204    
205  (defvar mh-scan-cur-msg-number-regexp "^\\( *[0-9]+\\+\\).*"  (defvar mh-scan-cur-msg-number-regexp "^\\( *[0-9]+\\+\\).*"
206    "Regexp matching scan line for the current message.    "This regexp matches the current message.
207  The default `mh-folder-font-lock-keywords' expects this expression to contain  Note that the default setting of `mh-folder-font-lock-keywords' expects this
208  at least one parenthesized expression which matches the message number.  expression to contain at least one parenthesized expression which matches the
209  Don't disable this regexp as it's needed by non fontifying functions.")  message number as in the default of \"^\\\\( *[0-9]+\\\\+\\\\).*\". Don't
210    disable this regexp as it's needed by non-fontifying functions.
211  (defvar mh-scan-cur-msg-regexp "^\\( *[0-9]+\\+DISABLED.*\\)"  See also `mh-note-cur'.")
   "Regexp matching scan line for the current message.  
 The default `mh-folder-font-lock-keywords' expects this expression to contain  
 at least one parenthesized expression which matches the whole line.  
 To enable this feature, remove the string DISABLED from the regexp.")  
212    
213  (defvar mh-scan-date-regexp "\\([0-9][0-9]/[0-9][0-9]\\)"  (defvar mh-scan-date-regexp "\\([0-9][0-9]/[0-9][0-9]\\)"
214    "Regexp matching a valid date in scan lines.    "This regexp matches a valid date.
215  The default `mh-folder-font-lock-keywords' expects this expression to contain  Note that the default setting of `mh-folder-font-lock-keywords' expects this
216  only one parenthesized expression which matches the date field  expression to contain only one parenthesized expression which matches the date
217  \(see `mh-scan-format-regexp').")  field as in the default of \"\\\\([0-9][0-9]/[0-9][0-9]\\\\)\"}.
218    See also `mh-scan-format-regexp'.")
219    
220  (defvar mh-scan-rcpt-regexp  "\\(To:\\)\\(..............\\)"  (defvar mh-scan-rcpt-regexp  "\\(To:\\)\\(..............\\)"
221    "Regexp specifying the recipient in scan lines for messages we sent.    "This regexp specifies the recipient in messages you sent.
222  The default `mh-folder-font-lock-keywords' expects this expression to contain  Note that the default setting of `mh-folder-font-lock-keywords'
223  two parenthesized expressions.  The first is expected to match the To:  expects this expression to contain two parenthesized expressions. The
224  that the default scan format file generates.  The second is expected to match  first is expected to match the `To:' that the default scan format
225  the recipient's name.")  file generates. The second is expected to match the recipient's name
226    as in the default of \"\\\\(To:\\\\)\\\\(..............\\\\)\".")
227    
228  (defvar mh-scan-body-regexp "\\(<<\\([^\n]+\\)?\\)"  (defvar mh-scan-body-regexp "\\(<<\\([^\n]+\\)?\\)"
229    "Regexp matching the message body beginning displayed in scan lines.    "This regexp matches the message body fragment displayed in scan lines.
230  The default `mh-folder-font-lock-keywords' expects this expression to contain  Note that the default setting of `mh-folder-font-lock-keywords' expects this
231  at least one parenthesized expression which matches the body text.")  expression to contain at least one parenthesized expression which matches the
232    body text as in the default of \"\\\\(<<\\\\([^\\n]+\\\\)?\\\\)\".")
233    
234  (defvar mh-scan-subject-regexp  (defvar mh-scan-subject-regexp
   ;;"^ *[0-9]+........[ ]*...................\\([Rr][Ee]:\\s-*\\)*\\([^<\n]*\\)"  
235    "^ *[0-9]+........[ ]*...................\\([Rr][Ee]\\(\\[[0-9]+\\]\\)?:\\s-*\\)*\\([^<\n]*\\)"    "^ *[0-9]+........[ ]*...................\\([Rr][Ee]\\(\\[[0-9]+\\]\\)?:\\s-*\\)*\\([^<\n]*\\)"
236    "*Regexp matching the subject string in MH folder mode.    "This regexp matches the subject.
237  The default `mh-folder-font-lock-keywords' expects this expression to contain  Note that the default setting of `mh-folder-font-lock-keywords' expects this
238  at least tree parenthesized expressions. The first is expected to match the Re:  expression to contain at least three parenthesized expressions. The first is
239  string, if any. The second matches an optional bracketed number after Re,  expected to match the `Re:' string, if any. The second matches an optional
240  such as in Re[2]: and the third is expected to match the subject line itself.")  bracketed number after `Re:', such as in `Re[2]:' (and is thus a
241    sub-expression of the first expression) and the third is expected to match
242    the subject line itself as in the default of \"^ *[0-9]+........[ ]*...................\\\\([Rr][Ee]\\\\(\\\\\\=[[0-9]+\\\\]\\\\)?:\\\\s-*\\\\)*\\\\([^<\\n]*\\\\)\".")
243    
244  (defvar mh-scan-format-regexp  (defvar mh-scan-format-regexp
245    (concat "\\([bct]\\)" mh-scan-date-regexp " *\\(..................\\)")    (concat "\\([bct]\\)" mh-scan-date-regexp " *\\(..................\\)")
246    "Regexp matching the output of scan.    "This regexp matches the output of scan.
247  The default value is based upon the default values of either  Note that the default setting of `mh-folder-font-lock-keywords' expects this
248  `mh-scan-format-mh' or `mh-scan-format-nmh'.  expression to contain at least three parenthesized expressions. The first
249  The default `mh-folder-font-lock-keywords' expects this expression to contain  should match the fontification hint, the second is found in
250  at least three parenthesized expressions. The first should match the  `mh-scan-date-regexp', and the third should match the user name as in the
251  fontification hint, the second is found in `mh-scan-date-regexp', and the  default of \"(concat \"\\\\([bct]\\\\)\" mh-scan-date-regexp
252  third should match the user name.")                       \"*\\\\(..................\\\\)\")\".")
253    
254    
255    
# Line 279  third should match the user name.") Line 281  third should match the user name.")
281     ;; scan font-lock name     ;; scan font-lock name
282     (list mh-scan-format-regexp     (list mh-scan-format-regexp
283           '(1 mh-folder-date-face)           '(1 mh-folder-date-face)
284           '(3 mh-folder-scan-format-face))           '(3 mh-folder-scan-format-face)))
    ;; Current message line  
    (list mh-scan-cur-msg-regexp  
          '(1 mh-folder-cur-msg-face prepend t)))  
285    "Regexp keywords used to fontify the MH-Folder buffer.")    "Regexp keywords used to fontify the MH-Folder buffer.")
286    
287  (defvar mh-scan-cmd-note-width 1  (defvar mh-scan-cmd-note-width 1
# Line 356  This column will only ever have spaces i Line 355  This column will only ever have spaces i
355    
356  ;; Fontifify unseen mesages in bold.  ;; Fontifify unseen mesages in bold.
357    
 (defvar mh-folder-unseen-seq-name nil  
   "Name of unseen sequence.  
 The default for this is provided by the function `mh-folder-unseen-seq-name'  
 On nmh systems.")  
   
 (defun mh-folder-unseen-seq-name ()  
   "Provide name of unseen sequence from mhparam."  
   (or mh-progs (mh-find-path))  
   (save-excursion  
     (let ((unseen-seq-name "unseen"))  
       (with-temp-buffer  
         (unwind-protect  
             (progn  
               (call-process (expand-file-name "mhparam" mh-progs)  
                             nil '(t t) nil "-component" "Unseen-Sequence")  
               (goto-char (point-min))  
               (if (re-search-forward "Unseen-Sequence: \\(.*\\)$" nil t)  
                   (setq unseen-seq-name (match-string 1))))))  
       unseen-seq-name)))  
   
 (defun mh-folder-unseen-seq-list ()  
   "Return a list of unseen message numbers for current folder."  
   (if (not mh-folder-unseen-seq-name)  
       (setq mh-folder-unseen-seq-name (mh-folder-unseen-seq-name)))  
   (cond  
    ((not mh-folder-unseen-seq-name)  
     nil)  
    (t  
     (let ((folder mh-current-folder))  
       (save-excursion  
         (with-temp-buffer  
           (unwind-protect  
               (progn  
                 (call-process (expand-file-name "mark" mh-progs)  
                               nil '(t t) nil  
                               folder "-seq" mh-folder-unseen-seq-name  
                               "-list")  
                 (goto-char (point-min))  
                 (sort (mh-read-msg-list) '<)))))))))  
   
358  (defmacro mh-generate-sequence-font-lock (seq prefix face)  (defmacro mh-generate-sequence-font-lock (seq prefix face)
359    "Generate the appropriate code to fontify messages in SEQ.    "Generate the appropriate code to fontify messages in SEQ.
360  PREFIX is used to generate unique names for the variables and functions  PREFIX is used to generate unique names for the variables and functions
# Line 492  is done highlighting.") Line 451  is done highlighting.")
451                                          ;Rememeber original notation that                                          ;Rememeber original notation that
452                                          ;is overwritten by `mh-note-seq'.                                          ;is overwritten by `mh-note-seq'.
453    
454    (defvar mh-colors-available-flag nil)   ;Are colors available?
455    
456  ;;; Macros and generic functions:  ;;; Macros and generic functions:
457    
458  (defun mh-mapc (function list)  (defun mh-mapc (function list)
# Line 503  is done highlighting.") Line 464  is done highlighting.")
464  (defun mh-scan-format ()  (defun mh-scan-format ()
465    "Return the output format argument for the scan program."    "Return the output format argument for the scan program."
466    (if (equal mh-scan-format-file t)    (if (equal mh-scan-format-file t)
467        (list "-format" (if mh-nmh-flag        (list "-format" (if (mh-variant-p 'nmh 'mu-mh)
468                            (list (mh-update-scan-format                            (list (mh-update-scan-format
469                                   mh-scan-format-nmh mh-cmd-note))                                   mh-scan-format-nmh mh-cmd-note))
470                          (list (mh-update-scan-format                          (list (mh-update-scan-format
# Line 519  is done highlighting.") Line 480  is done highlighting.")
480  (defun mh-rmail (&optional arg)  (defun mh-rmail (&optional arg)
481    "Inc(orporate) new mail with MH.    "Inc(orporate) new mail with MH.
482  Scan an MH folder if ARG is non-nil. This function is an entry point to MH-E,  Scan an MH folder if ARG is non-nil. This function is an entry point to MH-E,
483  the Emacs front end to the MH mail system."  the Emacs interface to the MH mail system."
484    (interactive "P")    (interactive "P")
485    (mh-find-path)    (mh-find-path)
486    (if arg    (if arg
# Line 532  the Emacs front end to the MH mail syste Line 493  the Emacs front end to the MH mail syste
493  (defun mh-nmail (&optional arg)  (defun mh-nmail (&optional arg)
494    "Check for new mail in inbox folder.    "Check for new mail in inbox folder.
495  Scan an MH folder if ARG is non-nil. This function is an entry point to MH-E,  Scan an MH folder if ARG is non-nil. This function is an entry point to MH-E,
496  the Emacs front end to the MH mail system."  the Emacs interface to the MH mail system."
497    (interactive "P")    (interactive "P")
498    (mh-find-path)                        ; init mh-inbox    (mh-find-path)                        ; init mh-inbox
499    (if arg    (if arg
# Line 616  Do not call this function from outside M Line 577  Do not call this function from outside M
577        (setq folder mh-inbox))        (setq folder mh-inbox))
578    (let ((threading-needed-flag nil))    (let ((threading-needed-flag nil))
579      (let ((config (current-window-configuration)))      (let ((config (current-window-configuration)))
580          (delete-other-windows)
581        (cond ((not (get-buffer folder))        (cond ((not (get-buffer folder))
582               (mh-make-folder folder)               (mh-make-folder folder)
583               (setq threading-needed-flag mh-show-threads-flag)               (setq threading-needed-flag mh-show-threads-flag)
# Line 659  last undeleted message then pause for a Line 621  last undeleted message then pause for a
621             (if wait-after-complaining-flag (sit-for 1)))))             (if wait-after-complaining-flag (sit-for 1)))))
622    
623  (defun mh-folder-from-address ()  (defun mh-folder-from-address ()
624    "Determine folder name from address in From field.    "Derive folder name from sender.
 Takes the address in the From: header field, and returns one of:  
625    
626    a) The folder name associated with the address in the alist  The name of the folder is derived as follows:
      `mh-default-folder-list'.  If the `Check Recipient' boolean  
       is set, then the `mh-default-folder-list' addresses are  
       checked against the recipient instead of the originator  
       (making possible to use this feature for mailing lists).  
       The first match found in `mh-default-folder-list' is used.  
627    
628    b) The address' corresponding alias from the user's personal    a) The folder name associated with the first address found in the list
629       aliases file prefixed by `mh-default-folder-prefix'.       `mh-default-folder-list' is used. Each element in this list contains a
630         `Check Recipient' item. If this item is turned on, then the address is
631         checked against the recipient instead of the sender. This is useful for
632         mailing lists.
633    
634      b) An alias prefixed by `mh-default-folder-prefix' corresponding to the
635         address is used. The prefix is used to prevent clutter in your mail
636         directory.
637    
638  Returns nil if the address was not found in either place or if the variable  Return nil if a folder name was not derived, or if the variable
639  `mh-default-folder-must-exist-flag' is nil and the folder does not exist."  `mh-default-folder-must-exist-flag' is t and the folder does not exist."
640    ;; Loop for all entries in mh-default-folder-list    ;; Loop for all entries in mh-default-folder-list
641    (save-restriction    (save-restriction
642      (goto-char (point-min))      (goto-char (point-min))
643      (re-search-forward "\n\n" nil t)      (re-search-forward "\n\n" nil 'limit)
644      (narrow-to-region (point-min) (point))      (narrow-to-region (point-min) (point))
645      (let ((to/cc (concat (or (message-fetch-field "to") "") ", "      (let ((to/cc (concat (or (message-fetch-field "to") "") ", "
646                           (or (message-fetch-field "cc") "")))                           (or (message-fetch-field "cc") "")))
# Line 715  Returns nil if the address was not found Line 678  Returns nil if the address was not found
678    "Prompt the user for a folder in which the message should be filed.    "Prompt the user for a folder in which the message should be filed.
679  The folder is returned as a string.  The folder is returned as a string.
680    
681  If `mh-default-folder-for-message-function' is a function then the message  The default folder name is generated by the option
682  being refiled is yanked into a temporary buffer and the function is called to  `mh-default-folder-for-message-function' if it is non-nil or
683  intelligently guess where the message is to be refiled.  `mh-folder-from-address'."
   
 Otherwise, a default folder name is generated by `mh-folder-from-address'."  
684    (mh-prompt-for-folder    (mh-prompt-for-folder
685     "Destination"     "Destination"
686     (let ((refile-file (mh-msg-filename (mh-get-msg-num t))))     (let ((refile-file (ignore-errors (mh-msg-filename (mh-get-msg-num t)))))
687       (save-excursion       (if (null refile-file) ""
688         (set-buffer (get-buffer-create mh-temp-buffer))         (save-excursion
689         (erase-buffer)           (set-buffer (get-buffer-create mh-temp-buffer))
690         (insert-file-contents refile-file)           (erase-buffer)
691         (or (and mh-default-folder-for-message-function           (insert-file-contents refile-file)
692                  (let ((buffer-file-name refile-file))           (or (and mh-default-folder-for-message-function
693                    (funcall mh-default-folder-for-message-function)))                    (let ((buffer-file-name refile-file))
694             (mh-folder-from-address)                      (funcall mh-default-folder-for-message-function)))
695             (and (eq 'refile (car mh-last-destination-folder))               (mh-folder-from-address)
696                  (symbol-name (cdr mh-last-destination-folder)))               (and (eq 'refile (car mh-last-destination-folder))
697             "")))                    (symbol-name (cdr mh-last-destination-folder)))
698                 ""))))
699     t))     t))
700    
701  (defun mh-refile-msg (range folder &optional dont-update-last-destination-flag)  (defun mh-refile-msg (range folder &optional dont-update-last-destination-flag)
# Line 872  are skipped." Line 834  are skipped."
834                 (setq count (1- count)))                 (setq count (1- count)))
835               (not (car unread-sequence)))               (not (car unread-sequence)))
836             (message "No more unread messages"))             (message "No more unread messages"))
837            (t (mh-goto-msg (car unread-sequence))))))            (t (loop for msg in unread-sequence
838                       when (mh-goto-msg msg t) return nil
839                       finally (message "No more unread messages"))))))
840    
841  (defun mh-goto-next-button (backward-flag &optional criterion)  (defun mh-goto-next-button (backward-flag &optional criterion)
842    "Search for next button satisfying criterion.    "Search for next button satisfying criterion.
# Line 1090  interactive use." Line 1054  interactive use."
1054    (if (not (mh-outstanding-commands-p))    (if (not (mh-outstanding-commands-p))
1055        (mh-set-folder-modified-p nil)))        (mh-set-folder-modified-p nil)))
1056    
1057  ;;;###mh-autoload  
1058  (defun mh-folder-line-matches-show-buffer-p ()  (defun mh-folder-line-matches-show-buffer-p ()
1059    "Return t if the message under point in folder-mode is in the show buffer.    "Return t if the message under point in folder-mode is in the show buffer.
1060  Return nil in any other circumstance (no message under point, no show buffer,  Return nil in any other circumstance (no message under point, no show buffer,
# Line 1123  compiled then macro expansion happens at Line 1087  compiled then macro expansion happens at
1087  (defun mh-version ()  (defun mh-version ()
1088    "Display version information about MH-E and the MH mail handling system."    "Display version information about MH-E and the MH mail handling system."
1089    (interactive)    (interactive)
   (mh-find-progs)  
1090    (set-buffer (get-buffer-create mh-info-buffer))    (set-buffer (get-buffer-create mh-info-buffer))
1091    (erase-buffer)    (erase-buffer)
1092    ;; MH-E version.    ;; MH-E version.
# Line 1140  compiled then macro expansion happens at Line 1103  compiled then macro expansion happens at
1103    ;; Emacs version.    ;; Emacs version.
1104    (insert (emacs-version) "\n\n")    (insert (emacs-version) "\n\n")
1105    ;; MH version.    ;; MH version.
1106    (let ((help-start (point)))    (if mh-variant-in-use
1107      (condition-case err-data        (insert mh-variant-in-use "\n"
1108          (mh-exec-cmd-output "inc" nil (if mh-nmh-flag "-version" "-help"))                " mh-progs:\t" mh-progs "\n"
1109        (file-error (insert (mapconcat 'concat (cdr err-data) ": ") "\n")))                " mh-lib:\t" mh-lib "\n"
1110      (goto-char help-start)                " mh-lib-progs:\t" mh-lib-progs "\n\n")
1111      (if mh-nmh-flag      (insert "No MH variant detected\n"))
         (search-forward "inc -- " nil t)  
       (search-forward "version: " nil t))  
     (delete-region help-start (point)))  
   (goto-char (point-max))  
   (insert " mh-progs:\t" mh-progs "\n"  
           " mh-lib:\t" mh-lib "\n"  
           " mh-lib-progs:\t" mh-lib-progs "\n\n")  
1112    ;; Linux version.    ;; Linux version.
1113    (condition-case ()    (condition-case ()
1114        (call-process "uname" nil t nil "-a")        (call-process "uname" nil t nil "-a")
# Line 1202  used to avoid problems in corner cases i Line 1158  used to avoid problems in corner cases i
1158  (defun mh-folder-size-flist (folder)  (defun mh-folder-size-flist (folder)
1159    "Find size of FOLDER using `flist'."    "Find size of FOLDER using `flist'."
1160    (with-temp-buffer    (with-temp-buffer
1161      (call-process (expand-file-name "flist" mh-progs) nil t nil      (call-process (expand-file-name "flist" mh-progs) nil t nil "-showzero"
1162                    "-norecurse" folder "-sequence" (symbol-name mh-unseen-seq))                    "-norecurse" folder "-sequence" (symbol-name mh-unseen-seq))
1163      (goto-char (point-min))      (goto-char (point-min))
1164      (multiple-value-bind (folder unseen total)      (multiple-value-bind (folder unseen total)
# Line 1236  regardless of the size of the `mh-large- Line 1192  regardless of the size of the `mh-large-
1192    (let ((config (current-window-configuration))    (let ((config (current-window-configuration))
1193          (current-buffer (current-buffer))          (current-buffer (current-buffer))
1194          (threaded-view-flag mh-show-threads-flag))          (threaded-view-flag mh-show-threads-flag))
1195        (delete-other-windows)
1196      (save-excursion      (save-excursion
1197        (when (get-buffer folder)        (when (get-buffer folder)
1198          (set-buffer folder)          (set-buffer folder)
# Line 1258  regardless of the size of the `mh-large- Line 1215  regardless of the size of the `mh-large-
1215             (mh-toggle-threads))             (mh-toggle-threads))
1216            (mh-index-data            (mh-index-data
1217             (mh-index-insert-folder-headers)))             (mh-index-insert-folder-headers)))
     (unless mh-showing-mode (delete-other-windows))  
1218      (unless (eq current-buffer (current-buffer))      (unless (eq current-buffer (current-buffer))
1219        (setq mh-previous-window-config config)))        (setq mh-previous-window-config config)))
1220    nil)    nil)
1221    
1222  ;;;###mh-autoload  
1223  (defun mh-update-sequences ()  (defun mh-update-sequences ()
1224    "Update MH's Unseen-Sequence and current folder and message.    "Update MH's Unseen-Sequence and current folder and message.
1225  Flush MH-E's state out to MH. The message at the cursor becomes current."  Flush MH-E's state out to MH. The message at the cursor becomes current."
# Line 1334  arguments, after the message has been re Line 1290  arguments, after the message has been re
1290                 (mh-exec-cmd "refile" (mh-get-msg-num t) "-link"                 (mh-exec-cmd "refile" (mh-get-msg-num t) "-link"
1291                              "-src" mh-current-folder                              "-src" mh-current-folder
1292                              (symbol-name folder))                              (symbol-name folder))
1293               (message "Message not copied.")))               (message "Message not copied")))
1294            (t            (t
1295             (mh-set-folder-modified-p t)             (mh-set-folder-modified-p t)
1296             (cond ((null (assoc folder mh-refile-list))             (cond ((null (assoc folder mh-refile-list))
# Line 1381  With optional argument COUNT, COUNT-1 un Line 1337  With optional argument COUNT, COUNT-1 un
1337                 (setq count (1- count)))                 (setq count (1- count)))
1338               (not (car unread-sequence)))               (not (car unread-sequence)))
1339             (message "No more unread messages"))             (message "No more unread messages"))
1340            (t (mh-goto-msg (car unread-sequence))))))            (t (loop for msg in unread-sequence
1341                       when (mh-goto-msg msg t) return nil
1342                       finally (message "No more unread messages"))))))
1343    
1344  (defun mh-set-scan-mode ()  (defun mh-set-scan-mode ()
1345    "Display the scan listing buffer, but do not show a message."    "Display the scan listing buffer, but do not show a message."
# Line 1472  Make it the current folder." Line 1430  Make it the current folder."
1430      ["Go to First Message"              mh-first-msg t]      ["Go to First Message"              mh-first-msg t]
1431      ["Go to Last Message"               mh-last-msg t]      ["Go to Last Message"               mh-last-msg t]
1432      ["Go to Message by Number..."       mh-goto-msg t]      ["Go to Message by Number..."       mh-goto-msg t]
1433      ["Modify Message"                   mh-modify]      ["Modify Message"                   mh-modify t]
1434      ["Delete Message"                   mh-delete-msg (mh-get-msg-num nil)]      ["Delete Message"                   mh-delete-msg (mh-get-msg-num nil)]
1435      ["Refile Message"                   mh-refile-msg (mh-get-msg-num nil)]      ["Refile Message"                   mh-refile-msg (mh-get-msg-num nil)]
1436      ["Undo Delete/Refile"               mh-undo t]      ["Undo Delete/Refile"               mh-undo (mh-outstanding-commands-p)]
1437      ["Process Delete/Refile"            mh-execute-commands      ["Execute Delete/Refile"            mh-execute-commands
1438       (or mh-refile-list mh-delete-list)]       (mh-outstanding-commands-p)]
1439      "--"      "--"
1440      ["Compose a New Message"            mh-send t]      ["Compose a New Message"            mh-send t]
1441      ["Reply to Message..."              mh-reply (mh-get-msg-num nil)]      ["Reply to Message..."              mh-reply (mh-get-msg-num nil)]
# Line 1501  Make it the current folder." Line 1459  Make it the current folder."
1459      ["Incorporate New Mail"             mh-inc-folder t]      ["Incorporate New Mail"             mh-inc-folder t]
1460      ["Toggle Show/Folder"               mh-toggle-showing t]      ["Toggle Show/Folder"               mh-toggle-showing t]
1461      ["Execute Delete/Refile"            mh-execute-commands      ["Execute Delete/Refile"            mh-execute-commands
1462       (or mh-refile-list mh-delete-list)]       (mh-outstanding-commands-p)]
1463      ["Rescan Folder"                    mh-rescan-folder t]      ["Rescan Folder"                    mh-rescan-folder t]
1464      ["Thread Folder"                    mh-toggle-threads      ["Thread Folder"                    mh-toggle-threads
1465       (not (memq 'unthread mh-view-ops))]       (not (memq 'unthread mh-view-ops))]
# Line 1541  is used in previous versions and XEmacs. Line 1499  is used in previous versions and XEmacs.
1499    (defvar tool-bar-map)    (defvar tool-bar-map)
1500    (defvar desktop-save-buffer))         ;Emacs 21.4    (defvar desktop-save-buffer))         ;Emacs 21.4
1501    
1502    ;; Register mh-folder-mode as supporting which-function-mode...
1503    (load "which-func" t t)
1504    (when (and (boundp 'which-func-modes)
1505               (not (member 'mh-folder-mode which-func-modes)))
1506      (push 'mh-folder-mode which-func-modes))
1507    
1508  (define-derived-mode mh-folder-mode fundamental-mode "MH-Folder"  (define-derived-mode mh-folder-mode fundamental-mode "MH-Folder"
1509    "Major MH-E mode for \"editing\" an MH folder scan listing.\\<mh-folder-mode-map>    "Major MH-E mode for \"editing\" an MH folder scan listing.\\<mh-folder-mode-map>
1510    
# Line 1548  You can show the message the cursor is p Line 1512  You can show the message the cursor is p
1512  messages.  Messages can be marked for deletion or refiling into another  messages.  Messages can be marked for deletion or refiling into another
1513  folder; these commands are executed all at once with a separate command.  folder; these commands are executed all at once with a separate command.
1514    
 A prefix argument (\\[universal-argument]) to delete, refile, list, or undo  
 applies the action to a message sequence. If `transient-mark-mode',  
 is non-nil, the action is applied to the region.  
   
1515  Options that control this mode can be changed with \\[customize-group];  Options that control this mode can be changed with \\[customize-group];
1516  specify the \"mh\" group. In particular, please see the `mh-scan-format-file'  specify the \"mh\" group. In particular, please see the `mh-scan-format-file'
1517  option if you wish to modify scan's format.  option if you wish to modify scan's format.
1518    
1519  When a folder is visited, the hook `mh-folder-mode-hook' is run.  When a folder is visited, the hook `mh-folder-mode-hook' is run.
1520    
1521    Ranges
1522    ======
1523    Many commands that operate on individual messages, such as `mh-forward' or
1524    `mh-refile-msg' take a RANGE argument. This argument can be used in several
1525    ways.
1526    
1527    If you provide the prefix argument (\\[universal-argument]) to these commands,
1528    then you will be prompted for the message range. This can be any legal MH
1529    range which can include messages, sequences, and the abbreviations (described
1530    in the mh(1) man page):
1531    
1532    <num1>-<num2>
1533        Indicates all messages in the range <num1> to <num2>, inclusive. The range
1534        must be nonempty.
1535    
1536    `<num>:N'
1537    `<num>:+N'
1538    `<num>:-N'
1539        Up to N messages beginning with (or ending with) message num. Num may be
1540        any of the pre-defined symbols: first, prev, cur, next or last.
1541    
1542    `first:N'
1543    `prev:N'
1544    `next:N'
1545    `last:N'
1546        The first, previous, next or last messages, if they exist.
1547    
1548    `all'
1549        All of the messages.
1550    
1551    For example, a range that shows all of these things is `1 2 3 5-10 last:5
1552    unseen'.
1553    
1554    If the option `transient-mark-mode' is set to t and you set a region in the
1555    MH-Folder buffer, then the MH-E command will perform the operation on all
1556    messages in that region.
1557    
1558  \\{mh-folder-mode-map}"  \\{mh-folder-mode-map}"
1559    
1560    (make-local-variable 'font-lock-defaults)    (make-local-variable 'font-lock-defaults)
# Line 1565  When a folder is visited, the hook `mh-f Line 1562  When a folder is visited, the hook `mh-f
1562    (make-local-variable 'desktop-save-buffer)    (make-local-variable 'desktop-save-buffer)
1563    (setq desktop-save-buffer t)    (setq desktop-save-buffer t)
1564    (mh-make-local-vars    (mh-make-local-vars
1565       'mh-colors-available-flag (mh-colors-available-p)
1566                                            ; Do we have colors available
1567     'mh-current-folder (buffer-name)     ; Name of folder, a string     'mh-current-folder (buffer-name)     ; Name of folder, a string
1568     'mh-show-buffer (format "show-%s" (buffer-name)) ; Buffer that displays msgs     'mh-show-buffer (format "show-%s" (buffer-name)) ; Buffer that displays msgs
1569     'mh-folder-filename                  ; e.g. "/usr/foobar/Mail/inbox/"     'mh-folder-filename                  ; e.g. "/usr/foobar/Mail/inbox/"
1570     (file-name-as-directory (mh-expand-file-name (buffer-name)))     (file-name-as-directory (mh-expand-file-name (buffer-name)))
1571       'mh-display-buttons-for-inline-parts-flag
1572       mh-display-buttons-for-inline-parts-flag ; Allow for display of buttons to
1573                                            ; be  toggled.
1574     'mh-arrow-marker (make-marker)       ; Marker where arrow is displayed     'mh-arrow-marker (make-marker)       ; Marker where arrow is displayed
1575     'overlay-arrow-position nil          ; Allow for simultaneous display in     'overlay-arrow-position nil          ; Allow for simultaneous display in
1576     'overlay-arrow-string ">"            ;  different MH-E buffers.     'overlay-arrow-string ">"            ;  different MH-E buffers.
# Line 1597  When a folder is visited, the hook `mh-f Line 1599  When a folder is visited, the hook `mh-f
1599     'mh-sequence-notation-history (make-hash-table)     'mh-sequence-notation-history (make-hash-table)
1600                                          ; Remember what is overwritten by                                          ; Remember what is overwritten by
1601                                          ; mh-note-seq.                                          ; mh-note-seq.
1602       'imenu-create-index-function 'mh-index-create-imenu-index
1603                                            ; Setup imenu support
1604     'mh-previous-window-config nil)      ; Previous window configuration     'mh-previous-window-config nil)      ; Previous window configuration
1605    (mh-remove-xemacs-horizontal-scrollbar)    (mh-remove-xemacs-horizontal-scrollbar)
1606    (setq truncate-lines t)    (setq truncate-lines t)
# Line 1620  When a folder is visited, the hook `mh-f Line 1624  When a folder is visited, the hook `mh-f
1624             font-lock-auto-fontify)             font-lock-auto-fontify)
1625        (turn-on-font-lock)))             ; Force font-lock in XEmacs.        (turn-on-font-lock)))             ; Force font-lock in XEmacs.
1626    
1627    (defun mh-toggle-mime-buttons ()
1628      "Toggle display of buttons for inline MIME parts."
1629      (interactive)
1630      (setq mh-display-buttons-for-inline-parts-flag
1631            (not mh-display-buttons-for-inline-parts-flag))
1632      (mh-show nil t))
1633    
1634    (defun mh-colors-available-p ()
1635      "Check if colors are available in the Emacs being used."
1636      (or mh-xemacs-flag
1637          (let ((color-cells
1638                 (or (ignore-errors (mh-funcall-if-exists display-color-cells))
1639                     (ignore-errors (mh-funcall-if-exists
1640                                     x-display-color-cells)))))
1641            (and (numberp color-cells) (>= color-cells 8)))))
1642    
1643    (defun mh-colors-in-use-p ()
1644      "Check if colors are being used in the folder buffer."
1645      (and mh-colors-available-flag font-lock-mode))
1646    
1647  (defun mh-make-local-vars (&rest pairs)  (defun mh-make-local-vars (&rest pairs)
1648    "Initialize local variables according to the variable-value PAIRS."    "Initialize local variables according to the variable-value PAIRS."
1649    
# Line 1631  When a folder is visited, the hook `mh-f Line 1655  When a folder is visited, the hook `mh-f
1655  (defun mh-restore-desktop-buffer (desktop-buffer-file-name  (defun mh-restore-desktop-buffer (desktop-buffer-file-name
1656                                    desktop-buffer-name                                    desktop-buffer-name
1657                                    desktop-buffer-misc)                                    desktop-buffer-misc)
1658    "Restore an MH folder buffer specified in a desktop file."    "Restore an MH folder buffer specified in a desktop file.
1659    When desktop creates a buffer, DESKTOP-BUFFER-FILE-NAME holds the file name to
1660    visit, DESKTOP-BUFFER-NAME holds the desired buffer name, and
1661    DESKTOP-BUFFER-MISC holds a list of miscellaneous info used by the
1662    `desktop-buffer-handlers' functions."
1663    (mh-find-path)    (mh-find-path)
1664    (mh-visit-folder desktop-buffer-name)    (mh-visit-folder desktop-buffer-name)
1665    (current-buffer))    (current-buffer))
# Line 1641  When a folder is visited, the hook `mh-f Line 1669  When a folder is visited, the hook `mh-f
1669  If the optional argument DONT-EXEC-PENDING is non-nil then pending deletes and  If the optional argument DONT-EXEC-PENDING is non-nil then pending deletes and
1670  refiles aren't carried out.  refiles aren't carried out.
1671  Return in the folder's buffer."  Return in the folder's buffer."
1672      (when (stringp range)
1673        (setq range (delete "" (split-string range "[ \t\n]"))))
1674    (cond ((null (get-buffer folder))    (cond ((null (get-buffer folder))
1675           (mh-make-folder folder))           (mh-make-folder folder))
1676          (t          (t
# Line 1693  If UPDATE, append the scan lines, otherw Line 1723  If UPDATE, append the scan lines, otherw
1723        (goto-char scan-start)        (goto-char scan-start)
1724        (cond ((looking-at "scan: no messages in")        (cond ((looking-at "scan: no messages in")
1725               (keep-lines mh-scan-valid-regexp)) ; Flush random scan lines               (keep-lines mh-scan-valid-regexp)) ; Flush random scan lines
1726              ((looking-at "scan: bad message list ")              ((looking-at (if (mh-variant-p 'mu-mh)
1727                                 "scan: message set .* does not exist"
1728                               "scan: bad message list "))
1729               (keep-lines mh-scan-valid-regexp))               (keep-lines mh-scan-valid-regexp))
1730              ((looking-at "scan: "))     ; Keep error messages              ((looking-at "scan: "))     ; Keep error messages
1731              (t              (t
# Line 1869  in what is now stored in the buffer-loca Line 1901  in what is now stored in the buffer-loca
1901                                    (""))))))                                    (""))))))
1902        (mh-logo-display))))        (mh-logo-display))))
1903    
 ;;; XXX: Remove this function, if no one uses it any more...  
 (defun mh-unmark-all-headers (remove-all-flags)  
   "Remove all '+' flags from the folder listing.  
 With non-nil argument REMOVE-ALL-FLAGS, remove all 'D', '^' and '%' flags too.  
 Optimized for speed (i.e., no regular expressions).  
   
 This function is deprecated. Use `mh-remove-all-notation' instead."  
   (save-excursion  
     (let ((case-fold-search nil)  
           (last-line (1- (point-max)))  
           char)  
       (mh-first-msg)  
       (while (<= (point) last-line)  
         (forward-char mh-cmd-note)  
         (setq char (following-char))  
         (if (or (and remove-all-flags  
                      (or (= char (aref mh-note-deleted 0))  
                          (= char (aref mh-note-refiled 0))))  
                 (= char (aref mh-note-cur 0)))  
             (progn  
               (delete-char 1)  
               (insert " ")))  
         (if remove-all-flags  
             (progn  
               (forward-char 1)  
               (if (= (following-char) (aref mh-note-seq 0))  
                   (progn  
                     (delete-char 1)  
                     (insert " ")))))  
         (forward-line)))))  
   
1904  (defun mh-add-sequence-notation (msg internal-seq-flag)  (defun mh-add-sequence-notation (msg internal-seq-flag)
1905    "Add sequence notation to the MSG on the current line.    "Add sequence notation to the MSG on the current line.
1906  If INTERNAL-SEQ-FLAG is non-nil, then just remove text properties from the  If INTERNAL-SEQ-FLAG is non-nil, then refontify the scan line if font-lock is
1907  current line, so that font-lock would automatically refontify it."  turned on."
1908    (with-mh-folder-updating (t)    (with-mh-folder-updating (t)
1909      (save-excursion      (save-excursion
1910        (beginning-of-line)        (beginning-of-line)
1911        (if internal-seq-flag        (if internal-seq-flag
1912            (mh-notate nil nil mh-cmd-note)            (progn
1913                ;; Change the buffer so that if transient-mark-mode is active
1914                ;; and there is an active region it will get deactivated as in
1915                ;; the case of user sequences.
1916                (mh-notate nil nil mh-cmd-note)
1917                (when font-lock-mode
1918                  (font-lock-fontify-region (point) (line-end-position))))
1919          (forward-char (1+ mh-cmd-note))          (forward-char (1+ mh-cmd-note))
1920          (let ((stack (gethash msg mh-sequence-notation-history)))          (let ((stack (gethash msg mh-sequence-notation-history)))
1921            (setf (gethash msg mh-sequence-notation-history)            (setf (gethash msg mh-sequence-notation-history)
# Line 1930  If ALL is non-nil, then all sequence mar Line 1937  If ALL is non-nil, then all sequence mar
1937          (while (and all (cdr stack))          (while (and all (cdr stack))
1938            (setq stack (cdr stack)))            (setq stack (cdr stack)))
1939          (when stack          (when stack
1940            (mh-notate nil (car stack) (1+ mh-cmd-note)))            (save-excursion
1941                (beginning-of-line)
1942                (forward-char (1+ mh-cmd-note))
1943                (delete-char 1)
1944                (insert (car stack))))
1945          (setf (gethash msg mh-sequence-notation-history) (cdr stack))))))          (setf (gethash msg mh-sequence-notation-history) (cdr stack))))))
1946    
1947  (defun mh-remove-cur-notation ()  (defun mh-remove-cur-notation ()
# Line 1953  If ALL is non-nil, then all sequence mar Line 1964  If ALL is non-nil, then all sequence mar
1964        (mh-remove-sequence-notation msg nil t))        (mh-remove-sequence-notation msg nil t))
1965      (clrhash mh-sequence-notation-history)))      (clrhash mh-sequence-notation-history)))
1966    
1967  ;;;###mh-autoload  
1968  (defun mh-goto-cur-msg (&optional minimal-changes-flag)  (defun mh-goto-cur-msg (&optional minimal-changes-flag)
1969    "Position the cursor at the current message.    "Position the cursor at the current message.
1970  When optional argument MINIMAL-CHANGES-FLAG is non-nil, the function doesn't  When optional argument MINIMAL-CHANGES-FLAG is non-nil, the function doesn't
# Line 2102  with no arguments, after the unseen sequ Line 2113  with no arguments, after the unseen sequ
2113    
2114  (defun mh-outstanding-commands-p ()  (defun mh-outstanding-commands-p ()
2115    "Return non-nil if there are outstanding deletes or refiles."    "Return non-nil if there are outstanding deletes or refiles."
2116    (or mh-delete-list mh-refile-list))    (save-excursion
2117        (when (eq major-mode 'mh-show-mode)
2118          (set-buffer mh-show-folder-buffer))
2119        (or mh-delete-list mh-refile-list)))
2120    
2121  (defun mh-coalesce-msg-list (messages)  (defun mh-coalesce-msg-list (messages)
2122    "Given a list of MESSAGES, return a list of message number ranges.    "Given a list of MESSAGES, return a list of message number ranges.
# Line 2223  numbers, a sequence, a region in a cons Line 2237  numbers, a sequence, a region in a cons
2237    "Return non-nil if NAME is the name of an internal MH-E sequence."    "Return non-nil if NAME is the name of an internal MH-E sequence."
2238    (or (memq name mh-internal-seqs)    (or (memq name mh-internal-seqs)
2239        (eq name mh-unseen-seq)        (eq name mh-unseen-seq)
2240        (and mh-tick-seq (eq name mh-tick-seq))        (and (mh-colors-in-use-p) mh-tick-seq (eq name mh-tick-seq))
2241        (eq name mh-previous-seq)        (eq name mh-previous-seq)
2242        (mh-folder-name-p name)))        (mh-folder-name-p name)))
2243    
# Line 2264  change." Line 2278  change."
2278        (when (and (eq sequence mh-unseen-seq) (mh-speed-flists-active-p))        (when (and (eq sequence mh-unseen-seq) (mh-speed-flists-active-p))
2279          (apply #'mh-speed-flists t folders-changed)))))          (apply #'mh-speed-flists t folders-changed)))))
2280    
2281    (defun mh-catchup (range)
2282      "Delete RANGE from the `mh-unseen-seq' sequence.
2283    
2284    Check the document of `mh-interactive-range' to see how RANGE is read in
2285    interactive use."
2286      (interactive (list (mh-interactive-range "Catchup"
2287                                               (cons (point-min) (point-max)))))
2288      (mh-delete-msg-from-seq range mh-unseen-seq))
2289    
2290  (defun mh-delete-a-msg-from-seq (msg sequence internal-flag)  (defun mh-delete-a-msg-from-seq (msg sequence internal-flag)
2291    "Delete MSG from SEQUENCE.    "Delete MSG from SEQUENCE.
2292  If INTERNAL-FLAG is non-nil, then do not inform MH of the change."  If INTERNAL-FLAG is non-nil, then do not inform MH of the change."
# Line 2291  Signals an error if SEQ is an illegal na Line 2314  Signals an error if SEQ is an illegal na
2314                             "-sequence" (symbol-name seq)                             "-sequence" (symbol-name seq)
2315                             (mh-coalesce-msg-list msgs)))))                             (mh-coalesce-msg-list msgs)))))
2316    
 (defun mh-map-over-seqs (function seq-list)  
   "Apply FUNCTION to each sequence in SEQ-LIST.  
 The sequence name and the list of messages are passed as arguments."  
   (while seq-list  
     (funcall function  
              (mh-seq-name (car seq-list))  
              (mh-seq-msgs (car seq-list)))  
     (setq seq-list (cdr seq-list))))  
   
 (defun mh-notate-if-in-one-seq (msg character offset seq)  
   "Notate MSG.  
 The CHARACTER is placed at the given OFFSET from the beginning of the listing.  
 The notation is performed if the MSG is only in SEQ."  
   (let ((in-seqs (mh-seq-containing-msg msg nil)))  
     (if (and (eq seq (car in-seqs)) (null (cdr in-seqs)))  
         (mh-notate msg character offset))))  
   
2317  (defun mh-seq-containing-msg (msg &optional include-internal-flag)  (defun mh-seq-containing-msg (msg &optional include-internal-flag)
2318    "Return a list of the sequences containing MSG.    "Return a list of the sequences containing MSG.
2319  If INCLUDE-INTERNAL-FLAG non-nil, include MH-E internal sequences in list."  If INCLUDE-INTERNAL-FLAG non-nil, include MH-E internal sequences in list."
# Line 2362  If INCLUDE-INTERNAL-FLAG non-nil, includ Line 2368  If INCLUDE-INTERNAL-FLAG non-nil, includ
2368    "g"           mh-goto-msg    "g"           mh-goto-msg
2369    "i"           mh-inc-folder    "i"           mh-inc-folder
2370    "k"           mh-delete-subject-or-thread    "k"           mh-delete-subject-or-thread
   "l"           mh-print-msg  
2371    "m"           mh-alt-send    "m"           mh-alt-send
2372    "n"           mh-next-undeleted-msg    "n"           mh-next-undeleted-msg
2373    "\M-n"        mh-next-unread-msg    "\M-n"        mh-next-unread-msg
# Line 2382  If INCLUDE-INTERNAL-FLAG non-nil, includ Line 2387  If INCLUDE-INTERNAL-FLAG non-nil, includ
2387    "?"           mh-prefix-help    "?"           mh-prefix-help
2388    "'"           mh-index-ticked-messages    "'"           mh-index-ticked-messages
2389    "S"           mh-sort-folder    "S"           mh-sort-folder
2390      "c"           mh-catchup
2391    "f"           mh-alt-visit-folder    "f"           mh-alt-visit-folder
2392    "i"           mh-index-search    "i"           mh-index-search
2393    "k"           mh-kill-folder    "k"           mh-kill-folder
# Line 2402  If INCLUDE-INTERNAL-FLAG non-nil, includ Line 2408  If INCLUDE-INTERNAL-FLAG non-nil, includ
2408    "b"           mh-junk-blacklist    "b"           mh-junk-blacklist
2409    "w"           mh-junk-whitelist)    "w"           mh-junk-whitelist)
2410    
2411    (gnus-define-keys (mh-ps-print-map "P" mh-folder-mode-map)
2412      "?"           mh-prefix-help
2413      "A"           mh-ps-print-toggle-mime
2414      "C"           mh-ps-print-toggle-color
2415      "F"           mh-ps-print-toggle-faces
2416      "M"           mh-ps-print-toggle-mime
2417      "f"           mh-ps-print-msg-file
2418      "l"           mh-print-msg
2419      "p"           mh-ps-print-msg
2420      "s"           mh-ps-print-msg-show)
2421    
2422  (gnus-define-keys (mh-sequence-map "S" mh-folder-mode-map)  (gnus-define-keys (mh-sequence-map "S" mh-folder-mode-map)
2423    "'"           mh-narrow-to-tick    "'"           mh-narrow-to-tick
2424    "?"           mh-prefix-help    "?"           mh-prefix-help
# Line 2446  If INCLUDE-INTERNAL-FLAG non-nil, includ Line 2463  If INCLUDE-INTERNAL-FLAG non-nil, includ
2463  (gnus-define-keys (mh-mime-map "K" mh-folder-mode-map)  (gnus-define-keys (mh-mime-map "K" mh-folder-mode-map)
2464    "?"           mh-prefix-help    "?"           mh-prefix-help
2465    "a"           mh-mime-save-parts    "a"           mh-mime-save-parts
2466      "e"           mh-display-with-external-viewer
2467    "i"           mh-folder-inline-mime-part    "i"           mh-folder-inline-mime-part
2468    "o"           mh-folder-save-mime-part    "o"           mh-folder-save-mime-part
2469      "t"           mh-toggle-mime-buttons
2470    "v"           mh-folder-toggle-mime-part    "v"           mh-folder-toggle-mime-part
2471    "\t"          mh-next-button    "\t"          mh-next-button
2472    [backtab]     mh-prev-button    [backtab]     mh-prev-button
# Line 2484  If INCLUDE-INTERNAL-FLAG non-nil, includ Line 2503  If INCLUDE-INTERNAL-FLAG non-nil, includ
2503      (?F "[l]ist; [v]isit folder;\n"      (?F "[l]ist; [v]isit folder;\n"
2504          "[n]ew messages; [']ticked messages; [s]earch; [i]ndexed search;\n"          "[n]ew messages; [']ticked messages; [s]earch; [i]ndexed search;\n"
2505          "[p]ack; [S]ort; [r]escan; [k]ill")          "[p]ack; [S]ort; [r]escan; [k]ill")
2506        (?P "PS [p]rint message; [l]non-PS print;\n"
2507            "PS Print [s]how window, message to [f]ile;\n"
2508            "Toggle printing of [M]IME parts, [C]olor, [F]aces")
2509      (?S "[p]ut message in sequence, [n]arrow, [']narrow to ticked, [w]iden,\n"      (?S "[p]ut message in sequence, [n]arrow, [']narrow to ticked, [w]iden,\n"
2510          "[s]equences, [l]ist,\n"          "[s]equences, [l]ist,\n"
2511          "[d]elete message from sequence, [k]ill sequence")          "[d]elete message from sequence, [k]ill sequence")

Legend:
Removed from v.1.2.4.5  
changed lines
  Added in v.1.2.4.6

savannah-hackers-public@gnu.org
ViewVC Help
Powered by ViewVC 1.1.26