/[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.11 by wohler, Tue Jul 13 03:30:21 2004 UTC revision 1.11.2.1 by miles, Sat Sep 4 12:01:04 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.82
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 'mh-seq)
93  (require 'gnus-util)  (require 'gnus-util)
94  (require 'easymenu)  (require 'easymenu)
95    
# Line 101  Line 97 
97  (defvar font-lock-auto-fontify)  (defvar font-lock-auto-fontify)
98  (defvar font-lock-defaults)  (defvar font-lock-defaults)
99    
100  (defconst mh-version "7.4.4" "Version number of MH-E.")  (defconst mh-version "7.82" "Version number of MH-E.")
101    
102  ;;; Autoloads  ;;; Autoloads
103  (autoload 'Info-goto-node "info")  (autoload 'Info-goto-node "info")
104    
   
   
 (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.")  
   
105  (defvar mh-partial-folder-mode-line-annotation "select"  (defvar mh-partial-folder-mode-line-annotation "select"
106    "Annotation when displaying part of a folder.    "Annotation when displaying part of a folder.
107  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.")
108    
109    
110    ;;; Scan Line Formats
111    
112  ;;; Parameterize MH-E to work with different scan formats.  The defaults work  ;;; Parameterize MH-E to work with different scan formats.  The defaults work
113  ;;; 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
114  ;;; the line are the message number, followed by two places for notations.  ;;; the line are the message number, followed by two places for notations.
115    
116  ;; 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
117  ;; 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
118  ;; 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
119  ;; 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'
120  ;; the msg number, use the `mh-set-cmd-note' function.  ;; function.
121    
122  (defvar mh-scan-format-mh  (defvar mh-scan-format-mh
123    (concat    (concat
# Line 150  This format is identical to the default Line 138  This format is identical to the default
138  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
139  first column is 0).  first column is 0).
140    
141  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
142  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
143  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:
144  `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.")  
145    
146  (defvar mh-scan-format-nmh  (defvar mh-scan-format-nmh
147    (concat    (concat
# Line 176  This format is identical to the default Line 163  This format is identical to the default
163  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
164  first column is 0).  first column is 0).
165    
166  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
167  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
168  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:
169  `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.")
170  is present.")  
171    (defvar mh-note-deleted ?D
172      "Deleted messages are marked by this character.
173    See also `mh-scan-deleted-msg-regexp'.")
174    
175    (defvar mh-note-refiled ?^
176      "Refiled messages are marked by this character.
177    See also `mh-scan-refiled-msg-regexp'.")
178    
179    (defvar mh-note-cur ?+
180      "The current message (in MH) is marked by this character.
181    See also `mh-scan-cur-msg-number-regexp'.")
182    
183  (defvar mh-scan-good-msg-regexp  "^\\( *[0-9]+\\)[^D^0-9]"  (defvar mh-scan-good-msg-regexp  "^\\( *[0-9]+\\)[^D^0-9]"
184    "Regexp specifying the scan lines that are 'good' messages.    "This regexp specifies the scan lines that are 'good' messages.
185  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
186  at least one parenthesized expression which matches the message number.")  expression to contain at least one parenthesized expression which matches the
187    message number as in the default of \"^\\\\( *[0-9]+\\\\)[^D^0-9]\".")
188    
189  (defvar mh-scan-deleted-msg-regexp "^\\( *[0-9]+\\)D"  (defvar mh-scan-deleted-msg-regexp "^\\( *[0-9]+\\)D"
190    "Regexp matching scan lines of deleted messages.    "This regexp matches deleted messages.
191  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
192  at least one parenthesized expression which matches the message number.")  expression to contain at least one parenthesized expression which matches the
193    message number as in the default of \"^\\\\( *[0-9]+\\\\)D\".
194    See also `mh-note-deleted'.")
195    
196  (defvar mh-scan-refiled-msg-regexp  "^\\( *[0-9]+\\)\\^"  (defvar mh-scan-refiled-msg-regexp  "^\\( *[0-9]+\\)\\^"
197    "Regexp matching scan lines of refiled messages.    "This regexp matches refiled messages.
198  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
199  at least one parenthesized expression which matches the message number.")  expression to contain at least one parenthesized expression which matches the
200    message number as in the default of \"^\\\\( *[0-9]+\\\\)\\\\^\".
201    See also `mh-note-refiled'.")
202    
203  (defvar mh-scan-valid-regexp "^ *[0-9]"  (defvar mh-scan-valid-regexp "^ *[0-9]"
204    "Regexp matching scan lines for messages (not error messages).")    "This regexp matches scan lines for messages (not error messages).")
205    
206  (defvar mh-scan-cur-msg-number-regexp "^\\( *[0-9]+\\+\\).*"  (defvar mh-scan-cur-msg-number-regexp "^\\( *[0-9]+\\+\\).*"
207    "Regexp matching scan line for the current message.    "This regexp matches the current message.
208  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
209  at least one parenthesized expression which matches the message number.  expression to contain at least one parenthesized expression which matches the
210  Don't disable this regexp as it's needed by non fontifying functions.")  message number as in the default of \"^\\\\( *[0-9]+\\\\+\\\\).*\". Don't
211    disable this regexp as it's needed by non-fontifying functions.
212  (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.")  
213    
214  (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]\\)"
215    "Regexp matching a valid date in scan lines.    "This regexp matches a valid date.
216  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
217  only one parenthesized expression which matches the date field  expression to contain only one parenthesized expression which matches the date
218  \(see `mh-scan-format-regexp').")  field as in the default of \"\\\\([0-9][0-9]/[0-9][0-9]\\\\)\"}.
219    See also `mh-scan-format-regexp'.")
220    
221  (defvar mh-scan-rcpt-regexp  "\\(To:\\)\\(..............\\)"  (defvar mh-scan-rcpt-regexp  "\\(To:\\)\\(..............\\)"
222    "Regexp specifying the recipient in scan lines for messages we sent.    "This regexp specifies the recipient in messages you sent.
223  The default `mh-folder-font-lock-keywords' expects this expression to contain  Note that the default setting of `mh-folder-font-lock-keywords'
224  two parenthesized expressions.  The first is expected to match the To:  expects this expression to contain two parenthesized expressions. The
225  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
226  the recipient's name.")  file generates. The second is expected to match the recipient's name
227    as in the default of \"\\\\(To:\\\\)\\\\(..............\\\\)\".")
228    
229  (defvar mh-scan-body-regexp "\\(<<\\([^\n]+\\)?\\)"  (defvar mh-scan-body-regexp "\\(<<\\([^\n]+\\)?\\)"
230    "Regexp matching the message body beginning displayed in scan lines.    "This regexp matches the message body fragment displayed in scan lines.
231  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
232  at least one parenthesized expression which matches the body text.")  expression to contain at least one parenthesized expression which matches the
233    body text as in the default of \"\\\\(<<\\\\([^\\n]+\\\\)?\\\\)\".")
234    
235  (defvar mh-scan-subject-regexp  (defvar mh-scan-subject-regexp
   ;;"^ *[0-9]+........[ ]*...................\\([Rr][Ee]:\\s-*\\)*\\([^<\n]*\\)"  
236    "^ *[0-9]+........[ ]*...................\\([Rr][Ee]\\(\\[[0-9]+\\]\\)?:\\s-*\\)*\\([^<\n]*\\)"    "^ *[0-9]+........[ ]*...................\\([Rr][Ee]\\(\\[[0-9]+\\]\\)?:\\s-*\\)*\\([^<\n]*\\)"
237    "*Regexp matching the subject string in MH folder mode.    "This regexp matches the subject.
238  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
239  at least tree parenthesized expressions. The first is expected to match the Re:  expression to contain at least three parenthesized expressions. The first is
240  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
241  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
242    sub-expression of the first expression) and the third is expected to match
243    the subject line itself as in the default of \"^ *[0-9]+........[ ]*...................\\\\([Rr][Ee]\\\\(\\\\\\=[[0-9]+\\\\]\\\\)?:\\\\s-*\\\\)*\\\\([^<\\n]*\\\\)\".")
244    
245  (defvar mh-scan-format-regexp  (defvar mh-scan-format-regexp
246    (concat "\\([bct]\\)" mh-scan-date-regexp " *\\(..................\\)")    (concat "\\([bct]\\)" mh-scan-date-regexp " *\\(..................\\)")
247    "Regexp matching the output of scan.    "This regexp matches the output of scan.
248  The default value is based upon the default values of either  Note that the default setting of `mh-folder-font-lock-keywords' expects this
249  `mh-scan-format-mh' or `mh-scan-format-nmh'.  expression to contain at least three parenthesized expressions. The first
250  The default `mh-folder-font-lock-keywords' expects this expression to contain  should match the fontification hint, the second is found in
251  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
252  fontification hint, the second is found in `mh-scan-date-regexp', and the  default of \"(concat \"\\\\([bct]\\\\)\" mh-scan-date-regexp
253  third should match the user name.")                       \"*\\\\(..................\\\\)\")\".")
254    
255    
256    
# Line 279  third should match the user name.") Line 282  third should match the user name.")
282     ;; scan font-lock name     ;; scan font-lock name
283     (list mh-scan-format-regexp     (list mh-scan-format-regexp
284           '(1 mh-folder-date-face)           '(1 mh-folder-date-face)
285           '(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)))  
286    "Regexp keywords used to fontify the MH-Folder buffer.")    "Regexp keywords used to fontify the MH-Folder buffer.")
287    
288  (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 356  This column will only ever have spaces i
356    
357  ;; Fontifify unseen mesages in bold.  ;; Fontifify unseen mesages in bold.
358    
 (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) '<)))))))))  
   
359  (defmacro mh-generate-sequence-font-lock (seq prefix face)  (defmacro mh-generate-sequence-font-lock (seq prefix face)
360    "Generate the appropriate code to fontify messages in SEQ.    "Generate the appropriate code to fontify messages in SEQ.
361  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 452  is done highlighting.")
452                                          ;Rememeber original notation that                                          ;Rememeber original notation that
453                                          ;is overwritten by `mh-note-seq'.                                          ;is overwritten by `mh-note-seq'.
454    
455    (defvar mh-colors-available-flag nil)   ;Are colors available?
456    
457  ;;; Macros and generic functions:  ;;; Macros and generic functions:
458    
459  (defun mh-mapc (function list)  (defun mh-mapc (function list)
# Line 503  is done highlighting.") Line 465  is done highlighting.")
465  (defun mh-scan-format ()  (defun mh-scan-format ()
466    "Return the output format argument for the scan program."    "Return the output format argument for the scan program."
467    (if (equal mh-scan-format-file t)    (if (equal mh-scan-format-file t)
468        (list "-format" (if mh-nmh-flag        (list "-format" (if (mh-variant-p 'nmh 'mu-mh)
469                            (list (mh-update-scan-format                            (list (mh-update-scan-format
470                                   mh-scan-format-nmh mh-cmd-note))                                   mh-scan-format-nmh mh-cmd-note))
471                          (list (mh-update-scan-format                          (list (mh-update-scan-format
# Line 519  is done highlighting.") Line 481  is done highlighting.")
481  (defun mh-rmail (&optional arg)  (defun mh-rmail (&optional arg)
482    "Inc(orporate) new mail with MH.    "Inc(orporate) new mail with MH.
483  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,
484  the Emacs front end to the MH mail system."  the Emacs interface to the MH mail system."
485    (interactive "P")    (interactive "P")
486    (mh-find-path)    (mh-find-path)
487    (if arg    (if arg
# Line 532  the Emacs front end to the MH mail syste Line 494  the Emacs front end to the MH mail syste
494  (defun mh-nmail (&optional arg)  (defun mh-nmail (&optional arg)
495    "Check for new mail in inbox folder.    "Check for new mail in inbox folder.
496  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,
497  the Emacs front end to the MH mail system."  the Emacs interface to the MH mail system."
498    (interactive "P")    (interactive "P")
499    (mh-find-path)                        ; init mh-inbox    (mh-find-path)                        ; init mh-inbox
500    (if arg    (if arg
# Line 616  Do not call this function from outside M Line 578  Do not call this function from outside M
578        (setq folder mh-inbox))        (setq folder mh-inbox))
579    (let ((threading-needed-flag nil))    (let ((threading-needed-flag nil))
580      (let ((config (current-window-configuration)))      (let ((config (current-window-configuration)))
581          (delete-other-windows)
582        (cond ((not (get-buffer folder))        (cond ((not (get-buffer folder))
583               (mh-make-folder folder)               (mh-make-folder folder)
584               (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 622  last undeleted message then pause for a
622             (if wait-after-complaining-flag (sit-for 1)))))             (if wait-after-complaining-flag (sit-for 1)))))
623    
624  (defun mh-folder-from-address ()  (defun mh-folder-from-address ()
625    "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:  
626    
627    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.  
628    
629    b) The address' corresponding alias from the user's personal    a) The folder name associated with the first address found in the list
630       aliases file prefixed by `mh-default-folder-prefix'.       `mh-default-folder-list' is used. Each element in this list contains a
631         `Check Recipient' item. If this item is turned on, then the address is
632         checked against the recipient instead of the sender. This is useful for
633         mailing lists.
634    
635      b) An alias prefixed by `mh-default-folder-prefix' corresponding to the
636         address is used. The prefix is used to prevent clutter in your mail
637         directory.
638    
639  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
640  `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."
641    ;; Loop for all entries in mh-default-folder-list    ;; Loop for all entries in mh-default-folder-list
642    (save-restriction    (save-restriction
643      (goto-char (point-min))      (goto-char (point-min))
644      (re-search-forward "\n\n" nil t)      (re-search-forward "\n\n" nil 'limit)
645      (narrow-to-region (point-min) (point))      (narrow-to-region (point-min) (point))
646      (let ((to/cc (concat (or (message-fetch-field "to") "") ", "      (let ((to/cc (concat (or (message-fetch-field "to") "") ", "
647                           (or (message-fetch-field "cc") "")))                           (or (message-fetch-field "cc") "")))
# Line 715  Returns nil if the address was not found Line 679  Returns nil if the address was not found
679    "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.
680  The folder is returned as a string.  The folder is returned as a string.
681    
682  If `mh-default-folder-for-message-function' is a function then the message  The default folder name is generated by the option
683  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
684  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'."  
685    (mh-prompt-for-folder    (mh-prompt-for-folder
686     "Destination"     "Destination"
687     (let ((refile-file (mh-msg-filename (mh-get-msg-num t))))     (let ((refile-file (ignore-errors (mh-msg-filename (mh-get-msg-num t)))))
688       (save-excursion       (if (null refile-file) ""
689         (set-buffer (get-buffer-create mh-temp-buffer))         (save-excursion
690         (erase-buffer)           (set-buffer (get-buffer-create mh-temp-buffer))
691         (insert-file-contents refile-file)           (erase-buffer)
692         (or (and mh-default-folder-for-message-function           (insert-file-contents refile-file)
693                  (let ((buffer-file-name refile-file))           (or (and mh-default-folder-for-message-function
694                    (funcall mh-default-folder-for-message-function)))                    (let ((buffer-file-name refile-file))
695             (mh-folder-from-address)                      (funcall mh-default-folder-for-message-function)))
696             (and (eq 'refile (car mh-last-destination-folder))               (mh-folder-from-address)
697                  (symbol-name (cdr mh-last-destination-folder)))               (and (eq 'refile (car mh-last-destination-folder))
698             "")))                    (symbol-name (cdr mh-last-destination-folder)))
699                 ""))))
700     t))     t))
701    
702  (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 835  are skipped."
835                 (setq count (1- count)))                 (setq count (1- count)))
836               (not (car unread-sequence)))               (not (car unread-sequence)))
837             (message "No more unread messages"))             (message "No more unread messages"))
838            (t (mh-goto-msg (car unread-sequence))))))            (t (loop for msg in unread-sequence
839                       when (mh-goto-msg msg t) return nil
840                       finally (message "No more unread messages"))))))
841    
842  (defun mh-goto-next-button (backward-flag &optional criterion)  (defun mh-goto-next-button (backward-flag &optional criterion)
843    "Search for next button satisfying criterion.    "Search for next button satisfying criterion.
# Line 1090  interactive use." Line 1055  interactive use."
1055    (if (not (mh-outstanding-commands-p))    (if (not (mh-outstanding-commands-p))
1056        (mh-set-folder-modified-p nil)))        (mh-set-folder-modified-p nil)))
1057    
1058  ;;;###mh-autoload  
1059  (defun mh-folder-line-matches-show-buffer-p ()  (defun mh-folder-line-matches-show-buffer-p ()
1060    "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.
1061  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 1088  compiled then macro expansion happens at
1088  (defun mh-version ()  (defun mh-version ()
1089    "Display version information about MH-E and the MH mail handling system."    "Display version information about MH-E and the MH mail handling system."
1090    (interactive)    (interactive)
   (mh-find-progs)  
1091    (set-buffer (get-buffer-create mh-info-buffer))    (set-buffer (get-buffer-create mh-info-buffer))
1092    (erase-buffer)    (erase-buffer)
1093    ;; MH-E version.    ;; MH-E version.
# Line 1140  compiled then macro expansion happens at Line 1104  compiled then macro expansion happens at
1104    ;; Emacs version.    ;; Emacs version.
1105    (insert (emacs-version) "\n\n")    (insert (emacs-version) "\n\n")
1106    ;; MH version.    ;; MH version.
1107    (let ((help-start (point)))    (if mh-variant-in-use
1108      (condition-case err-data        (insert mh-variant-in-use "\n"
1109          (mh-exec-cmd-output "inc" nil (if mh-nmh-flag "-version" "-help"))                " mh-progs:\t" mh-progs "\n"
1110        (file-error (insert (mapconcat 'concat (cdr err-data) ": ") "\n")))                " mh-lib:\t" mh-lib "\n"
1111      (goto-char help-start)                " mh-lib-progs:\t" mh-lib-progs "\n\n")
1112      (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")  
1113    ;; Linux version.    ;; Linux version.
1114    (condition-case ()    (condition-case ()
1115        (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 1159  used to avoid problems in corner cases i
1159  (defun mh-folder-size-flist (folder)  (defun mh-folder-size-flist (folder)
1160    "Find size of FOLDER using `flist'."    "Find size of FOLDER using `flist'."
1161    (with-temp-buffer    (with-temp-buffer
1162      (call-process (expand-file-name "flist" mh-progs) nil t nil      (call-process (expand-file-name "flist" mh-progs) nil t nil "-showzero"
1163                    "-norecurse" folder "-sequence" (symbol-name mh-unseen-seq))                    "-norecurse" folder "-sequence" (symbol-name mh-unseen-seq))
1164      (goto-char (point-min))      (goto-char (point-min))
1165      (multiple-value-bind (folder unseen total)      (multiple-value-bind (folder unseen total)
# Line 1236  regardless of the size of the `mh-large- Line 1193  regardless of the size of the `mh-large-
1193    (let ((config (current-window-configuration))    (let ((config (current-window-configuration))
1194          (current-buffer (current-buffer))          (current-buffer (current-buffer))
1195          (threaded-view-flag mh-show-threads-flag))          (threaded-view-flag mh-show-threads-flag))
1196        (delete-other-windows)
1197      (save-excursion      (save-excursion
1198        (when (get-buffer folder)        (when (get-buffer folder)
1199          (set-buffer folder)          (set-buffer folder)
# Line 1258  regardless of the size of the `mh-large- Line 1216  regardless of the size of the `mh-large-
1216             (mh-toggle-threads))             (mh-toggle-threads))
1217            (mh-index-data            (mh-index-data
1218             (mh-index-insert-folder-headers)))             (mh-index-insert-folder-headers)))
     (unless mh-showing-mode (delete-other-windows))  
1219      (unless (eq current-buffer (current-buffer))      (unless (eq current-buffer (current-buffer))
1220        (setq mh-previous-window-config config)))        (setq mh-previous-window-config config)))
1221    nil)    nil)
1222    
1223  ;;;###mh-autoload  
1224  (defun mh-update-sequences ()  (defun mh-update-sequences ()
1225    "Update MH's Unseen-Sequence and current folder and message.    "Update MH's Unseen-Sequence and current folder and message.
1226  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 1291  arguments, after the message has been re
1291                 (mh-exec-cmd "refile" (mh-get-msg-num t) "-link"                 (mh-exec-cmd "refile" (mh-get-msg-num t) "-link"
1292                              "-src" mh-current-folder                              "-src" mh-current-folder
1293                              (symbol-name folder))                              (symbol-name folder))
1294               (message "Message not copied.")))               (message "Message not copied")))
1295            (t            (t
1296             (mh-set-folder-modified-p t)             (mh-set-folder-modified-p t)
1297             (cond ((null (assoc folder mh-refile-list))             (cond ((null (assoc folder mh-refile-list))
# Line 1381  With optional argument COUNT, COUNT-1 un Line 1338  With optional argument COUNT, COUNT-1 un
1338                 (setq count (1- count)))                 (setq count (1- count)))
1339               (not (car unread-sequence)))               (not (car unread-sequence)))
1340             (message "No more unread messages"))             (message "No more unread messages"))
1341            (t (mh-goto-msg (car unread-sequence))))))            (t (loop for msg in unread-sequence
1342                       when (mh-goto-msg msg t) return nil
1343                       finally (message "No more unread messages"))))))
1344    
1345  (defun mh-set-scan-mode ()  (defun mh-set-scan-mode ()
1346    "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 1431  Make it the current folder."
1431      ["Go to First Message"              mh-first-msg t]      ["Go to First Message"              mh-first-msg t]
1432      ["Go to Last Message"               mh-last-msg t]      ["Go to Last Message"               mh-last-msg t]
1433      ["Go to Message by Number..."       mh-goto-msg t]      ["Go to Message by Number..."       mh-goto-msg t]
1434      ["Modify Message"                   mh-modify]      ["Modify Message"                   mh-modify t]
1435      ["Delete Message"                   mh-delete-msg (mh-get-msg-num nil)]      ["Delete Message"                   mh-delete-msg (mh-get-msg-num nil)]
1436      ["Refile Message"                   mh-refile-msg (mh-get-msg-num nil)]      ["Refile Message"                   mh-refile-msg (mh-get-msg-num nil)]
1437      ["Undo Delete/Refile"               mh-undo t]      ["Undo Delete/Refile"               mh-undo (mh-outstanding-commands-p)]
1438      ["Process Delete/Refile"            mh-execute-commands      ["Execute Delete/Refile"            mh-execute-commands
1439       (or mh-refile-list mh-delete-list)]       (mh-outstanding-commands-p)]
1440      "--"      "--"
1441      ["Compose a New Message"            mh-send t]      ["Compose a New Message"            mh-send t]
1442      ["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 1460  Make it the current folder."
1460      ["Incorporate New Mail"             mh-inc-folder t]      ["Incorporate New Mail"             mh-inc-folder t]
1461      ["Toggle Show/Folder"               mh-toggle-showing t]      ["Toggle Show/Folder"               mh-toggle-showing t]
1462      ["Execute Delete/Refile"            mh-execute-commands      ["Execute Delete/Refile"            mh-execute-commands
1463       (or mh-refile-list mh-delete-list)]       (mh-outstanding-commands-p)]
1464      ["Rescan Folder"                    mh-rescan-folder t]      ["Rescan Folder"                    mh-rescan-folder t]
1465      ["Thread Folder"                    mh-toggle-threads      ["Thread Folder"                    mh-toggle-threads
1466       (not (memq 'unthread mh-view-ops))]       (not (memq 'unthread mh-view-ops))]
# Line 1541  is used in previous versions and XEmacs. Line 1500  is used in previous versions and XEmacs.
1500    (defvar tool-bar-map)    (defvar tool-bar-map)
1501    (defvar desktop-save-buffer))         ;Emacs 21.4    (defvar desktop-save-buffer))         ;Emacs 21.4
1502    
1503    ;; Register mh-folder-mode as supporting which-function-mode...
1504    (load "which-func" t t)
1505    (when (and (boundp 'which-func-modes)
1506               (not (member 'mh-folder-mode which-func-modes)))
1507      (push 'mh-folder-mode which-func-modes))
1508    
1509  (define-derived-mode mh-folder-mode fundamental-mode "MH-Folder"  (define-derived-mode mh-folder-mode fundamental-mode "MH-Folder"
1510    "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>
1511    
# Line 1548  You can show the message the cursor is p Line 1513  You can show the message the cursor is p
1513  messages.  Messages can be marked for deletion or refiling into another  messages.  Messages can be marked for deletion or refiling into another
1514  folder; these commands are executed all at once with a separate command.  folder; these commands are executed all at once with a separate command.
1515    
 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.  
   
1516  Options that control this mode can be changed with \\[customize-group];  Options that control this mode can be changed with \\[customize-group];
1517  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'
1518  option if you wish to modify scan's format.  option if you wish to modify scan's format.
1519    
1520  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.
1521    
1522    Ranges
1523    ======
1524    Many commands that operate on individual messages, such as `mh-forward' or
1525    `mh-refile-msg' take a RANGE argument. This argument can be used in several
1526    ways.
1527    
1528    If you provide the prefix argument (\\[universal-argument]) to these commands,
1529    then you will be prompted for the message range. This can be any legal MH
1530    range which can include messages, sequences, and the abbreviations (described
1531    in the mh(1) man page):
1532    
1533    <num1>-<num2>
1534        Indicates all messages in the range <num1> to <num2>, inclusive. The range
1535        must be nonempty.
1536    
1537    `<num>:N'
1538    `<num>:+N'
1539    `<num>:-N'
1540        Up to N messages beginning with (or ending with) message num. Num may be
1541        any of the pre-defined symbols: first, prev, cur, next or last.
1542    
1543    `first:N'
1544    `prev:N'
1545    `next:N'
1546    `last:N'
1547        The first, previous, next or last messages, if they exist.
1548    
1549    `all'
1550        All of the messages.
1551    
1552    For example, a range that shows all of these things is `1 2 3 5-10 last:5
1553    unseen'.
1554    
1555    If the option `transient-mark-mode' is set to t and you set a region in the
1556    MH-Folder buffer, then the MH-E command will perform the operation on all
1557    messages in that region.
1558    
1559  \\{mh-folder-mode-map}"  \\{mh-folder-mode-map}"
1560    
1561    (make-local-variable 'font-lock-defaults)    (make-local-variable 'font-lock-defaults)
# Line 1565  When a folder is visited, the hook `mh-f Line 1563  When a folder is visited, the hook `mh-f
1563    (make-local-variable 'desktop-save-buffer)    (make-local-variable 'desktop-save-buffer)
1564    (setq desktop-save-buffer t)    (setq desktop-save-buffer t)
1565    (mh-make-local-vars    (mh-make-local-vars
1566       'mh-colors-available-flag (mh-colors-available-p)
1567                                            ; Do we have colors available
1568     'mh-current-folder (buffer-name)     ; Name of folder, a string     'mh-current-folder (buffer-name)     ; Name of folder, a string
1569     'mh-show-buffer (format "show-%s" (buffer-name)) ; Buffer that displays msgs     'mh-show-buffer (format "show-%s" (buffer-name)) ; Buffer that displays msgs
1570     'mh-folder-filename                  ; e.g. "/usr/foobar/Mail/inbox/"     'mh-folder-filename                  ; e.g. "/usr/foobar/Mail/inbox/"
1571     (file-name-as-directory (mh-expand-file-name (buffer-name)))     (file-name-as-directory (mh-expand-file-name (buffer-name)))
1572       'mh-display-buttons-for-inline-parts-flag
1573       mh-display-buttons-for-inline-parts-flag ; Allow for display of buttons to
1574                                            ; be  toggled.
1575     'mh-arrow-marker (make-marker)       ; Marker where arrow is displayed     'mh-arrow-marker (make-marker)       ; Marker where arrow is displayed
1576     'overlay-arrow-position nil          ; Allow for simultaneous display in     'overlay-arrow-position nil          ; Allow for simultaneous display in
1577     '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 1600  When a folder is visited, the hook `mh-f
1600     'mh-sequence-notation-history (make-hash-table)     'mh-sequence-notation-history (make-hash-table)
1601                                          ; Remember what is overwritten by                                          ; Remember what is overwritten by
1602                                          ; mh-note-seq.                                          ; mh-note-seq.
1603       'imenu-create-index-function 'mh-index-create-imenu-index
1604                                            ; Setup imenu support
1605     'mh-previous-window-config nil)      ; Previous window configuration     'mh-previous-window-config nil)      ; Previous window configuration
1606    (mh-remove-xemacs-horizontal-scrollbar)    (mh-remove-xemacs-horizontal-scrollbar)
1607    (setq truncate-lines t)    (setq truncate-lines t)
# Line 1620  When a folder is visited, the hook `mh-f Line 1625  When a folder is visited, the hook `mh-f
1625             font-lock-auto-fontify)             font-lock-auto-fontify)
1626        (turn-on-font-lock)))             ; Force font-lock in XEmacs.        (turn-on-font-lock)))             ; Force font-lock in XEmacs.
1627    
1628    (defun mh-toggle-mime-buttons ()
1629      "Toggle display of buttons for inline MIME parts."
1630      (interactive)
1631      (setq mh-display-buttons-for-inline-parts-flag
1632            (not mh-display-buttons-for-inline-parts-flag))
1633      (mh-show nil t))
1634    
1635    (defun mh-colors-available-p ()
1636      "Check if colors are available in the Emacs being used."
1637      (or mh-xemacs-flag
1638          (let ((color-cells
1639                 (or (ignore-errors (mh-funcall-if-exists display-color-cells))
1640                     (ignore-errors (mh-funcall-if-exists
1641                                     x-display-color-cells)))))
1642            (and (numberp color-cells) (>= color-cells 8)))))
1643    
1644    (defun mh-colors-in-use-p ()
1645      "Check if colors are being used in the folder buffer."
1646      (and mh-colors-available-flag font-lock-mode))
1647    
1648  (defun mh-make-local-vars (&rest pairs)  (defun mh-make-local-vars (&rest pairs)
1649    "Initialize local variables according to the variable-value PAIRS."    "Initialize local variables according to the variable-value PAIRS."
1650    
# Line 1631  When a folder is visited, the hook `mh-f Line 1656  When a folder is visited, the hook `mh-f
1656  (defun mh-restore-desktop-buffer (desktop-buffer-file-name  (defun mh-restore-desktop-buffer (desktop-buffer-file-name
1657                                    desktop-buffer-name                                    desktop-buffer-name
1658                                    desktop-buffer-misc)                                    desktop-buffer-misc)
1659    "Restore an MH folder buffer specified in a desktop file."    "Restore an MH folder buffer specified in a desktop file.
1660    When desktop creates a buffer, DESKTOP-BUFFER-FILE-NAME holds the file name to
1661    visit, DESKTOP-BUFFER-NAME holds the desired buffer name, and
1662    DESKTOP-BUFFER-MISC holds a list of miscellaneous info used by the
1663    `desktop-buffer-handlers' functions."
1664    (mh-find-path)    (mh-find-path)
1665    (mh-visit-folder desktop-buffer-name)    (mh-visit-folder desktop-buffer-name)
1666    (current-buffer))    (current-buffer))
# Line 1641  When a folder is visited, the hook `mh-f Line 1670  When a folder is visited, the hook `mh-f
1670  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
1671  refiles aren't carried out.  refiles aren't carried out.
1672  Return in the folder's buffer."  Return in the folder's buffer."
1673      (when (stringp range)
1674        (setq range (delete "" (split-string range "[ \t\n]"))))
1675    (cond ((null (get-buffer folder))    (cond ((null (get-buffer folder))
1676           (mh-make-folder folder))           (mh-make-folder folder))
1677          (t          (t
# Line 1693  If UPDATE, append the scan lines, otherw Line 1724  If UPDATE, append the scan lines, otherw
1724        (goto-char scan-start)        (goto-char scan-start)
1725        (cond ((looking-at "scan: no messages in")        (cond ((looking-at "scan: no messages in")
1726               (keep-lines mh-scan-valid-regexp)) ; Flush random scan lines               (keep-lines mh-scan-valid-regexp)) ; Flush random scan lines
1727              ((looking-at "scan: bad message list ")              ((looking-at (if (mh-variant-p 'mu-mh)
1728                                 "scan: message set .* does not exist"
1729                               "scan: bad message list "))
1730               (keep-lines mh-scan-valid-regexp))               (keep-lines mh-scan-valid-regexp))
1731              ((looking-at "scan: "))     ; Keep error messages              ((looking-at "scan: "))     ; Keep error messages
1732              (t              (t
# Line 1869  in what is now stored in the buffer-loca Line 1902  in what is now stored in the buffer-loca
1902                                    (""))))))                                    (""))))))
1903        (mh-logo-display))))        (mh-logo-display))))
1904    
 ;;; 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)))))  
   
1905  (defun mh-add-sequence-notation (msg internal-seq-flag)  (defun mh-add-sequence-notation (msg internal-seq-flag)
1906    "Add sequence notation to the MSG on the current line.    "Add sequence notation to the MSG on the current line.
1907  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
1908  current line, so that font-lock would automatically refontify it."  turned on."
1909    (with-mh-folder-updating (t)    (with-mh-folder-updating (t)
1910      (save-excursion      (save-excursion
1911        (beginning-of-line)        (beginning-of-line)
1912        (if internal-seq-flag        (if internal-seq-flag
1913            (mh-notate nil nil mh-cmd-note)            (progn
1914                ;; Change the buffer so that if transient-mark-mode is active
1915                ;; and there is an active region it will get deactivated as in
1916                ;; the case of user sequences.
1917                (mh-notate nil nil mh-cmd-note)
1918                (when font-lock-mode
1919                  (font-lock-fontify-region (point) (line-end-position))))
1920          (forward-char (1+ mh-cmd-note))          (forward-char (1+ mh-cmd-note))
1921          (let ((stack (gethash msg mh-sequence-notation-history)))          (let ((stack (gethash msg mh-sequence-notation-history)))
1922            (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 1938  If ALL is non-nil, then all sequence mar
1938          (while (and all (cdr stack))          (while (and all (cdr stack))
1939            (setq stack (cdr stack)))            (setq stack (cdr stack)))
1940          (when stack          (when stack
1941            (mh-notate nil (car stack) (1+ mh-cmd-note)))            (save-excursion
1942                (beginning-of-line)
1943                (forward-char (1+ mh-cmd-note))
1944                (delete-char 1)
1945                (insert (car stack))))
1946          (setf (gethash msg mh-sequence-notation-history) (cdr stack))))))          (setf (gethash msg mh-sequence-notation-history) (cdr stack))))))
1947    
1948  (defun mh-remove-cur-notation ()  (defun mh-remove-cur-notation ()
# Line 1953  If ALL is non-nil, then all sequence mar Line 1965  If ALL is non-nil, then all sequence mar
1965        (mh-remove-sequence-notation msg nil t))        (mh-remove-sequence-notation msg nil t))
1966      (clrhash mh-sequence-notation-history)))      (clrhash mh-sequence-notation-history)))
1967    
1968  ;;;###mh-autoload  
1969  (defun mh-goto-cur-msg (&optional minimal-changes-flag)  (defun mh-goto-cur-msg (&optional minimal-changes-flag)
1970    "Position the cursor at the current message.    "Position the cursor at the current message.
1971  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 2114  with no arguments, after the unseen sequ
2114    
2115  (defun mh-outstanding-commands-p ()  (defun mh-outstanding-commands-p ()
2116    "Return non-nil if there are outstanding deletes or refiles."    "Return non-nil if there are outstanding deletes or refiles."
2117    (or mh-delete-list mh-refile-list))    (save-excursion
2118        (when (eq major-mode 'mh-show-mode)
2119          (set-buffer mh-show-folder-buffer))
2120        (or mh-delete-list mh-refile-list)))
2121    
2122  (defun mh-coalesce-msg-list (messages)  (defun mh-coalesce-msg-list (messages)
2123    "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 2238  numbers, a sequence, a region in a cons
2238    "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."
2239    (or (memq name mh-internal-seqs)    (or (memq name mh-internal-seqs)
2240        (eq name mh-unseen-seq)        (eq name mh-unseen-seq)
2241        (and mh-tick-seq (eq name mh-tick-seq))        (and (mh-colors-in-use-p) mh-tick-seq (eq name mh-tick-seq))
2242        (eq name mh-previous-seq)        (eq name mh-previous-seq)
2243        (mh-folder-name-p name)))        (mh-folder-name-p name)))
2244    
# Line 2264  change." Line 2279  change."
2279        (when (and (eq sequence mh-unseen-seq) (mh-speed-flists-active-p))        (when (and (eq sequence mh-unseen-seq) (mh-speed-flists-active-p))
2280          (apply #'mh-speed-flists t folders-changed)))))          (apply #'mh-speed-flists t folders-changed)))))
2281    
2282    (defun mh-catchup (range)
2283      "Delete RANGE from the `mh-unseen-seq' sequence.
2284    
2285    Check the document of `mh-interactive-range' to see how RANGE is read in
2286    interactive use."
2287      (interactive (list (mh-interactive-range "Catchup"
2288                                               (cons (point-min) (point-max)))))
2289      (mh-delete-msg-from-seq range mh-unseen-seq))
2290    
2291  (defun mh-delete-a-msg-from-seq (msg sequence internal-flag)  (defun mh-delete-a-msg-from-seq (msg sequence internal-flag)
2292    "Delete MSG from SEQUENCE.    "Delete MSG from SEQUENCE.
2293  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 2315  Signals an error if SEQ is an illegal na
2315                             "-sequence" (symbol-name seq)                             "-sequence" (symbol-name seq)
2316                             (mh-coalesce-msg-list msgs)))))                             (mh-coalesce-msg-list msgs)))))
2317    
 (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))))  
   
2318  (defun mh-seq-containing-msg (msg &optional include-internal-flag)  (defun mh-seq-containing-msg (msg &optional include-internal-flag)
2319    "Return a list of the sequences containing MSG.    "Return a list of the sequences containing MSG.
2320  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 2341  If INCLUDE-INTERNAL-FLAG non-nil, includ Line 2348  If INCLUDE-INTERNAL-FLAG non-nil, includ
2348    "'"           mh-toggle-tick    "'"           mh-toggle-tick
2349    ","           mh-header-display    ","           mh-header-display
2350    "."           mh-alt-show    "."           mh-alt-show
2351      ";"           mh-toggle-mh-decode-mime-flag
2352    ">"           mh-write-msg-to-file    ">"           mh-write-msg-to-file
2353    "?"           mh-help    "?"           mh-help
2354    "E"           mh-extract-rejected-mail    "E"           mh-extract-rejected-mail
# Line 2362  If INCLUDE-INTERNAL-FLAG non-nil, includ Line 2370  If INCLUDE-INTERNAL-FLAG non-nil, includ
2370    "g"           mh-goto-msg    "g"           mh-goto-msg
2371    "i"           mh-inc-folder    "i"           mh-inc-folder
2372    "k"           mh-delete-subject-or-thread    "k"           mh-delete-subject-or-thread
   "l"           mh-print-msg  
2373    "m"           mh-alt-send    "m"           mh-alt-send
2374    "n"           mh-next-undeleted-msg    "n"           mh-next-undeleted-msg
2375    "\M-n"        mh-next-unread-msg    "\M-n"        mh-next-unread-msg
# Line 2382  If INCLUDE-INTERNAL-FLAG non-nil, includ Line 2389  If INCLUDE-INTERNAL-FLAG non-nil, includ
2389    "?"           mh-prefix-help    "?"           mh-prefix-help
2390    "'"           mh-index-ticked-messages    "'"           mh-index-ticked-messages
2391    "S"           mh-sort-folder    "S"           mh-sort-folder
2392      "c"           mh-catchup
2393    "f"           mh-alt-visit-folder    "f"           mh-alt-visit-folder
2394    "i"           mh-index-search    "i"           mh-index-search
2395    "k"           mh-kill-folder    "k"           mh-kill-folder
# Line 2402  If INCLUDE-INTERNAL-FLAG non-nil, includ Line 2410  If INCLUDE-INTERNAL-FLAG non-nil, includ
2410    "b"           mh-junk-blacklist    "b"           mh-junk-blacklist
2411    "w"           mh-junk-whitelist)    "w"           mh-junk-whitelist)
2412    
2413    (gnus-define-keys (mh-ps-print-map "P" mh-folder-mode-map)
2414      "?"           mh-prefix-help
2415      "A"           mh-ps-print-toggle-mime
2416      "C"           mh-ps-print-toggle-color
2417      "F"           mh-ps-print-toggle-faces
2418      "M"           mh-ps-print-toggle-mime
2419      "f"           mh-ps-print-msg-file
2420      "l"           mh-print-msg
2421      "p"           mh-ps-print-msg
2422      "s"           mh-ps-print-msg-show)
2423    
2424  (gnus-define-keys (mh-sequence-map "S" mh-folder-mode-map)  (gnus-define-keys (mh-sequence-map "S" mh-folder-mode-map)
2425    "'"           mh-narrow-to-tick    "'"           mh-narrow-to-tick
2426    "?"           mh-prefix-help    "?"           mh-prefix-help
# Line 2446  If INCLUDE-INTERNAL-FLAG non-nil, includ Line 2465  If INCLUDE-INTERNAL-FLAG non-nil, includ
2465  (gnus-define-keys (mh-mime-map "K" mh-folder-mode-map)  (gnus-define-keys (mh-mime-map "K" mh-folder-mode-map)
2466    "?"           mh-prefix-help    "?"           mh-prefix-help
2467    "a"           mh-mime-save-parts    "a"           mh-mime-save-parts
2468      "e"           mh-display-with-external-viewer
2469    "i"           mh-folder-inline-mime-part    "i"           mh-folder-inline-mime-part
2470    "o"           mh-folder-save-mime-part    "o"           mh-folder-save-mime-part
2471      "t"           mh-toggle-mime-buttons
2472    "v"           mh-folder-toggle-mime-part    "v"           mh-folder-toggle-mime-part
2473    "\t"          mh-next-button    "\t"          mh-next-button
2474    [backtab]     mh-prev-button    [backtab]     mh-prev-button
# Line 2477  If INCLUDE-INTERNAL-FLAG non-nil, includ Line 2498  If INCLUDE-INTERNAL-FLAG non-nil, includ
2498  (defvar mh-help-messages  (defvar mh-help-messages
2499    '((nil "[i]nc, [.]show, [,]show all, [n]ext, [p]revious,\n"    '((nil "[i]nc, [.]show, [,]show all, [n]ext, [p]revious,\n"
2500           "[d]elete, [o]refile, e[x]ecute,\n"           "[d]elete, [o]refile, e[x]ecute,\n"
2501           "[s]end, [r]eply.\n"           "[s]end, [r]eply,\n"
2502             "[;]toggle MIME decoding.\n"
2503           "Prefix characters:\n [F]older, [S]equence, [J]unk, MIME [K]eys,"           "Prefix characters:\n [F]older, [S]equence, [J]unk, MIME [K]eys,"
2504           "\n [T]hread, [/]limit, e[X]tract, [D]igest, [I]nc spools.")           "\n [T]hread, [/]limit, e[X]tract, [D]igest, [I]nc spools.")
2505    
2506      (?F "[l]ist; [v]isit folder;\n"      (?F "[l]ist; [v]isit folder;\n"
2507          "[n]ew messages; [']ticked messages; [s]earch; [i]ndexed search;\n"          "[n]ew messages; [']ticked messages; [s]earch; [i]ndexed search;\n"
2508          "[p]ack; [S]ort; [r]escan; [k]ill")          "[p]ack; [S]ort; [r]escan; [k]ill")
2509        (?P "PS [p]rint message; [l]non-PS print;\n"
2510            "PS Print [s]how window, message to [f]ile;\n"
2511            "Toggle printing of [M]IME parts, [C]olor, [F]aces")
2512      (?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"
2513          "[s]equences, [l]ist,\n"          "[s]equences, [l]ist,\n"
2514          "[d]elete message from sequence, [k]ill sequence")          "[d]elete message from sequence, [k]ill sequence")

Legend:
Removed from v.1.11  
changed lines
  Added in v.1.11.2.1

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