Mercurial > emacs
changeset 49067:c0e98fdf377f
(dabbrev--substitute-expansion):
Convert all whitespace to single spaces,
except when it's carried over from the existing text.
author | Richard M. Stallman <rms@gnu.org> |
---|---|
date | Mon, 06 Jan 2003 01:19:59 +0000 |
parents | d00c13d69d31 |
children | a6b76c097634 |
files | lisp/dabbrev.el |
diffstat | 1 files changed, 7 insertions(+), 3 deletions(-) [+] |
line wrap: on
line diff
--- a/lisp/dabbrev.el Mon Jan 06 01:17:19 2003 +0000 +++ b/lisp/dabbrev.el Mon Jan 06 01:19:59 2003 +0000 @@ -926,10 +926,14 @@ (cond ((equal abbrev (upcase abbrev)) 'upcase) ((equal abbrev (downcase abbrev)) 'downcase))))) - ;; Convert newlines to spaces. + ;; Convert whitespace to single spaces. (if dabbrev--eliminate-newlines - (while (string-match "\n" expansion) - (setq expansion (replace-match " " nil nil expansion)))) + ;; Start searching at end of ABBREV so that any whitespace + ;; carried over from the existing text is not changed. + (let ((pos (length abbrev))) + (while (string-match "[\n \t]+" expansion pos) + (setq pos (1+ (match-beginning 0))) + (setq expansion (replace-match " " nil nil expansion))))) (if old (save-excursion