summaryrefslogtreecommitdiff
path: root/lisp/dabbrev.el
diff options
context:
space:
mode:
authorRichard M. Stallman <rms@gnu.org>1997-03-30 19:06:27 +0000
committerRichard M. Stallman <rms@gnu.org>1997-03-30 19:06:27 +0000
commit654116295d459f99aed27346d95612a687602ae1 (patch)
treec308d783fd1ed88e28144f4586e402f1d2e2e2a5 /lisp/dabbrev.el
parent614710af5b71b780d92ad9edf5b25de2b1bee5ad (diff)
downloademacs-654116295d459f99aed27346d95612a687602ae1.tar.gz
(dabbrev--substitute-expansion):
Change criterion for copying expansion's case pattern. Do this now if expansion case varies after the first char.
Diffstat (limited to 'lisp/dabbrev.el')
-rw-r--r--lisp/dabbrev.el18
1 files changed, 12 insertions, 6 deletions
diff --git a/lisp/dabbrev.el b/lisp/dabbrev.el
index ed6ef3e92a4..2c28b39c4d1 100644
--- a/lisp/dabbrev.el
+++ b/lisp/dabbrev.el
@@ -765,15 +765,21 @@ 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
+ ;; If the expansion has mixed case
+ ;; and it is not simply a capitalized word,
+ ;; or if the abbrev has mixed case,
+ ;; and if the given abbrev's case pattern
;; matches the start of the expansion,
;; copy the expansion's case
;; instead of downcasing all the rest.
- (if (and (string= abbrev
- (substring expansion 0 (length abbrev)))
- (not (string= abbrev (downcase abbrev)))
- (not (string= abbrev (upcase abbrev))))
- (setq use-case-replace nil))
+ (let ((expansion-rest (substring expansion 1)))
+ (if (and (not (and (or (string= expansion-rest (downcase expansion-rest))
+ (string= expansion-rest (upcase expansion-rest)))
+ (or (string= abbrev (downcase abbrev))
+ (string= abbrev (upcase abbrev)))))
+ (string= abbrev
+ (substring expansion 0 (length abbrev))))
+ (setq use-case-replace nil)))
(if (equal abbrev " ")
(setq use-case-replace nil))
(if use-case-replace