summaryrefslogtreecommitdiff
path: root/lisp/dabbrev.el
diff options
context:
space:
mode:
authorRichard M. Stallman <rms@gnu.org>1996-08-01 04:54:51 +0000
committerRichard M. Stallman <rms@gnu.org>1996-08-01 04:54:51 +0000
commit07e47d0b701f8dd07b6352c87ac1dee4da5b2d79 (patch)
tree33fa25f834c009981963b5bc800d3139c0070812 /lisp/dabbrev.el
parent09af8ae6afa3d3a59b7f49de2aa375d601f74a82 (diff)
downloademacs-07e47d0b701f8dd07b6352c87ac1dee4da5b2d79.tar.gz
(dabbrev-expand): When snarfing consecutive words,
if previous one was upcased, upcase this one too. (dabbrev--substitute-expansion): When snarfing consecutive words, don't case convert here.
Diffstat (limited to 'lisp/dabbrev.el')
-rw-r--r--lisp/dabbrev.el19
1 files changed, 15 insertions, 4 deletions
diff --git a/lisp/dabbrev.el b/lisp/dabbrev.el
index ed17557170f..3396ef34564 100644
--- a/lisp/dabbrev.el
+++ b/lisp/dabbrev.el
@@ -438,7 +438,14 @@ See also `dabbrev-abbrev-char-regexp' and \\[dabbrev-completion]."
(markerp dabbrev--last-abbrev-location)
(marker-position dabbrev--last-abbrev-location)
(= (point) (1+ dabbrev--last-abbrev-location)))
- (progn
+ (let* ((prev-expansion
+ (buffer-substring-no-properties
+ (- dabbrev--last-abbrev-location (length dabbrev--last-expansion))
+ dabbrev--last-abbrev-location))
+ ;; If the previous expansion was upcased.
+ ;; upcase this one too.
+ (upcase-it
+ (equal prev-expansion (upcase prev-expansion))))
;; The "abbrev" to expand is just the space.
(setq abbrev " ")
(save-excursion
@@ -459,6 +466,8 @@ See also `dabbrev-abbrev-char-regexp' and \\[dabbrev-completion]."
(setq expansion
(buffer-substring dabbrev--last-expansion-location
(point)))
+ (if upcase-it
+ (setq expansion (upcase expansion)))
;; Record the end of this expansion, in case we repeat this.
(setq dabbrev--last-expansion-location (point)))
@@ -756,9 +765,11 @@ See also `dabbrev-abbrev-char-regexp' and \\[dabbrev-completion]."
(substring expansion 0 (length abbrev)))
(not (string= abbrev (downcase abbrev)))
(not (string= abbrev (upcase abbrev))))
- (setq use-case-replace nil)
- (if use-case-replace
- (setq expansion (downcase expansion))))
+ (setq use-case-replace nil))
+ (if (equal abbrev " ")
+ (setq use-case-replace nil))
+ (if use-case-replace
+ (setq expansion (downcase expansion)))
(if old
(save-excursion
(search-backward old))