comparison lisp/dabbrev.el @ 17263:b712c50d2c84

(dabbrev--substitute-expansion): Change criterion for copying expansion's case pattern. Do this now if expansion case varies after the first char.
author Richard M. Stallman <rms@gnu.org>
date Sun, 30 Mar 1997 19:06:27 +0000
parents 71ede15e1ca3
children f0ff96a35eb8
comparison
equal deleted inserted replaced
17262:76bfab081263 17263:b712c50d2c84
763 (string= abbrev (downcase abbrev))) 763 (string= abbrev (downcase abbrev)))
764 (eval dabbrev-case-replace)))) 764 (eval dabbrev-case-replace))))
765 (and nil use-case-replace 765 (and nil use-case-replace
766 (setq old (concat abbrev (or old ""))) 766 (setq old (concat abbrev (or old "")))
767 (setq expansion (concat abbrev expansion))) 767 (setq expansion (concat abbrev expansion)))
768 ;; If the given abbrev is mixed case and its case pattern 768 ;; If the expansion has mixed case
769 ;; and it is not simply a capitalized word,
770 ;; or if the abbrev has mixed case,
771 ;; and if the given abbrev's case pattern
769 ;; matches the start of the expansion, 772 ;; matches the start of the expansion,
770 ;; copy the expansion's case 773 ;; copy the expansion's case
771 ;; instead of downcasing all the rest. 774 ;; instead of downcasing all the rest.
772 (if (and (string= abbrev 775 (let ((expansion-rest (substring expansion 1)))
773 (substring expansion 0 (length abbrev))) 776 (if (and (not (and (or (string= expansion-rest (downcase expansion-rest))
774 (not (string= abbrev (downcase abbrev))) 777 (string= expansion-rest (upcase expansion-rest)))
775 (not (string= abbrev (upcase abbrev)))) 778 (or (string= abbrev (downcase abbrev))
776 (setq use-case-replace nil)) 779 (string= abbrev (upcase abbrev)))))
780 (string= abbrev
781 (substring expansion 0 (length abbrev))))
782 (setq use-case-replace nil)))
777 (if (equal abbrev " ") 783 (if (equal abbrev " ")
778 (setq use-case-replace nil)) 784 (setq use-case-replace nil))
779 (if use-case-replace 785 (if use-case-replace
780 (setq expansion (downcase expansion))) 786 (setq expansion (downcase expansion)))
781 (if old 787 (if old