Mercurial > emacs
comparison lisp/dabbrev.el @ 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 | c6ca69a1c8d3 |
children | 37645a051842 |
comparison
equal
deleted
inserted
replaced
49066:d00c13d69d31 | 49067:c0e98fdf377f |
---|---|
924 (setq dabbrev--last-case-pattern | 924 (setq dabbrev--last-case-pattern |
925 (and use-case-replace | 925 (and use-case-replace |
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 |
936 (search-backward old)) | 940 (search-backward old)) |
937 ;;(set-match-data (list (point-marker) (point-marker))) | 941 ;;(set-match-data (list (point-marker) (point-marker))) |