mirror of
git://git.sv.gnu.org/emacs.git
synced 2025-12-21 21:20:44 -08:00
* lisp/mail/mail-utils.el (mail-strip-quoted-names): Make the regexp code
work for nested comments.
This commit is contained in:
parent
db5d03ea56
commit
b49a2dbf58
2 changed files with 30 additions and 46 deletions
|
|
@ -1,5 +1,8 @@
|
||||||
2011-01-13 Stefan Monnier <monnier@iro.umontreal.ca>
|
2011-01-13 Stefan Monnier <monnier@iro.umontreal.ca>
|
||||||
|
|
||||||
|
* mail/mail-utils.el (mail-strip-quoted-names): Make the regexp code
|
||||||
|
work for nested comments.
|
||||||
|
|
||||||
* progmodes/prolog.el: Use syntax-propertize. Further code cleanup.
|
* progmodes/prolog.el: Use syntax-propertize. Further code cleanup.
|
||||||
(prolog-use-prolog-tokenizer-flag): Change default when
|
(prolog-use-prolog-tokenizer-flag): Change default when
|
||||||
syntax-propertize can be used.
|
syntax-propertize can be used.
|
||||||
|
|
|
||||||
|
|
@ -182,30 +182,11 @@ Return a modified address list."
|
||||||
(mapconcat 'identity (rfc822-addresses address) ", "))
|
(mapconcat 'identity (rfc822-addresses address) ", "))
|
||||||
(let (pos)
|
(let (pos)
|
||||||
|
|
||||||
;; Detect nested comments.
|
;; Strip comments.
|
||||||
(if (string-match "[ \t]*(\\([^)\\]\\|\\\\.\\|\\\\\n\\)*(" address)
|
|
||||||
;; Strip nested comments.
|
|
||||||
(with-temp-buffer
|
|
||||||
(insert address)
|
|
||||||
(set-syntax-table lisp-mode-syntax-table)
|
|
||||||
(goto-char 1)
|
|
||||||
(while (search-forward "(" nil t)
|
|
||||||
(forward-char -1)
|
|
||||||
(skip-chars-backward " \t")
|
|
||||||
(delete-region (point)
|
|
||||||
(save-excursion
|
|
||||||
(condition-case ()
|
|
||||||
(forward-sexp 1)
|
|
||||||
(error (goto-char (point-max))))
|
|
||||||
(point))))
|
|
||||||
(setq address (buffer-string)))
|
|
||||||
;; Strip non-nested comments an easier way.
|
|
||||||
(while (setq pos (string-match
|
(while (setq pos (string-match
|
||||||
;; This doesn't hack rfc822 nested comments
|
"[ \t]*(\\([^()\\]\\|\\\\.\\|\\\\\n\\)*)"
|
||||||
;; `(xyzzy (foo) whinge)' properly. Big deal.
|
|
||||||
"[ \t]*(\\([^)\\]\\|\\\\.\\|\\\\\n\\)*)"
|
|
||||||
address))
|
address))
|
||||||
(setq address (replace-match "" nil nil address 0))))
|
(setq address (replace-match "" nil nil address 0)))
|
||||||
|
|
||||||
;; strip surrounding whitespace
|
;; strip surrounding whitespace
|
||||||
(string-match "\\`[ \t\n]*" address)
|
(string-match "\\`[ \t\n]*" address)
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue