comparison lisp/mail/mailalias.el @ 8494:ae554ccf4fb5

(define-mail-alias): Avoid error if DEFINITION is "".
author Richard M. Stallman <rms@gnu.org>
date Tue, 09 Aug 1994 05:52:47 +0000
parents e02c5d5d76cd
children eee06aef6f56
comparison
equal deleted inserted replaced
8493:2bf3f2e9f107 8494:ae554ccf4fb5
176 (if (string-match "\\`[ \t\n,]+" definition) 176 (if (string-match "\\`[ \t\n,]+" definition)
177 (setq definition (substring definition (match-end 0)))) 177 (setq definition (substring definition (match-end 0))))
178 (if (string-match "[ \t\n,]+\\'" definition) 178 (if (string-match "[ \t\n,]+\\'" definition)
179 (setq definition (substring definition 0 (match-beginning 0)))) 179 (setq definition (substring definition 0 (match-beginning 0))))
180 (let ((result '()) 180 (let ((result '())
181 (start 0) 181 ;; If DEFINITION is null string, avoid looping even once.
182 (start (and (not (equal definition "")) 0))
182 (L (length definition)) 183 (L (length definition))
183 end tem) 184 end tem)
184 (while start 185 (while start
185 ;; If we're reading from the mailrc file, then addresses are delimited 186 ;; If we're reading from the mailrc file, then addresses are delimited
186 ;; by spaces, and addresses with embedded spaces must be surrounded by 187 ;; by spaces, and addresses with embedded spaces must be surrounded by
187 ;; double-quotes. Otherwise, addresses are separated by commas. 188 ;; double-quotes. Otherwise, addresses are separated by commas.
188 (if from-mailrc-file 189 (if from-mailrc-file
189 (if (eq ?\" (aref definition start)) 190 (if (eq ?\" (aref definition start))
190 (setq start (1+ start) 191 (setq start (1+ start)
191 end (string-match "\"[ \t,]*" definition start)) 192 end (string-match "\"[ \t,]*" definition start))
192 (setq end (string-match "[ \t,]+" definition start))) 193 (setq end (string-match "[ \t,]+" definition start)))
193 (setq end (string-match "[ \t\n,]*,[ \t\n,]*" definition start))) 194 (setq end (string-match "[ \t\n,]*,[ \t\n,]*" definition start)))
194 (setq result (cons (substring definition start end) result)) 195 (setq result (cons (substring definition start end) result))
195 (setq start (and end 196 (setq start (and end
196 (/= (match-end 0) L) 197 (/= (match-end 0) L)
197 (match-end 0)))) 198 (match-end 0))))
198 (setq definition (mapconcat (function identity) 199 (setq definition (mapconcat (function identity)