diff options
| -rw-r--r-- | lisp/ChangeLog | 4 | ||||
| -rw-r--r-- | lisp/mail/mail-extr.el | 52 |
2 files changed, 30 insertions, 26 deletions
diff --git a/lisp/ChangeLog b/lisp/ChangeLog index 31771b2a4e4..b7cc8d772f6 100644 --- a/lisp/ChangeLog +++ b/lisp/ChangeLog | |||
| @@ -1,5 +1,9 @@ | |||
| 1 | 2010-11-06 Glenn Morris <rgm@gnu.org> | 1 | 2010-11-06 Glenn Morris <rgm@gnu.org> |
| 2 | 2 | ||
| 3 | * mail/mail-extr.el (mail-extract-address-components): Give dynamic | ||
| 4 | local variables `cbeg' and `cend' a prefix. | ||
| 5 | (mail-extr-voodoo): Update for above name change. | ||
| 6 | |||
| 3 | * textmodes/reftex-toc.el (reftex-toc-do-promote) | 7 | * textmodes/reftex-toc.el (reftex-toc-do-promote) |
| 4 | (reftex-toc-promote-prepare): Pass `delta' as an explicit argument. | 8 | (reftex-toc-promote-prepare): Pass `delta' as an explicit argument. |
| 5 | (reftex-toc-promote-action): Doc fix. | 9 | (reftex-toc-promote-action): Doc fix. |
diff --git a/lisp/mail/mail-extr.el b/lisp/mail/mail-extr.el index 342d735c939..9b958e41b05 100644 --- a/lisp/mail/mail-extr.el +++ b/lisp/mail/mail-extr.el | |||
| @@ -1,7 +1,8 @@ | |||
| 1 | ;;; mail-extr.el --- extract full name and address from RFC 822 mail header -*- coding: utf-8 -*- | 1 | ;;; mail-extr.el --- extract full name and address from RFC 822 mail header -*- coding: utf-8 -*- |
| 2 | 2 | ||
| 3 | ;; Copyright (C) 1991, 1992, 1993, 1994, 1997, 2001, 2002, 2003, 2004, | 3 | ;; Copyright (C) 1991, 1992, 1993, 1994, 1997, 2001, 2002, 2003, 2004, |
| 4 | ;; 2005, 2006, 2007, 2008, 2009, 2010 Free Software Foundation, Inc. | 4 | ;; 2005, 2006, 2007, 2008, 2009, 2010 |
| 5 | ;; Free Software Foundation, Inc. | ||
| 5 | 6 | ||
| 6 | ;; Author: Joe Wells <jbw@cs.bu.edu> | 7 | ;; Author: Joe Wells <jbw@cs.bu.edu> |
| 7 | ;; Maintainer: FSF | 8 | ;; Maintainer: FSF |
| @@ -691,8 +692,8 @@ Unless NO-REPLACE is true, at each of the positions in LIST-SYMBOL | |||
| 691 | ;; | 692 | ;; |
| 692 | 693 | ||
| 693 | (defvar disable-initial-guessing-flag) ; dynamic assignment | 694 | (defvar disable-initial-guessing-flag) ; dynamic assignment |
| 694 | (defvar cbeg) ; dynamic assignment | 695 | (defvar mailextr-cbeg) ; dynamic assignment |
| 695 | (defvar cend) ; dynamic assignment | 696 | (defvar mailextr-cend) ; dynamic assignment |
| 696 | (defvar mail-extr-all-top-level-domains) ; Defined below. | 697 | (defvar mail-extr-all-top-level-domains) ; Defined below. |
| 697 | 698 | ||
| 698 | ;;;###autoload | 699 | ;;;###autoload |
| @@ -762,7 +763,8 @@ consing a string.)" | |||
| 762 | record-pos-symbol | 763 | record-pos-symbol |
| 763 | first-real-pos last-real-pos | 764 | first-real-pos last-real-pos |
| 764 | phrase-beg phrase-end | 765 | phrase-beg phrase-end |
| 765 | cbeg cend ; dynamically set from -voodoo | 766 | ;; Dynamically set in mail-extr-voodoo. |
| 767 | mailextr-cbeg mailextr-cend | ||
| 766 | quote-beg quote-end | 768 | quote-beg quote-end |
| 767 | atom-beg atom-end | 769 | atom-beg atom-end |
| 768 | mbox-beg mbox-end | 770 | mbox-beg mbox-end |
| @@ -796,19 +798,19 @@ consing a string.)" | |||
| 796 | ((eq char ?\() | 798 | ((eq char ?\() |
| 797 | (set-syntax-table mail-extr-address-comment-syntax-table) | 799 | (set-syntax-table mail-extr-address-comment-syntax-table) |
| 798 | ;; only record the first non-empty comment's position | 800 | ;; only record the first non-empty comment's position |
| 799 | (if (and (not cbeg) | 801 | (if (and (not mailextr-cbeg) |
| 800 | (save-excursion | 802 | (save-excursion |
| 801 | (forward-char 1) | 803 | (forward-char 1) |
| 802 | (mail-extr-skip-whitespace-forward) | 804 | (mail-extr-skip-whitespace-forward) |
| 803 | (not (eq ?\) (char-after (point)))))) | 805 | (not (eq ?\) (char-after (point)))))) |
| 804 | (setq cbeg (point))) | 806 | (setq mailextr-cbeg (point))) |
| 805 | ;; TODO: don't record if unbalanced | 807 | ;; TODO: don't record if unbalanced |
| 806 | (or (mail-extr-safe-move-sexp 1) | 808 | (or (mail-extr-safe-move-sexp 1) |
| 807 | (forward-char 1)) | 809 | (forward-char 1)) |
| 808 | (set-syntax-table mail-extr-address-syntax-table) | 810 | (set-syntax-table mail-extr-address-syntax-table) |
| 809 | (if (and cbeg | 811 | (if (and mailextr-cbeg |
| 810 | (not cend)) | 812 | (not mailextr-cend)) |
| 811 | (setq cend (point)))) | 813 | (setq mailextr-cend (point)))) |
| 812 | ;; quoted text | 814 | ;; quoted text |
| 813 | ((eq char ?\") | 815 | ((eq char ?\") |
| 814 | ;; only record the first non-empty quote's position | 816 | ;; only record the first non-empty quote's position |
| @@ -994,10 +996,10 @@ consing a string.)" | |||
| 994 | (> last-real-pos (1+ group-\;-pos)) | 996 | (> last-real-pos (1+ group-\;-pos)) |
| 995 | (setq last-real-pos (1+ group-\;-pos))) | 997 | (setq last-real-pos (1+ group-\;-pos))) |
| 996 | ;; *** This may be wrong: | 998 | ;; *** This may be wrong: |
| 997 | (and cend | 999 | (and mailextr-cend |
| 998 | (> cend group-\;-pos) | 1000 | (> mailextr-cend group-\;-pos) |
| 999 | (setq cend nil | 1001 | (setq mailextr-cend nil |
| 1000 | cbeg nil)) | 1002 | mailextr-cbeg nil)) |
| 1001 | (and quote-end | 1003 | (and quote-end |
| 1002 | (> quote-end group-\;-pos) | 1004 | (> quote-end group-\;-pos) |
| 1003 | (setq quote-end nil | 1005 | (setq quote-end nil |
| @@ -1228,8 +1230,8 @@ consing a string.)" | |||
| 1228 | (narrow-to-region phrase-beg phrase-end)) | 1230 | (narrow-to-region phrase-beg phrase-end)) |
| 1229 | 1231 | ||
| 1230 | ;; Example: fml@foo.bar.dom (First M. Last) | 1232 | ;; Example: fml@foo.bar.dom (First M. Last) |
| 1231 | (cbeg | 1233 | (mailextr-cbeg |
| 1232 | (narrow-to-region (1+ cbeg) (1- cend)) | 1234 | (narrow-to-region (1+ mailextr-cbeg) (1- mailextr-cend)) |
| 1233 | (mail-extr-undo-backslash-quoting (point-min) (point-max)) | 1235 | (mail-extr-undo-backslash-quoting (point-min) (point-max)) |
| 1234 | 1236 | ||
| 1235 | ;; Deal with spacing problems | 1237 | ;; Deal with spacing problems |
| @@ -1472,7 +1474,6 @@ place. It affects how `mail-extract-address-components' works." | |||
| 1472 | (case-fold-search nil) | 1474 | (case-fold-search nil) |
| 1473 | mixed-case-flag lower-case-flag ;;upper-case-flag | 1475 | mixed-case-flag lower-case-flag ;;upper-case-flag |
| 1474 | suffix-flag last-name-comma-flag | 1476 | suffix-flag last-name-comma-flag |
| 1475 | ;;cbeg cend | ||
| 1476 | initial | 1477 | initial |
| 1477 | begin-again-flag | 1478 | begin-again-flag |
| 1478 | drop-this-word-if-trailing-flag | 1479 | drop-this-word-if-trailing-flag |
| @@ -1618,7 +1619,7 @@ place. It affects how `mail-extract-address-components' works." | |||
| 1618 | 1619 | ||
| 1619 | ;; Delete parenthesized/quoted comment/nickname | 1620 | ;; Delete parenthesized/quoted comment/nickname |
| 1620 | ((memq (following-char) '(?\( ?\{ ?\[ ?\" ?\' ?\`)) | 1621 | ((memq (following-char) '(?\( ?\{ ?\[ ?\" ?\' ?\`)) |
| 1621 | (setq cbeg (point)) | 1622 | (setq mailextr-cbeg (point)) |
| 1622 | (set-syntax-table mail-extr-address-text-comment-syntax-table) | 1623 | (set-syntax-table mail-extr-address-text-comment-syntax-table) |
| 1623 | (cond ((memq (following-char) '(?\' ?\`)) | 1624 | (cond ((memq (following-char) '(?\' ?\`)) |
| 1624 | (or (search-forward "'" nil t | 1625 | (or (search-forward "'" nil t |
| @@ -1628,23 +1629,23 @@ place. It affects how `mail-extract-address-components' works." | |||
| 1628 | (or (mail-extr-safe-move-sexp 1) | 1629 | (or (mail-extr-safe-move-sexp 1) |
| 1629 | (goto-char (point-max))))) | 1630 | (goto-char (point-max))))) |
| 1630 | (set-syntax-table mail-extr-address-text-syntax-table) | 1631 | (set-syntax-table mail-extr-address-text-syntax-table) |
| 1631 | (setq cend (point)) | 1632 | (setq mailextr-cend (point)) |
| 1632 | (cond | 1633 | (cond |
| 1633 | ;; Handle case of entire name being quoted | 1634 | ;; Handle case of entire name being quoted |
| 1634 | ((and (eq word-count 0) | 1635 | ((and (eq word-count 0) |
| 1635 | (looking-at " *\\'") | 1636 | (looking-at " *\\'") |
| 1636 | (>= (- cend cbeg) 2)) | 1637 | (>= (- mailextr-cend mailextr-cbeg) 2)) |
| 1637 | (narrow-to-region (1+ cbeg) (1- cend)) | 1638 | (narrow-to-region (1+ mailextr-cbeg) (1- mailextr-cend)) |
| 1638 | (goto-char (point-min))) | 1639 | (goto-char (point-min))) |
| 1639 | (t | 1640 | (t |
| 1640 | ;; Handle case of quoted initial | 1641 | ;; Handle case of quoted initial |
| 1641 | (if (and (or (= 3 (- cend cbeg)) | 1642 | (if (and (or (= 3 (- mailextr-cend mailextr-cbeg)) |
| 1642 | (and (= 4 (- cend cbeg)) | 1643 | (and (= 4 (- mailextr-cend mailextr-cbeg)) |
| 1643 | (eq ?. (char-after (+ 2 cbeg))))) | 1644 | (eq ?. (char-after (+ 2 mailextr-cbeg))))) |
| 1644 | (not (looking-at " *\\'"))) | 1645 | (not (looking-at " *\\'"))) |
| 1645 | (setq initial (char-after (1+ cbeg))) | 1646 | (setq initial (char-after (1+ mailextr-cbeg))) |
| 1646 | (setq initial nil)) | 1647 | (setq initial nil)) |
| 1647 | (delete-region cbeg cend) | 1648 | (delete-region mailextr-cbeg mailextr-cend) |
| 1648 | (if initial | 1649 | (if initial |
| 1649 | (insert initial ". "))))) | 1650 | (insert initial ". "))))) |
| 1650 | 1651 | ||
| @@ -2174,5 +2175,4 @@ place. It affects how `mail-extract-address-components' works." | |||
| 2174 | 2175 | ||
| 2175 | (provide 'mail-extr) | 2176 | (provide 'mail-extr) |
| 2176 | 2177 | ||
| 2177 | ;; arch-tag: 7785fade-1073-4ed6-b4f6-28db34a7982d | ||
| 2178 | ;;; mail-extr.el ends here | 2178 | ;;; mail-extr.el ends here |