diff options
| author | Richard M. Stallman | 2004-04-21 19:22:52 +0000 |
|---|---|---|
| committer | Richard M. Stallman | 2004-04-21 19:22:52 +0000 |
| commit | e921af9e6c8a773f472719a754344ee6bc453d05 (patch) | |
| tree | 79f9ec086d4d8298b312f955bbcf433fd6fa2d97 | |
| parent | 0ce7de922c194ac869a90b55d3d187b6365c444d (diff) | |
| download | emacs-e921af9e6c8a773f472719a754344ee6bc453d05.tar.gz emacs-e921af9e6c8a773f472719a754344ee6bc453d05.zip | |
(dabbrev--substitute-expansion): Fix a bug which lead
to loss of case of letters when performing case-insensitive
expansions on certain abbreviations.
| -rw-r--r-- | lisp/ChangeLog | 6 | ||||
| -rw-r--r-- | lisp/dabbrev.el | 29 |
2 files changed, 23 insertions, 12 deletions
diff --git a/lisp/ChangeLog b/lisp/ChangeLog index 71673e8e6c7..29a589c222d 100644 --- a/lisp/ChangeLog +++ b/lisp/ChangeLog | |||
| @@ -1,3 +1,9 @@ | |||
| 1 | 2003-04-21 Paul Pogonyshev <pogonyshev@gmx.net> | ||
| 2 | |||
| 3 | * dabbrev.el (dabbrev--substitute-expansion): Fix a bug which lost | ||
| 4 | the case of letters in case-insensitive expansions on certain | ||
| 5 | abbreviations. | ||
| 6 | |||
| 1 | 2004-04-21 Richard M. Stallman <rms@gnu.org> | 7 | 2004-04-21 Richard M. Stallman <rms@gnu.org> |
| 2 | 8 | ||
| 3 | * progmodes/cperl-mode.el (cperl-putback-char): | 9 | * progmodes/cperl-mode.el (cperl-putback-char): |
diff --git a/lisp/dabbrev.el b/lisp/dabbrev.el index 3763f2ccab8..47ffba9873d 100644 --- a/lisp/dabbrev.el +++ b/lisp/dabbrev.el | |||
| @@ -888,23 +888,28 @@ to record whether we upcased the expansion, downcased it, or did neither." | |||
| 888 | ;; matches the start of the expansion, | 888 | ;; matches the start of the expansion, |
| 889 | ;; copy the expansion's case | 889 | ;; copy the expansion's case |
| 890 | ;; instead of downcasing all the rest. | 890 | ;; instead of downcasing all the rest. |
| 891 | ;; Treat a one-capital-letter abbrev as "not all upper case", | 891 | ;; |
| 892 | ;; so as to force preservation of the expansion's pattern | 892 | ;; Treat a one-capital-letter (possibly with preceding non-letter |
| 893 | ;; if the expansion starts with a capital letter. | 893 | ;; characters) abbrev as "not all upper case", so as to force |
| 894 | (let ((expansion-rest (substring expansion 1))) | 894 | ;; preservation of the expansion's pattern if the expansion starts |
| 895 | (if (and (not (and (or (string= expansion-rest (downcase expansion-rest)) | 895 | ;; with a capital letter. |
| 896 | (string= expansion-rest (upcase expansion-rest))) | 896 | (let ((expansion-rest (substring expansion 1)) |
| 897 | (or (string= abbrev (downcase abbrev)) | 897 | (first-letter-position (string-match "[[:alpha:]]" abbrev))) |
| 898 | (and (string= abbrev (upcase abbrev)) | 898 | (if (or (null first-letter-position) |
| 899 | (> (length abbrev) 1))))) | 899 | (and (not (and (or (string= expansion-rest (downcase expansion-rest)) |
| 900 | (string= abbrev | 900 | (string= expansion-rest (upcase expansion-rest))) |
| 901 | (substring expansion 0 (length abbrev)))) | 901 | (or (string= abbrev (downcase abbrev)) |
| 902 | (and (string= abbrev (upcase abbrev)) | ||
| 903 | (> (- (length abbrev) first-letter-position) | ||
| 904 | 1))))) | ||
| 905 | (string= abbrev | ||
| 906 | (substring expansion 0 (length abbrev))))) | ||
| 902 | (setq use-case-replace nil))) | 907 | (setq use-case-replace nil))) |
| 903 | 908 | ||
| 904 | ;; If the abbrev and the expansion are both all-lower-case | 909 | ;; If the abbrev and the expansion are both all-lower-case |
| 905 | ;; then don't do any conversion. The conversion would be a no-op | 910 | ;; then don't do any conversion. The conversion would be a no-op |
| 906 | ;; for this replacement, but it would carry forward to subsequent words. | 911 | ;; for this replacement, but it would carry forward to subsequent words. |
| 907 | ;; The goal of this is to preven that carrying forward. | 912 | ;; The goal of this is to prevent that carrying forward. |
| 908 | (if (and (string= expansion (downcase expansion)) | 913 | (if (and (string= expansion (downcase expansion)) |
| 909 | (string= abbrev (downcase abbrev))) | 914 | (string= abbrev (downcase abbrev))) |
| 910 | (setq use-case-replace nil)) | 915 | (setq use-case-replace nil)) |