summaryrefslogtreecommitdiff
path: root/lisp/mail/mailalias.el
diff options
context:
space:
mode:
authorRichard M. Stallman <rms@gnu.org>1997-12-21 02:07:32 +0000
committerRichard M. Stallman <rms@gnu.org>1997-12-21 02:07:32 +0000
commit255359cbccfc0d8381e3da9c01572c9fc222a5df (patch)
treef9130a55c5d55602345a4f1deef2162e891b8506 /lisp/mail/mailalias.el
parent7317d9e8fc29204a4afd6274e05ed934753e59c0 (diff)
downloademacs-255359cbccfc0d8381e3da9c01572c9fc222a5df.tar.gz
(define-mail-alias): Handle backslash-quoting
within "-strings in DEFINITION if it comes from .mailrc.
Diffstat (limited to 'lisp/mail/mailalias.el')
-rw-r--r--lisp/mail/mailalias.el24
1 files changed, 18 insertions, 6 deletions
diff --git a/lisp/mail/mailalias.el b/lisp/mail/mailalias.el
index c0bb580fcaf..20d6004b4e2 100644
--- a/lisp/mail/mailalias.el
+++ b/lisp/mail/mailalias.el
@@ -317,21 +317,33 @@ if it is quoted with double-quotes."
;; If DEFINITION is null string, avoid looping even once.
(start (and (not (equal definition "")) 0))
(L (length definition))
+ convert-backslash
end tem)
(while start
+ (setq convert-backslash nil)
;; If we're reading from the mailrc file, then addresses are delimited
;; by spaces, and addresses with embedded spaces must be surrounded by
;; double-quotes. Otherwise, addresses are separated by commas.
(if from-mailrc-file
(if (eq ?\" (aref definition start))
- (setq start (1+ start)
- end (string-match "\"[ \t,]*" definition start))
+ (progn (string-match "[^\\]\\(\\([\\][\\]\\)*\\)\"[ \t,]*" definition start)
+ (setq start (1+ start)
+ end (match-end 1)
+ convert-backslash t))
(setq end (string-match "[ \t,]+" definition start)))
(setq end (string-match "[ \t\n,]*,[ \t\n,]*" definition start)))
- (setq result (cons (substring definition start end) result))
- (setq start (and end
- (/= (match-end 0) L)
- (match-end 0))))
+ (let ((temp (substring definition start end))
+ (pos 0))
+ (setq start (and end
+ (/= (match-end 0) L)
+ (match-end 0)))
+ (if convert-backslash
+ (while (string-match "[\\]" temp pos)
+ (setq temp (replace-match "" t t temp))
+ (if start
+ (setq start (1- start)))
+ (setq pos (match-end 0))))
+ (setq result (cons temp result))))
(setq definition (mapconcat (function identity)
(nreverse result)
", "))