changeset 60964:0b933f58d514

(mail-directory-process): Do nothing if mail-directory-process is an atom. (mail-get-names): Ignore mail-directory-names if it is an atom. (mail-directory-process defvar): Doc fix. (mail-names): Doc fix.
author Richard M. Stallman <rms@gnu.org>
date Sat, 26 Mar 2005 02:13:35 +0000
parents 951cb9c59174
children 7b5c3ff57835
files lisp/mail/mailalias.el
diffstat 1 files changed, 15 insertions(+), 9 deletions(-) [+]
line wrap: on
line diff
--- a/lisp/mail/mailalias.el	Sat Mar 26 02:07:08 2005 +0000
+++ b/lisp/mail/mailalias.el	Sat Mar 26 02:13:35 2005 +0000
@@ -111,9 +111,10 @@
 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:
 
@@ -149,7 +150,7 @@
   "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.
@@ -469,7 +470,9 @@
 				     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))
@@ -478,8 +481,10 @@
 
 
 (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*"))
@@ -509,8 +514,9 @@
 (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)