comparison lisp/mh-e/mh-alias.el @ 68520:6a7173abcf59

* mh-acros.el (mh-defun-compat, mh-defmacro-compat): Add name argument since compatibility functions should have our package prefix (mh-) by Emacs convention and to avoid messing up checks for the same functions in other packages. Use explicit argument instead of forming name by adding mh-e prefix so that one can grep and find the definition. * mh-alias.el (mh-alias-local-users, mh-alias-reload) (mh-alias-expand, mh-alias-minibuffer-confirm-address): Use mh-assoc-string instead of assoc-string. * mh-compat.el (assoc-string): Rename to mh-assoc-string. (mh-mail-abbrev-make-syntax-table, mh-url-hexify-string): Move here from mh-utils.el. (mh-display-completion-list): Move here from mh-comp.el. (mh-face-foreground, mh-face-background): Move here from mh-xface.el. (mh-write-file-functions): Move here from mh-folder.el * mh-folder.el (mh-write-file-functions-compat): Move to mh-compat.el and rename to mh-write-file-functions. (mh-folder-mode): Use the new name. * mh-gnus.el (gnus-local-map-property): Rename to mh-gnus-local-map-property. (mm-merge-handles): Rename to mh-mm-merge-handles. (mm-set-handle-multipart-parameter): Rename to mh-mm-set-handle-multipart-parameter. (mm-inline-text-vcard): Rename to mh-mm-inline-text-vcard. (mm-possibly-verify-or-decrypt): Rename to mh-mm-possibly-verify-or-decrypt. (mm-handle-multipart-ctl-parameter): Rename to mh-mm-handle-multipart-ctl-parameter. (mm-readable-p): Rename to mh-mm-readable-p. (mm-long-lines-p): Rename to mh-mm-long-lines-p. (mm-keep-viewer-alive-p): Rename to mh-mm-keep-viewer-alive-p. (mm-destroy-parts): Rename to mh-mm-destroy-parts. (mm-uu-dissect-text-parts): Rename to mh-mm-uu-dissect-text-parts. (mml-minibuffer-read-disposition): Rename to mh-mml-minibuffer-read-disposition. * mh-identity.el (mh-identity-field-handler): Use mh-assoc-string instead of assoc-string. * mh-mime.el (mh-mm-inline-media-tests, mh-mm-inline-message) (mh-mime-display, mh-mime-display-security) (mh-insert-mime-button, mh-insert-mime-security-button) (mh-handle-set-external-undisplayer) (mh-mime-security-press-button, mh-mime-security-show-details) (mh-mml-attach-file, mh-mime-cleanup) (mh-destroy-postponed-handles): Use new mh-* names for compatibility functions. * mh-utils.el (mail-abbrev-make-syntax-table): Move to mh-compat.el and rename to mh-mail-abbrev-make-syntax-table. (mh-beginning-of-word): Use the new name. (mh-get-field): Delete ancient alias. * mh-xface.el (mh-face-foreground-compat): Move to mh-compat.el and rename to mh-face-foreground (mh-face-background-compat): Move to mh-compat.el and rename to mh-face-background. (mh-face-display-function): Use the new names. (mh-x-image-url-cache-canonicalize): Use mh-url-hexify-string instead of url-hexify-string. (url-unreserved-chars): Move to mh-compat.el and rename to mh-url-unreserved-chars. (url-hexify-string): Move to mh-compat.el and rename to mh-url-hexify-string.
author Bill Wohler <wohler@newt.com>
date Tue, 31 Jan 2006 20:46:15 +0000
parents 37d03b3298bf
children 7daec5f4a289 7432ca837c8d
comparison
equal deleted inserted replaced
68519:bf46ace1ce4e 68520:6a7173abcf59
167 username)) 167 username))
168 (alias-translation 168 (alias-translation
169 (if (string-equal username realname) 169 (if (string-equal username realname)
170 (concat "<" username ">") 170 (concat "<" username ">")
171 (concat realname " <" username ">")))) 171 (concat realname " <" username ">"))))
172 (when (not (assoc-string alias-name mh-alias-alist t)) 172 (when (not (mh-assoc-string alias-name mh-alias-alist t))
173 (setq passwd-alist (cons (list alias-name alias-translation) 173 (setq passwd-alist (cons (list alias-name alias-translation)
174 passwd-alist))))))) 174 passwd-alist)))))))
175 (forward-line 1))) 175 (forward-line 1)))
176 passwd-alist)) 176 passwd-alist))
177 177
196 (setq mh-alias-blind-alist nil) 196 (setq mh-alias-blind-alist nil)
197 (while (< (point) (point-max)) 197 (while (< (point) (point-max))
198 (cond 198 (cond
199 ((looking-at "^[ \t]")) ;Continuation line 199 ((looking-at "^[ \t]")) ;Continuation line
200 ((looking-at "\\(.+\\): .+: .*$") ; A new -blind- MH alias 200 ((looking-at "\\(.+\\): .+: .*$") ; A new -blind- MH alias
201 (when (not (assoc-string (match-string 1) mh-alias-blind-alist t)) 201 (when (not (mh-assoc-string (match-string 1) mh-alias-blind-alist t))
202 (setq mh-alias-blind-alist 202 (setq mh-alias-blind-alist
203 (cons (list (match-string 1)) mh-alias-blind-alist)) 203 (cons (list (match-string 1)) mh-alias-blind-alist))
204 (setq mh-alias-alist (cons (list (match-string 1)) mh-alias-alist)))) 204 (setq mh-alias-alist (cons (list (match-string 1)) mh-alias-alist))))
205 ((looking-at "\\(.+\\): .*$") ; A new MH alias 205 ((looking-at "\\(.+\\): .*$") ; A new MH alias
206 (when (not (assoc-string (match-string 1) mh-alias-alist t)) 206 (when (not (mh-assoc-string (match-string 1) mh-alias-alist t))
207 (setq mh-alias-alist 207 (setq mh-alias-alist
208 (cons (list (match-string 1)) mh-alias-alist))))) 208 (cons (list (match-string 1)) mh-alias-alist)))))
209 (forward-line 1))) 209 (forward-line 1)))
210 (when mh-alias-local-users 210 (when mh-alias-local-users
211 (setq mh-alias-passwd-alist (mh-alias-local-users)) 211 (setq mh-alias-passwd-alist (mh-alias-local-users))
212 ;; Update aliases with local users, but leave existing aliases alone. 212 ;; Update aliases with local users, but leave existing aliases alone.
213 (let ((local-users mh-alias-passwd-alist) 213 (let ((local-users mh-alias-passwd-alist)
214 user) 214 user)
215 (while local-users 215 (while local-users
216 (setq user (car local-users)) 216 (setq user (car local-users))
217 (if (not (assoc-string (car user) mh-alias-alist t)) 217 (if (not (mh-assoc-string (car user) mh-alias-alist t))
218 (setq mh-alias-alist (append mh-alias-alist (list user)))) 218 (setq mh-alias-alist (append mh-alias-alist (list user))))
219 (setq local-users (cdr local-users))))) 219 (setq local-users (cdr local-users)))))
220 (run-hooks 'mh-alias-reloaded-hook) 220 (run-hooks 'mh-alias-reloaded-hook)
221 (message "Loading MH aliases...done")) 221 (message "Loading MH aliases...done"))
222 222
249 249
250 (defun mh-alias-expand (alias) 250 (defun mh-alias-expand (alias)
251 "Return expansion for ALIAS. 251 "Return expansion for ALIAS.
252 Blind aliases or users from /etc/passwd are not expanded." 252 Blind aliases or users from /etc/passwd are not expanded."
253 (cond 253 (cond
254 ((assoc-string alias mh-alias-blind-alist t) 254 ((mh-assoc-string alias mh-alias-blind-alist t)
255 alias) ; Don't expand a blind alias 255 alias) ; Don't expand a blind alias
256 ((assoc-string alias mh-alias-passwd-alist t) 256 ((mh-assoc-string alias mh-alias-passwd-alist t)
257 (cadr (assoc-string alias mh-alias-passwd-alist t))) 257 (cadr (mh-assoc-string alias mh-alias-passwd-alist t)))
258 (t 258 (t
259 (mh-alias-ali alias)))) 259 (mh-alias-ali alias))))
260 260
261 (require 'crm nil t) ; completing-read-multiple 261 (require 'crm nil t) ; completing-read-multiple
262 (require 'multi-prompt nil t) 262 (require 'multi-prompt nil t)
290 (when mh-alias-flash-on-comma 290 (when mh-alias-flash-on-comma
291 (save-excursion 291 (save-excursion
292 (let* ((case-fold-search t) 292 (let* ((case-fold-search t)
293 (beg (mh-beginning-of-word)) 293 (beg (mh-beginning-of-word))
294 (the-name (buffer-substring-no-properties beg (point)))) 294 (the-name (buffer-substring-no-properties beg (point))))
295 (if (assoc-string the-name mh-alias-alist t) 295 (if (mh-assoc-string the-name mh-alias-alist t)
296 (message "%s -> %s" the-name (mh-alias-expand the-name)) 296 (message "%s -> %s" the-name (mh-alias-expand the-name))
297 ;; Check if if was a single word likely to be an alias 297 ;; Check if if was a single word likely to be an alias
298 (if (and (equal mh-alias-flash-on-comma 1) 298 (if (and (equal mh-alias-flash-on-comma 1)
299 (not (string-match " " the-name))) 299 (not (string-match " " the-name)))
300 (message "No alias for %s" the-name)))))) 300 (message "No alias for %s" the-name))))))