Function: mh-alias-apropos
mh-alias-apropos is an interactive and byte-compiled function defined
in mh-alias.el.gz.
Signature
(mh-alias-apropos REGEXP)
Documentation
Show all aliases or addresses that match a regular expression REGEXP.
Key Bindings
Source Code
;; Defined in /usr/src/emacs/lisp/mh-e/mh-alias.el.gz
(defun mh-alias-apropos (regexp)
"Show all aliases or addresses that match a regular expression REGEXP."
(interactive "sAlias regexp: ")
(if mh-alias-local-users
(mh-alias-reload-maybe))
(let ((matches "")
(group-matches "")
(passwd-matches))
(save-excursion
(message "Reading MH aliases...")
(mh-exec-cmd-quiet t "ali" "-nolist" "-nouser")
(message "Parsing MH aliases...")
(while (re-search-forward regexp nil t)
(beginning-of-line)
(cond
((looking-at "^[ \t]") ;Continuation line
(setq group-matches
(concat group-matches
(buffer-substring
(save-excursion
(or (re-search-backward "^[^ \t]" nil t)
(point)))
(progn
(if (re-search-forward "^[^ \t]" nil t)
(forward-char -1))
(point))))))
(t
(setq matches
(concat matches
(buffer-substring (point)(progn (end-of-line)(point)))
"\n")))))
(message "Parsing MH aliases...done")
(when mh-alias-local-users
(message "Making passwd aliases...")
(setq passwd-matches
(mapconcat
(lambda (elem)
(if (or (string-match regexp (car elem))
(string-match regexp (cadr elem)))
(format "%s: %s\n" (car elem) (cadr elem))))
mh-alias-passwd-alist ""))
(message "Making passwd aliases...done")))
(if (and (string-equal "" matches)
(string-equal "" group-matches)
(string-equal "" passwd-matches))
(message "No matches")
(with-output-to-temp-buffer mh-aliases-buffer
(if (not (string-equal "" matches))
(princ matches))
(when (not (string-equal group-matches ""))
(princ "\nGroup Aliases:\n\n")
(princ group-matches))
(when (not (string-equal passwd-matches ""))
(princ "\nLocal User Aliases:\n\n")
(princ passwd-matches))))))