Function: mh-regenerate-headers

mh-regenerate-headers is an autoloaded and byte-compiled function defined in mh-folder.el.gz.

Signature

(mh-regenerate-headers RANGE &optional UPDATE)

Documentation

Scan folder over RANGE.

If UPDATE, append the scan lines, otherwise replace.

This function has :after advice: hmh--highlight-buttons.

Source Code

;; Defined in /usr/src/emacs/lisp/mh-e/mh-folder.el.gz
;;;###mh-autoload
(defun mh-regenerate-headers (range &optional update)
  "Scan folder over RANGE.
If UPDATE, append the scan lines, otherwise replace."
  (let ((folder mh-current-folder)
        (range (if (and range (atom range)) (list range) range))
        scan-start)
    (message "Scanning %s..." folder)
    (mh-remove-all-notation)
    (with-mh-folder-updating (nil)
      (if update
          (goto-char (point-max))
        (delete-region (point-min) (point-max))
        (if mh-adaptive-cmd-note-flag
            (mh-set-cmd-note (mh-msg-num-width-to-column (mh-msg-num-width
                                                          folder)))))
      (setq scan-start (point))
      (apply #'mh-exec-cmd-output
             mh-scan-prog nil
             (mh-scan-format)
             "-noclear" "-noheader"
             "-width" (window-width)
             folder range)
      (goto-char scan-start)
      (cond ((or (looking-at "scan: no messages in")
                 (looking-at "scan: message set .* does not exist")
                 (looking-at "scan: bad message list "))
             (keep-lines mh-scan-valid-regexp)) ; flush common scan output
            ((looking-at "scan: "))             ; keep unexpected error messages
            (t
             (keep-lines mh-scan-valid-regexp))) ; flush random scan output
      (setq mh-seq-list (mh-read-folder-sequences folder nil))
      (mh-notate-user-sequences)
      (or update
          (setq mh-mode-line-annotation
                (if (equal range '("all"))
                    nil
                  mh-partial-folder-mode-line-annotation)))
      (mh-make-folder-mode-line))
    (message "Scanning %s...done" folder)))