Function: mh-mairix-regexp-builder

mh-mairix-regexp-builder is a byte-compiled function defined in mh-search.el.gz.

Signature

(mh-mairix-regexp-builder REGEXP-LIST)

Documentation

Generate query for mairix.

REGEXP-LIST is an alist of fields and values.

Source Code

;; Defined in /usr/src/emacs/lisp/mh-e/mh-search.el.gz
(defun mh-mairix-regexp-builder (regexp-list)
  "Generate query for mairix.
REGEXP-LIST is an alist of fields and values."
  (let ((result ()))
    (dolist (pair regexp-list)
      (when (cdr pair)
        (push
         (concat
          (cond ((eq (car pair) 'to) "t:")
                ((eq (car pair) 'from) "f:")
                ((eq (car pair) 'cc) "c:")
                ((eq (car pair) 'to-or-cc) "tc:")
                ((eq (car pair) 'address) "a:")
                ((eq (car pair) 'subject) "s:")
                ((eq (car pair) 'subject-or-body) "bs:")
                ((eq (car pair) 'date) "d:")
                ((eq (car pair) 'message-id) "m:")
                ((eq (car pair) 'message-body) "b:")
                ((eq (car pair) 'message-size) "z:")
                ((eq (car pair) 'message-attachment-name) "n:")
                ((eq (car pair) 'message-flags) "F:")
                (t ""))
          (let ((sop (cdr (mh-mairix-convert-to-sop* (cdr pair))))
                (final ""))
            (dolist (conjunct sop)
              (let ((expr-list (cdr conjunct))
                    (expr-string ""))
                (dolist (e expr-list)
                  (setq expr-string (concat expr-string ","
                                            (if (atom e) "" "~")
                                            (if (atom e) e (cadr e)))))
                (setq final (concat final "/" (substring expr-string 1)))))
            (substring final 1)))
         result)))
    result))