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>
|
||||
|
||||
* 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.
|
||||
(prolog-use-prolog-tokenizer-flag): Change default when
|
||||
syntax-propertize can be used.
|
||||
|
|
|
|||
|
|
@ -182,30 +182,11 @@ Return a modified address list."
|
|||
(mapconcat 'identity (rfc822-addresses address) ", "))
|
||||
(let (pos)
|
||||
|
||||
;; Detect nested 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.
|
||||
;; Strip comments.
|
||||
(while (setq pos (string-match
|
||||
;; This doesn't hack rfc822 nested comments
|
||||
;; `(xyzzy (foo) whinge)' properly. Big deal.
|
||||
"[ \t]*(\\([^)\\]\\|\\\\.\\|\\\\\n\\)*)"
|
||||
"[ \t]*(\\([^()\\]\\|\\\\.\\|\\\\\n\\)*)"
|
||||
address))
|
||||
(setq address (replace-match "" nil nil address 0))))
|
||||
(setq address (replace-match "" nil nil address 0)))
|
||||
|
||||
;; strip surrounding whitespace
|
||||
(string-match "\\`[ \t\n]*" address)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue