comparison lisp/mail/mailalias.el @ 18161:1f13d44dcbbf

Customize. Doc fixes. Mark some risky local variables.
author Richard M. Stallman <rms@gnu.org>
date Sat, 07 Jun 1997 23:12:19 +0000
parents 7faea977229c
children 0fa57e6872f0
comparison
equal deleted inserted replaced
18160:c64b7a17eea9 18161:1f13d44dcbbf
30 30
31 ;;; Code: 31 ;;; Code:
32 32
33 (require 'sendmail) 33 (require 'sendmail)
34 34
35 (defvar mail-names t 35 (defgroup mailalias nil
36 "Alist of local users, aliases and directory entries as available. 36 "Expanding mail aliases"
37 Elements have the form (MAILNAME) or (MAILNAME . FULLNAME). 37 :group 'mail)
38 If the value means t, it means the real value should be calculated 38
39 for the next use. this is used in `mail-complete'.") 39 (defcustom mail-passwd-files '("/etc/passwd")
40 40 "*List of files from which to determine valid user names."
41 (defvar mail-local-names t 41 :type '(repeat string)
42 "Alist of local users. 42 :group 'mailalias)
43 When t this still needs to be initialized.") 43
44 44 (defcustom mail-passwd-command nil
45 (defvar mail-passwd-files '("/etc/passwd") 45 "*Shell command to retrieve text to add to `/etc/passwd', or nil."
46 "List of files from which to determine valid user names.") 46 :type '(choice string (const nil))
47 47 :group 'mailalias)
48 (defvar mail-passwd-command nil
49 "Shell command to retrieve text to add to `/etc/passwd', or nil.")
50 48
51 (defvar mail-directory-names t 49 (defvar mail-directory-names t
52 "Alist of mail address directory entries. 50 "Alist of mail address directory entries.
53 When t this still needs to be initialized.") 51 When t this still needs to be initialized.")
54 52
55 (defvar mail-address-field-regexp 53 (defvar mail-address-field-regexp
56 "^\\(Resent-\\)?\\(To\\|From\\|CC\\|BCC\\|Reply-to\\):") 54 "^\\(Resent-\\)?\\(To\\|From\\|CC\\|BCC\\|Reply-to\\):")
57 55
58 (defvar mail-complete-alist 56 (defcustom mail-complete-alist
59 `((,mail-address-field-regexp mail-get-names pattern) 57 `((,mail-address-field-regexp mail-get-names pattern)
60 ("Newsgroups:" . (if (boundp 'gnus-active-hashtb) 58 ("Newsgroups:" . (if (boundp 'gnus-active-hashtb)
61 gnus-active-hashtb 59 gnus-active-hashtb
62 (if (boundp news-group-article-assoc) 60 (if (boundp news-group-article-assoc)
63 news-group-article-assoc))) 61 news-group-article-assoc)))
64 ("Followup-To:" . (mail-sentto-newsgroups)) 62 ("Followup-To:" . (mail-sentto-newsgroups))
65 ;;("Distribution:" ???) 63 ;;("Distribution:" ???)
66 ) 64 )
67 "Alist of header field and expression to return alist for completion. 65 "*Alist of header field and expression to return alist for completion.
68 Expression may reference variable `pattern' which is the string being completed. 66 The expression may reference the variable `pattern'
69 If not on matching header, `mail-complete-function' gets called instead.") 67 which will hold the string being completed.
68 If not on matching header, `mail-complete-function' gets called instead."
69 :type 'sexp
70 :group 'mailalias)
71 (put 'mail-complete-alist 'risky-local-variable t)
70 72
71 ;;;###autoload 73 ;;;###autoload
72 (defvar mail-complete-style 'angles 74 (defcustom mail-complete-style 'angles
73 "*Specifies how \\[mail-complete] formats the full name when it completes. 75 "*Specifies how \\[mail-complete] formats the full name when it completes.
74 If `nil', they contain just the return address like: 76 If `nil', they contain just the return address like:
75 king@grassland.com 77 king@grassland.com
76 If `parens', they look like: 78 If `parens', they look like:
77 king@grassland.com (Elvis Parsley) 79 king@grassland.com (Elvis Parsley)
78 If `angles', they look like: 80 If `angles', they look like:
79 Elvis Parsley <king@grassland.com>") 81 Elvis Parsley <king@grassland.com>"
80 82 :type '(choice (const angles) (const parens) (const nil))
81 (defvar mail-complete-function 'ispell-complete-word 83 :group 'mailalias)
82 "Function to call when completing outside `mail-complete-alist'-header.") 84
83 85 (defcustom mail-complete-function 'ispell-complete-word
84 86 "*Function to call when completing outside `mail-complete-alist'-header."
85 (defvar mail-directory-function nil 87 :type '(choice function (const nil))
86 "Function to get completions from directory service or `nil' for none. 88 :group 'mailalias)
87 See `mail-directory-requery'.") 89
88 90 (defcustom mail-directory-function nil
91 "*Function to get completions from directory service or `nil' for none.
92 See `mail-directory-requery'."
93 :type '(choice function (const nil))
94 :group 'mailalias)
89 95
90 ;; This is for when the directory is huge, or changes frequently. 96 ;; This is for when the directory is huge, or changes frequently.
91 (defvar mail-directory-requery nil 97 (defcustom mail-directory-requery nil
92 "When non-`nil' call `mail-directory-function' for each completion. 98 "*When non-`nil' call `mail-directory-function' for each completion.
93 In that case, one argument gets passed to the function, the partial string 99 In that case, one argument gets passed to the function, the partial string
94 entered so far.") 100 entered so far."
95 101 :type 'boolean
96 102 :group 'mailalias)
97 (defvar mail-directory-process nil 103
98 "Unix command when `mail-directory-function' is `mail-directory-process'. 104 (defcustom mail-directory-process nil
99 This is a list of the form (COMMAND ARG ...), where each of the list elements 105 "*Shell command to get the list of names from a mail directory.
100 is evaluated. When `mail-directory-requery' is non-`nil', during 106 This value is used when the value of `mail-directory-function'
101 evaluation the variable `pattern' contains the partial input being completed. 107 is `mail-directory-process'. The value should be a list
102 This might look like 108 of the form (COMMAND ARG ...), where each of the list elements
109 is evaluated. When `mail-directory-requery' is non-nil, during
110 evaluation of these elements, the variable `pattern' contains
111 the partial input being completed.
112
113 The value might look like this:
103 114
104 '(remote-shell-program \"HOST\" \"-nl\" \"USER\" \"COMMAND\") 115 '(remote-shell-program \"HOST\" \"-nl\" \"USER\" \"COMMAND\")
105 116
106 or 117 or like this:
107 118
108 '(remote-shell-program \"HOST\" \"-n\" \"COMMAND '^\" pattern \"'\")") 119 '(remote-shell-program \"HOST\" \"-n\" \"COMMAND '^\" pattern \"'\")"
109 120 :type 'sexp
110 (defvar mail-directory-stream () 121 :group 'mailalias)
111 "List of (HOST SERVICE) for stream connection to mail directory.") 122 (put 'mail-directory-process 'risky-local-variable t)
112 123
113 (defvar mail-directory-parser nil 124 (defcustom mail-directory-stream nil
114 "How to interpret the output of `mail-directory-function'. 125 "*List of (HOST SERVICE) for stream connection to mail directory."
126 :type 'sexp
127 :group 'mailalias)
128 (put 'mail-directory-stream 'risky-local-variable t)
129
130 (defcustom mail-directory-parser nil
131 "*How to interpret the output of `mail-directory-function'.
115 Three types of values are possible: 132 Three types of values are possible:
116 133
117 - nil means to gather each line as one name 134 - nil means to gather each line as one name
118 - regexp means first \\(grouping\\) in successive matches is name 135 - regexp means first \\(grouping\\) in successive matches is name
119 - function called at beginning of buffer that returns an alist of names") 136 - function called at beginning of buffer that returns an alist of names"
120 137 :type '(choice (cosnt nil) regexp function)
138 :group 'mailalias)
139 (put 'mail-directory-parser 'risky-local-variable t)
140
141 ;; Internal variables.
142
143 (defvar mail-names t
144 "Alist of local users, aliases and directory entries as available.
145 Elements have the form (MAILNAME) or (MAILNAME . FULLNAME).
146 If the value means t, it means the real value should be calculated
147 for the next use. this is used in `mail-complete'.")
148
149 (defvar mail-local-names t
150 "Alist of local users.
151 When t this still needs to be initialized.")
152
121 153
122 ;; Called from sendmail-send-it, or similar functions, 154 ;; Called from sendmail-send-it, or similar functions,
123 ;; only if some mail aliases are defined. 155 ;; only if some mail aliases are defined.
124 ;;;###autoload 156 ;;;###autoload
125 (defun expand-mail-aliases (beg end &optional exclude) 157 (defun expand-mail-aliases (beg end &optional exclude)
449 (message "Querying directory...done") 481 (message "Querying directory...done")
450 directory))) 482 directory)))
451 483
452 484
453 (defun mail-directory-process (pattern) 485 (defun mail-directory-process (pattern)
454 "Call a Unix process to output names in directory. 486 "Run a shell command to output names in directory.
455 See `mail-directory-process'." 487 See `mail-directory-process'."
456 (apply 'call-process (eval (car mail-directory-process)) nil t nil 488 (apply 'call-process (eval (car mail-directory-process)) nil t nil
457 (mapcar 'eval (cdr mail-directory-process)))) 489 (mapcar 'eval (cdr mail-directory-process))))
458 490
459 ;; This should handle a dialog. Currently expects port to spit out names. 491 ;; This should handle a dialog. Currently expects port to spit out names.