/[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.30 by wohler, Fri Oct 28 01:59:11 2005 UTC revision 1.31 by wohler, Sat Oct 29 05:09:04 2005 UTC
# Line 114  The string is displayed after the folder Line 114  The string is displayed after the folder
114  ;; The following scan formats are passed to the scan program if the setting of  ;; The following scan formats are passed to the scan program if the setting of
115  ;; `mh-scan-format-file' is t. They are identical except the later one makes  ;; `mh-scan-format-file' is t. They are identical except the later one makes
116  ;; use of the nmh `decode' function to decode RFC 2047 encodings. If you just  ;; use of the nmh `decode' function to decode RFC 2047 encodings. If you just
117  ;; want to change the width of the msg number, use the `mh-set-cmd-note'  ;; want to change the column of the notations, use the `mh-set-cmd-note'
118  ;; function.  ;; function.
119    
120  (defvar mh-scan-format-mh  (defvar mh-scan-format-mh
# Line 338  originator, or a \"To: address\" for out Line 338  originator, or a \"To: address\" for out
338    "Number of columns consumed by whitespace after from-mbox in `mh-scan-format'.    "Number of columns consumed by whitespace after from-mbox in `mh-scan-format'.
339  This column will only ever have spaces in it.")  This column will only ever have spaces in it.")
340    
341    (defvar mh-scan-field-destination-offset
342      (+ mh-scan-cmd-note-width)
343      "The offset from the `mh-cmd-note' for the destination column.")
344    
345  (defvar mh-scan-field-from-start-offset  (defvar mh-scan-field-from-start-offset
346    (+ mh-scan-cmd-note-width    (+ mh-scan-cmd-note-width
347       mh-scan-destination-width       mh-scan-destination-width
# Line 1402  Make it the current folder." Line 1406  Make it the current folder."
1406    (setq buffer-read-only nil)    (setq buffer-read-only nil)
1407    (erase-buffer)    (erase-buffer)
1408    (if mh-adaptive-cmd-note-flag    (if mh-adaptive-cmd-note-flag
1409        (mh-set-cmd-note (mh-message-number-width name)))        (mh-set-cmd-note (mh-msg-num-width-to-column (mh-msg-num-width name))))
1410    (setq buffer-read-only t)    (setq buffer-read-only t)
1411    (mh-folder-mode)    (mh-folder-mode)
1412    (mh-set-folder-modified-p nil)    (mh-set-folder-modified-p nil)
# Line 1719  Return in the folder's buffer." Line 1723  Return in the folder's buffer."
1723    (when (mh-outstanding-commands-p)    (when (mh-outstanding-commands-p)
1724      (mh-notate-deleted-and-refiled)))      (mh-notate-deleted-and-refiled)))
1725    
1726  (defun mh-set-cmd-note (width)  (defun mh-msg-num-width-to-column (width)
1727    "Set `mh-cmd-note' to WIDTH (minimum of 2).    "Return the column for notations given message number WIDTH.
1728    Note that columns in Emacs start with 0.
1729  If `mh-scan-format-file' is set to \"Use Default scan Format\" or \"Specify a  
1730  scan Format File\", then this function will NOT update `mh-cmd-note'. In these  If `mh-scan-format-file' is set to \"Use MH-E scan Format\" this means that
1731  cases, the user should change `mh-cmd-note' with `setq' if necessary.  either `mh-scan-format-mh' or `mh-scan-format-nmh' are in use. This function
1732    therefore assumes that the first column is empty (to provide room for the
1733    cursor), the following WIDTH columns contain the message number, and the
1734    column for notations comes after that."
1735      (if (eq mh-scan-format-file t)
1736          (max (1+ width) 2)
1737        (error "%s %s" "Can't call mh-msg-num-width-to-column"
1738               "when mh-scan-format-file is not t")))
1739    
1740    (defun mh-set-cmd-note (column)
1741      "Set `mh-cmd-note' to COLUMN.
1742  Note that columns in Emacs start with 0."  Note that columns in Emacs start with 0."
1743    ;; Add one to the width to always have whitespace in column zero.    (setq mh-cmd-note column))
   (setq width (max (1+ width) 2))  
   (if (and (equal mh-scan-format-file t)  
            (not (eq mh-cmd-note width)))  
       (setq mh-cmd-note width))  
   mh-cmd-note)  
1744    
1745  (defun mh-regenerate-headers (range &optional update)  (defun mh-regenerate-headers (range &optional update)
1746    "Scan folder over range RANGE.    "Scan folder over range RANGE.
# Line 1747  If UPDATE, append the scan lines, otherw Line 1755  If UPDATE, append the scan lines, otherw
1755            (goto-char (point-max))            (goto-char (point-max))
1756          (delete-region (point-min) (point-max))          (delete-region (point-min) (point-max))
1757          (if mh-adaptive-cmd-note-flag          (if mh-adaptive-cmd-note-flag
1758              (mh-set-cmd-note (mh-message-number-width folder))))              (mh-set-cmd-note (mh-msg-num-width-to-column (mh-msg-num-width
1759                                                              folder)))))
1760        (setq scan-start (point))        (setq scan-start (point))
1761        (apply #'mh-exec-cmd-output        (apply #'mh-exec-cmd-output
1762               mh-scan-prog nil               mh-scan-prog nil
# Line 1781  If UPDATE, append the scan lines, otherw Line 1790  If UPDATE, append the scan lines, otherw
1790  After doing an `mh-get-new-mail' operation in this FOLDER, at least  After doing an `mh-get-new-mail' operation in this FOLDER, at least
1791  one line that looks like a truncated message number was found.  one line that looks like a truncated message number was found.
1792    
1793  Remove the text added by the last `mh-inc' command. It should be the  Remove the text added by the last `mh-inc' command. It should be the messages
1794  messages cur-last. Call `mh-set-cmd-note' with the widest message number  cur-last. Call `mh-set-cmd-note', adjusting the notation column with the width
1795  in FOLDER.  of the largest message number in FOLDER.
1796    
1797  Reformat the message number width on each line in the buffer and trim  Reformat the message number width on each line in the buffer and trim
1798  the line length to fit in the window.  the line length to fit in the window.
# Line 1800  line now with no message truncation." Line 1809  line now with no message truncation."
1809        (delete-char (- (point-max) (point)))        (delete-char (- (point-max) (point)))
1810        ;; Update the current buffer to reflect the new mh-cmd-note        ;; Update the current buffer to reflect the new mh-cmd-note
1811        ;; value needed to display messages.        ;; value needed to display messages.
1812        (mh-set-cmd-note (mh-message-number-width folder))        (mh-set-cmd-note (mh-msg-num-width-to-column (mh-msg-num-width folder)))
1813        (setq mh-cmd-note-fmt (concat "%" (format "%d" mh-cmd-note) "d"))        (setq mh-cmd-note-fmt (concat "%" (format "%d" mh-cmd-note) "d"))
1814        ;; Cleanup the messages that are in the buffer right now        ;; Cleanup the messages that are in the buffer right now
1815        (goto-char (point-min))        (goto-char (point-min))
# Line 1958  turned on." Line 1967  turned on."
1967              (mh-notate nil nil mh-cmd-note)              (mh-notate nil nil mh-cmd-note)
1968              (when font-lock-mode              (when font-lock-mode
1969                (font-lock-fontify-region (point) (line-end-position))))                (font-lock-fontify-region (point) (line-end-position))))
1970          (forward-char (1+ mh-cmd-note))          (forward-char (+ mh-cmd-note mh-scan-field-destination-offset))
1971          (let ((stack (gethash msg mh-sequence-notation-history)))          (let ((stack (gethash msg mh-sequence-notation-history)))
1972            (setf (gethash msg mh-sequence-notation-history)            (setf (gethash msg mh-sequence-notation-history)
1973                  (cons (char-after) stack)))                  (cons (char-after) stack)))
1974          (mh-notate nil mh-note-seq (1+ mh-cmd-note))))))          (mh-notate nil mh-note-seq
1975                       (+ mh-cmd-note mh-scan-field-destination-offset))))))
1976    
1977  (defun mh-remove-sequence-notation (msg internal-seq-flag &optional all)  (defun mh-remove-sequence-notation (msg internal-seq-flag &optional all)
1978    "Remove sequence notation from the MSG on the current line.    "Remove sequence notation from the MSG on the current line.
# Line 1981  If ALL is non-nil, then all sequence mar Line 1991  If ALL is non-nil, then all sequence mar
1991          (when stack          (when stack
1992            (save-excursion            (save-excursion
1993              (beginning-of-line)              (beginning-of-line)
1994              (forward-char (1+ mh-cmd-note))              (forward-char (+ mh-cmd-note mh-scan-field-destination-offset))
1995              (delete-char 1)              (delete-char 1)
1996              (insert (car stack))))              (insert (car stack))))
1997          (setf (gethash msg mh-sequence-notation-history) (cdr stack))))))          (setf (gethash msg mh-sequence-notation-history) (cdr stack))))))

Legend:
Removed from v.1.30  
changed lines
  Added in v.1.31

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