aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRichard M. Stallman1997-12-21 02:07:32 +0000
committerRichard M. Stallman1997-12-21 02:07:32 +0000
commit255359cbccfc0d8381e3da9c01572c9fc222a5df (patch)
treef9130a55c5d55602345a4f1deef2162e891b8506
parent7317d9e8fc29204a4afd6274e05ed934753e59c0 (diff)
downloademacs-255359cbccfc0d8381e3da9c01572c9fc222a5df.tar.gz
emacs-255359cbccfc0d8381e3da9c01572c9fc222a5df.zip
(define-mail-alias): Handle backslash-quoting
within "-strings in DEFINITION if it comes from .mailrc.
-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."
317 ;; If DEFINITION is null string, avoid looping even once. 317 ;; If DEFINITION is null string, avoid looping even once.
318 (start (and (not (equal definition "")) 0)) 318 (start (and (not (equal definition "")) 0))
319 (L (length definition)) 319 (L (length definition))
320 convert-backslash
320 end tem) 321 end tem)
321 (while start 322 (while start
323 (setq convert-backslash nil)
322 ;; If we're reading from the mailrc file, then addresses are delimited 324 ;; If we're reading from the mailrc file, then addresses are delimited
323 ;; by spaces, and addresses with embedded spaces must be surrounded by 325 ;; by spaces, and addresses with embedded spaces must be surrounded by
324 ;; double-quotes. Otherwise, addresses are separated by commas. 326 ;; double-quotes. Otherwise, addresses are separated by commas.
325 (if from-mailrc-file 327 (if from-mailrc-file
326 (if (eq ?\" (aref definition start)) 328 (if (eq ?\" (aref definition start))
327 (setq start (1+ start) 329 (progn (string-match "[^\\]\\(\\([\\][\\]\\)*\\)\"[ \t,]*" definition start)
328 end (string-match "\"[ \t,]*" definition start)) 330 (setq start (1+ start)
331 end (match-end 1)
332 convert-backslash t))
329 (setq end (string-match "[ \t,]+" definition start))) 333 (setq end (string-match "[ \t,]+" definition start)))
330 (setq end (string-match "[ \t\n,]*,[ \t\n,]*" definition start))) 334 (setq end (string-match "[ \t\n,]*,[ \t\n,]*" definition start)))
331 (setq result (cons (substring definition start end) result)) 335 (let ((temp (substring definition start end))
332 (setq start (and end 336 (pos 0))
333 (/= (match-end 0) L) 337 (setq start (and end
334 (match-end 0)))) 338 (/= (match-end 0) L)
339 (match-end 0)))
340 (if convert-backslash
341 (while (string-match "[\\]" temp pos)
342 (setq temp (replace-match "" t t temp))
343 (if start
344 (setq start (1- start)))
345 (setq pos (match-end 0))))
346 (setq result (cons temp result))))
335 (setq definition (mapconcat (function identity) 347 (setq definition (mapconcat (function identity)
336 (nreverse result) 348 (nreverse result)
337 ", ")) 349 ", "))