Function: mh-narrow-to-header-field

mh-narrow-to-header-field is a byte-compiled function defined in mh-limit.el.gz.

Signature

(mh-narrow-to-header-field HEADER-FIELD PICK-EXPR)

Documentation

Limit to messages whose HEADER-FIELD match PICK-EXPR.

The MH command pick is used to do the match.

Source Code

;; Defined in /usr/src/emacs/lisp/mh-e/mh-limit.el.gz
(defun mh-narrow-to-header-field (_header-field pick-expr)
  "Limit to messages whose HEADER-FIELD match PICK-EXPR.
The MH command pick is used to do the match."
  (let ((folder mh-current-folder)
        (original (mh-coalesce-msg-list
                   (mh-range-to-msg-list (cons (point-min) (point-max)))))
        (msg-list ()))
    (with-temp-buffer
      (apply #'mh-exec-cmd-output "pick" nil folder
             (append original (list "-list") pick-expr))
      (goto-char (point-min))
      (while (not (eobp))
        (let ((num (ignore-errors
                     (string-to-number
                      (buffer-substring (point) (line-end-position))))))
          (when num (push num msg-list))
          (forward-line))))
    (if (null msg-list)
        (message "No matches")
      (when (assoc 'header mh-seq-list) (mh-delete-seq 'header))
      (mh-add-msgs-to-seq msg-list 'header)
      (mh-narrow-to-seq 'header))))