Mercurial > emacs
comparison lisp/mh-e/mh-alias.el @ 90314:d1c5430c5bff
Revision: emacs@sv.gnu.org/emacs--unicode--0--patch-21
Merge from emacs--devo--0
Patches applied:
* emacs--devo--0 (patch 97-112)
- Update from CVS
- Merge from erc--emacs--0
- Update from CVS: src/regex.c (extend_range_table_work_area): Fix typo.
- Merge from gnus--rel--5.10
* gnus--rel--5.10 (patch 37)
- Update from CVS
author | Miles Bader <miles@gnu.org> |
---|---|
date | Wed, 22 Feb 2006 06:54:10 +0000 |
parents | d6f8fe3307c8 4cb528cc4c04 |
children | 95d0cdf160ea |
comparison
equal
deleted
inserted
replaced
90313:496f6d9b9d20 | 90314:d1c5430c5bff |
---|---|
32 ;;; Code: | 32 ;;; Code: |
33 | 33 |
34 (require 'mh-e) | 34 (require 'mh-e) |
35 | 35 |
36 (mh-require-cl) | 36 (mh-require-cl) |
37 | |
38 (require 'goto-addr) | |
37 | 39 |
38 (defvar mh-alias-alist 'not-read | 40 (defvar mh-alias-alist 'not-read |
39 "Alist of MH aliases.") | 41 "Alist of MH aliases.") |
40 (defvar mh-alias-blind-alist nil | 42 (defvar mh-alias-blind-alist nil |
41 "Alist of MH aliases that are blind lists.") | 43 "Alist of MH aliases that are blind lists.") |
59 If these files are modified, they are automatically reread. This list | 61 If these files are modified, they are automatically reread. This list |
60 need include only system aliases and the passwd file, since personal | 62 need include only system aliases and the passwd file, since personal |
61 alias files listed in your \"Aliasfile:\" MH profile component are | 63 alias files listed in your \"Aliasfile:\" MH profile component are |
62 automatically included. You can update the alias list manually using | 64 automatically included. You can update the alias list manually using |
63 \\[mh-alias-reload].") | 65 \\[mh-alias-reload].") |
64 | |
65 ;; Copy of `goto-address-mail-regexp'. | |
66 (defvar mh-address-mail-regexp | |
67 "[-a-zA-Z0-9._]+@\\([-a-zA-z0-9_]+\\.\\)+[a-zA-Z0-9]+" | |
68 "A regular expression probably matching an e-mail address.") | |
69 | 66 |
70 | 67 |
71 | 68 |
72 ;;; Alias Loading | 69 ;;; Alias Loading |
73 | 70 |
341 ;; "Some name" <somename@foo.bar> -> recurse -> "Some name" | 338 ;; "Some name" <somename@foo.bar> -> recurse -> "Some name" |
342 (mh-alias-suggest-alias (match-string 1 string) no-comma-swap)) | 339 (mh-alias-suggest-alias (match-string 1 string) no-comma-swap)) |
343 ((string-match "^\\(.*\\) +<.*>$" string) | 340 ((string-match "^\\(.*\\) +<.*>$" string) |
344 ;; Some name <somename@foo.bar> -> recurse -> Some name | 341 ;; Some name <somename@foo.bar> -> recurse -> Some name |
345 (mh-alias-suggest-alias (match-string 1 string) no-comma-swap)) | 342 (mh-alias-suggest-alias (match-string 1 string) no-comma-swap)) |
346 ((string-match (concat mh-address-mail-regexp " +(\\(.*\\))$") string) | 343 ((string-match (concat goto-address-mail-regexp " +(\\(.*\\))$") string) |
347 ;; somename@foo.bar (Some name) -> recurse -> Some name | 344 ;; somename@foo.bar (Some name) -> recurse -> Some name |
348 (mh-alias-suggest-alias (match-string 1 string) no-comma-swap)) | 345 (mh-alias-suggest-alias (match-string 1 string) no-comma-swap)) |
349 ((string-match "^\\(Dr\\|Prof\\)\\.? +\\(.*\\)" string) | 346 ((string-match "^\\(Dr\\|Prof\\)\\.? +\\(.*\\)" string) |
350 ;; Strip out title | 347 ;; Strip out title |
351 (mh-alias-suggest-alias (match-string 2 string) no-comma-swap)) | 348 (mh-alias-suggest-alias (match-string 2 string) no-comma-swap)) |
593 (mh-alias-add-alias alias address)))) | 590 (mh-alias-add-alias alias address)))) |
594 | 591 |
595 (defun mh-alias-add-address-under-point () | 592 (defun mh-alias-add-address-under-point () |
596 "Insert an alias for address under point." | 593 "Insert an alias for address under point." |
597 (interactive) | 594 (interactive) |
598 (let ((address (mh-goto-address-find-address-at-point))) | 595 (let ((address (goto-address-find-address-at-point))) |
599 (if address | 596 (if address |
600 (mh-alias-add-alias nil address) | 597 (mh-alias-add-alias nil address) |
601 (message "No email address found under point")))) | 598 (message "No email address found under point")))) |
602 | |
603 ;; From goto-addr.el, which we don't want to force-load on users. | |
604 (defun mh-goto-address-find-address-at-point () | |
605 "Find e-mail address around or before point. | |
606 | |
607 Then search backwards to beginning of line for the start of an | |
608 e-mail address. If no e-mail address found, return nil." | |
609 (re-search-backward "[^-_A-z0-9.@]" (mh-line-beginning-position) 'lim) | |
610 (if (or (looking-at mh-address-mail-regexp) ; already at start | |
611 (and (re-search-forward mh-address-mail-regexp | |
612 (mh-line-end-position) 'lim) | |
613 (goto-char (match-beginning 0)))) | |
614 (mh-match-string-no-properties 0))) | |
615 | 599 |
616 (defun mh-alias-apropos (regexp) | 600 (defun mh-alias-apropos (regexp) |
617 "Show all aliases or addresses that match a regular expression REGEXP." | 601 "Show all aliases or addresses that match a regular expression REGEXP." |
618 (interactive "sAlias regexp: ") | 602 (interactive "sAlias regexp: ") |
619 (if mh-alias-local-users | 603 (if mh-alias-local-users |