This value is used when the value of `mail-directory-function'
is `mail-directory-process'. The value should be a list
of the form (COMMAND ARG ...), where each of the list elements
-is evaluated. When `mail-directory-requery' is non-nil, during
-evaluation of these elements, the variable `pattern' contains
-the partial input being completed.
+is evaluated. COMMAND should evaluate to a string. When
+`mail-directory-requery' is non-nil, during evaluation of these
+elements, the variable `pattern' contains the partial input being
+completed. `pattern' is nil when `mail-directory-requery' is nil.
The value might look like this:
"Alist of local users, aliases and directory entries as available.
Elements have the form (MAILNAME) or (MAILNAME . FULLNAME).
If the value means t, it means the real value should be calculated
-for the next use. this is used in `mail-complete'.")
+for the next use. This is used in `mail-complete'.")
(defvar mail-local-names t
"Alist of local users.
mail-aliases))
(if (consp mail-local-names)
mail-local-names)
- (or directory mail-directory-names))
+ (or directory
+ (when (consp mail-directory-names)
+ mail-directory-names)))
(lambda (a b)
;; should cache downcased strings
(string< (downcase (car a))
(defun mail-directory (pattern)
- "Call directory to get names matching PATTERN or all if nil.
-Calls `mail-directory-function' and applies `mail-directory-parser' to output."
+ "Use mail-directory facility to get user names matching PATTERN.
+If PATTERN is nil, get all the defined user names.
+This function calls `mail-directory-function' to query the directory,
+then uses `mail-directory-parser' to parse the output it returns."
(save-excursion
(message "Querying directory...")
(set-buffer (generate-new-buffer " *mail-directory*"))
(defun mail-directory-process (pattern)
"Run a shell command to output names in directory.
See `mail-directory-process'."
- (apply 'call-process (eval (car mail-directory-process)) nil t nil
- (mapcar 'eval (cdr mail-directory-process))))
+ (when (consp mail-directory-process)
+ (apply 'call-process (eval (car mail-directory-process)) nil t nil
+ (mapcar 'eval (cdr mail-directory-process)))))
;; This should handle a dialog. Currently expects port to spit out names.
(defun mail-directory-stream (pattern)