Function: mh-index-update-maps
mh-index-update-maps is an autoloaded and byte-compiled function
defined in mh-search.el.gz.
Signature
(mh-index-update-maps FOLDER &optional ORIGIN-MAP)
Documentation
Annotate all as yet unannotated messages in FOLDER with their MD5 hash.
As a side effect msg -> checksum map is updated. Optional argument ORIGIN-MAP is a hash table which maps each message in the index folder to the original folder and message from whence it was copied. If present the checksum -> (origin-folder, origin-index) map is updated too.
Source Code
;; Defined in /usr/src/emacs/lisp/mh-e/mh-search.el.gz
;;;###mh-autoload
(defun mh-index-update-maps (folder &optional origin-map)
"Annotate all as yet unannotated messages in FOLDER with their MD5 hash.
As a side effect msg -> checksum map is updated. Optional
argument ORIGIN-MAP is a hash table which maps each message in the
index folder to the original folder and message from whence it
was copied. If present the checksum -> (origin-folder,
origin-index) map is updated too."
(clrhash mh-index-msg-checksum-map)
;; Clear temp buffer
(with-current-buffer (get-buffer-create mh-temp-checksum-buffer)
(erase-buffer)
;; Run scan to check if any messages needs MD5 annotations at all
(with-temp-buffer
(mh-exec-cmd-output mh-scan-prog nil "-width" "80"
"-format" "%(msg)\n%{x-mhe-checksum}\n"
folder "all")
(goto-char (point-min))
(let (msg checksum)
(while (not (eobp))
(setq msg (buffer-substring-no-properties
(point) (mh-line-end-position)))
(forward-line)
(save-excursion
(cond ((not (string-match "^[0-9]*$" msg)))
((eolp)
;; need to compute checksum
(set-buffer mh-temp-checksum-buffer)
(insert mh-user-path (substring folder 1) "/" msg "\n"))
(t
;; update maps
(setq checksum (buffer-substring-no-properties
(point) (mh-line-end-position)))
(let ((msg (string-to-number msg)))
(set-buffer folder)
(mh-index-update-single-msg msg checksum origin-map)))))
(forward-line))))
;; Run checksum program if needed
(unless (and (eobp) (bobp))
(apply #'mh-xargs mh-checksum-cmd)
(goto-char (point-min))
(while (not (eobp))
(let* ((intermediate (funcall mh-checksum-parser))
(msg (car intermediate))
(checksum (cdr intermediate)))
(when msg
;; annotate
(mh-exec-cmd "anno" folder msg "-component" "X-MHE-Checksum"
"-nodate" "-text" checksum "-inplace")
;; update maps
(with-current-buffer folder
(mh-index-update-single-msg msg checksum origin-map)))
(forward-line)))))
(mh-index-write-data))