Function: mh-grep-next-result

mh-grep-next-result is a byte-compiled function defined in mh-search.el.gz.

Signature

(mh-grep-next-result)

Documentation

Read the next result.

Parse it and return the message folder, message index and the match. If no other matches left then return nil. If the current record is invalid return error.

Source Code

;; Defined in /usr/src/emacs/lisp/mh-e/mh-search.el.gz
(defun mh-grep-next-result ()
  "Read the next result.
Parse it and return the message folder, message index and the
match. If no other matches left then return nil. If the current
record is invalid return `error'."
  (prog1
      (cl-block nil
        (when (eobp)
          (cl-return nil))
        (let ((eol-pos (line-end-position))
              (bol-pos (line-beginning-position))
              folder-start msg-end)
          (goto-char bol-pos)
          (unless (search-forward mh-user-path eol-pos t)
            (cl-return 'error))
          (setq folder-start (point))
          (unless (search-forward ":" eol-pos t)
            (cl-return 'error))
          (let ((match (buffer-substring-no-properties (point) eol-pos)))
            (forward-char -1)
            (setq msg-end (point))
            (unless (search-backward "/" folder-start t)
              (cl-return 'error))
            (list (format "+%s" (buffer-substring-no-properties
                                 folder-start (point)))
                  (let ((n (ignore-errors (string-to-number
                                           (buffer-substring-no-properties
                                            (1+ (point)) msg-end)))))
                    (or n (cl-return 'error)))
                  match))))
    (forward-line)))