aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRichard M. Stallman2003-01-06 01:19:59 +0000
committerRichard M. Stallman2003-01-06 01:19:59 +0000
commit19c17c4ec58a7326e6394c00e526e614519e71aa (patch)
tree284ab8b390fc1975ec6dd8f0f360462eb4df7605
parentd77bbdc98d25c66a078e21d9bf785b59e9eabc2b (diff)
downloademacs-19c17c4ec58a7326e6394c00e526e614519e71aa.tar.gz
emacs-19c17c4ec58a7326e6394c00e526e614519e71aa.zip
(dabbrev--substitute-expansion):
Convert all whitespace to single spaces, except when it's carried over from the existing text.
-rw-r--r--lisp/dabbrev.el10
1 files changed, 7 insertions, 3 deletions
diff --git a/lisp/dabbrev.el b/lisp/dabbrev.el
index 9dba5d61ebe..fd8b596d530 100644
--- a/lisp/dabbrev.el
+++ b/lisp/dabbrev.el
@@ -926,10 +926,14 @@ to record whether we upcased the expansion, downcased it, or did neither."
926 (cond ((equal abbrev (upcase abbrev)) 'upcase) 926 (cond ((equal abbrev (upcase abbrev)) 'upcase)
927 ((equal abbrev (downcase abbrev)) 'downcase))))) 927 ((equal abbrev (downcase abbrev)) 'downcase)))))
928 928
929 ;; Convert newlines to spaces. 929 ;; Convert whitespace to single spaces.
930 (if dabbrev--eliminate-newlines 930 (if dabbrev--eliminate-newlines
931 (while (string-match "\n" expansion) 931 ;; Start searching at end of ABBREV so that any whitespace
932 (setq expansion (replace-match " " nil nil expansion)))) 932 ;; carried over from the existing text is not changed.
933 (let ((pos (length abbrev)))
934 (while (string-match "[\n \t]+" expansion pos)
935 (setq pos (1+ (match-beginning 0)))
936 (setq expansion (replace-match " " nil nil expansion)))))
933 937
934 (if old 938 (if old
935 (save-excursion 939 (save-excursion