Function: mh-swish-next-result

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

Signature

(mh-swish-next-result)

Documentation

Get the next result from swish output.

Aliases

mh-swish++-next-result

Source Code

;; Defined in /usr/src/emacs/lisp/mh-e/mh-search.el.gz
(defun mh-swish-next-result ()
  "Get the next result from swish output."
  (prog1
      (cl-block nil
        (when (or (eobp) (equal (char-after (point)) ?.))
          (cl-return nil))
        (when (equal (char-after (point)) ?#)
          (cl-return 'error))
        (let* ((start (search-forward " " (line-end-position) t))
               (end (search-forward " " (line-end-position) t)))
          (unless (and start end)
            (cl-return 'error))
          (setq end (1- end))
          (unless (file-exists-p (buffer-substring-no-properties start end))
            (cl-return 'error))
          (unless (search-backward "/" start t)
            (cl-return 'error))
          (list (let* ((s (buffer-substring-no-properties start (1+ (point)))))
                  (unless (string-match mh-swish-folder s)
                    (cl-return 'error))
                  (if (and (string-match mh-user-path s)
                           (< (match-end 0) (1- (length s))))
                      (format "+%s"
                              (substring s (match-end 0) (1- (length s))))
                    (cl-return 'error)))
                (let* ((s (buffer-substring-no-properties (1+ (point)) end))
                       (n (ignore-errors (string-to-number s))))
                  (or n (cl-return 'error)))
                nil)))
    (forward-line)))