aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRichard M. Stallman1996-07-21 23:45:15 +0000
committerRichard M. Stallman1996-07-21 23:45:15 +0000
commit66db4b5b2a1a2ff5a68de1b3ca93cbeb11132566 (patch)
tree1bddf92a52b29991fb7145d24fdfe7dbaa916d62
parent77a039e27b27ba1cc380bcf8c3a7c3e84e8a5074 (diff)
downloademacs-66db4b5b2a1a2ff5a68de1b3ca93cbeb11132566.tar.gz
emacs-66db4b5b2a1a2ff5a68de1b3ca93cbeb11132566.zip
(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.
-rw-r--r--lisp/dabbrev.el18
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."
340 (setq dabbrev--last-abbreviation abbrev) 340 (setq dabbrev--last-abbreviation abbrev)
341 ;; Find all expansion 341 ;; Find all expansion
342 (let ((completion-list 342 (let ((completion-list
343 (dabbrev--find-all-expansions abbrev ignore-case-p))) 343 (dabbrev--find-all-expansions abbrev ignore-case-p))
344 (completion-ignore-case ignore-case-p))
344 ;; Make an obarray with all expansions 345 ;; Make an obarray with all expansions
345 (setq my-obarray (make-vector (length completion-list) 0)) 346 (setq my-obarray (make-vector (length completion-list) 0))
346 (or (> (length my-obarray) 0) 347 (or (> (length my-obarray) 0)
@@ -749,6 +750,19 @@ See also `dabbrev-abbrev-char-regexp' and \\[dabbrev-completion]."
749 (and nil use-case-replace 750 (and nil use-case-replace
750 (setq old (concat abbrev (or old ""))) 751 (setq old (concat abbrev (or old "")))
751 (setq expansion (concat abbrev expansion))) 752 (setq expansion (concat abbrev expansion)))
753 ;; If the given abbrev is mixed case and its case pattern
754 ;; matches the start of the expansion,
755 ;; copy the expansion's case
756 ;; instead of downcasing all the rest.
757 (if (and (string= (or old abbrev)
758 (substring expansion 0 (length (or old abbrev))))
759 (not (string= (or old abbrev)
760 (downcase (or old abbrev))))
761 (not (string= (or old abbrev)
762 (upcase (or old abbrev)))))
763 (setq use-case-replace nil)
764 (if use-case-replace
765 (setq expansion (downcase expansion))))
752 (if old 766 (if old
753 (save-excursion 767 (save-excursion
754 (search-backward old)) 768 (search-backward old))
@@ -830,7 +844,7 @@ See also `dabbrev-abbrev-char-regexp' and \\[dabbrev-completion]."
830 (setq dabbrev--last-table 844 (setq dabbrev--last-table
831 (cons found-string dabbrev--last-table)) 845 (cons found-string dabbrev--last-table))
832 (if (and ignore-case (eval dabbrev-case-replace)) 846 (if (and ignore-case (eval dabbrev-case-replace))
833 (downcase result) 847 result
834 result))))))) 848 result)))))))
835 849
836(provide 'dabbrev) 850(provide 'dabbrev)