diff options
author | Richard M. Stallman <rms@gnu.org> | 1996-07-21 23:45:15 +0000 |
---|---|---|
committer | Richard M. Stallman <rms@gnu.org> | 1996-07-21 23:45:15 +0000 |
commit | cda7648d067f86527f4aaef37cade77c8b745987 (patch) | |
tree | 1822321fac76ed39e71b632c7ec8dd59916d29c9 /lisp/dabbrev.el | |
parent | bc68847a8b55df43a7b78987efda4a79fde7896b (diff) | |
download | emacs-cda7648d067f86527f4aaef37cade77c8b745987.tar.gz |
(dabbrev--search): Don't downcase the result here.
(dabbrev-completion): Bind completion-ignore-case.
(dabbrev--substitute-expansion): Downcase the expansion here,
but not if case pattern matches start of original expansion.
Diffstat (limited to 'lisp/dabbrev.el')
-rw-r--r-- | lisp/dabbrev.el | 18 |
1 files changed, 16 insertions, 2 deletions
diff --git a/lisp/dabbrev.el b/lisp/dabbrev.el index ee3f1f55f29..7f8d1679103 100644 --- a/lisp/dabbrev.el +++ b/lisp/dabbrev.el @@ -340,7 +340,8 @@ if there is a suitable one already." (setq dabbrev--last-abbreviation abbrev) ;; Find all expansion (let ((completion-list - (dabbrev--find-all-expansions abbrev ignore-case-p))) + (dabbrev--find-all-expansions abbrev ignore-case-p)) + (completion-ignore-case ignore-case-p)) ;; Make an obarray with all expansions (setq my-obarray (make-vector (length completion-list) 0)) (or (> (length my-obarray) 0) @@ -749,6 +750,19 @@ See also `dabbrev-abbrev-char-regexp' and \\[dabbrev-completion]." (and nil use-case-replace (setq old (concat abbrev (or old ""))) (setq expansion (concat abbrev expansion))) + ;; If the given abbrev is mixed case and its case pattern + ;; matches the start of the expansion, + ;; copy the expansion's case + ;; instead of downcasing all the rest. + (if (and (string= (or old abbrev) + (substring expansion 0 (length (or old abbrev)))) + (not (string= (or old abbrev) + (downcase (or old abbrev)))) + (not (string= (or old abbrev) + (upcase (or old abbrev))))) + (setq use-case-replace nil) + (if use-case-replace + (setq expansion (downcase expansion)))) (if old (save-excursion (search-backward old)) @@ -830,7 +844,7 @@ See also `dabbrev-abbrev-char-regexp' and \\[dabbrev-completion]." (setq dabbrev--last-table (cons found-string dabbrev--last-table)) (if (and ignore-case (eval dabbrev-case-replace)) - (downcase result) + result result))))))) (provide 'dabbrev) |