comparison lisp/dabbrev.el @ 35636:4eb554667665

(dabbrev--substitute-expansion): Treat a one-capital-letter abbrev as "not all upper case", so as to force preservation of the expansion's pattern if the expansion starts with a capital letter.
author Gerd Moellmann <gerd@gnu.org>
date Sat, 27 Jan 2001 12:05:36 +0000
parents 51c08e149a23
children d74e2e8f6c1f
comparison
equal deleted inserted replaced
35635:11e5d55ea163 35636:4eb554667665
1 ;;; dabbrev.el --- dynamic abbreviation package 1 ;;; dabbrev.el --- dynamic abbreviation package
2 2
3 ;; Copyright (C) 1985, 86, 92, 94, 96, 1997, 2000 3 ;; Copyright (C) 1985, 86, 92, 94, 96, 1997, 2000, 2001
4 ;; Free Software Foundation, Inc. 4 ;; Free Software Foundation, Inc.
5 5
6 ;; Author: Don Morrison 6 ;; Author: Don Morrison
7 ;; Maintainer: Lars Lindberg <Lars.Lindberg@sypro.cap.se> 7 ;; Maintainer: Lars Lindberg <Lars.Lindberg@sypro.cap.se>
8 ;; Created: 16 Mars 1992 8 ;; Created: 16 Mars 1992
833 ;; or if the abbrev has mixed case, 833 ;; or if the abbrev has mixed case,
834 ;; and if the given abbrev's case pattern 834 ;; and if the given abbrev's case pattern
835 ;; matches the start of the expansion, 835 ;; matches the start of the expansion,
836 ;; copy the expansion's case 836 ;; copy the expansion's case
837 ;; instead of downcasing all the rest. 837 ;; instead of downcasing all the rest.
838 ;; Treat a one-capital-letter abbrev as "not all upper case",
839 ;; so as to force preservation of the expansion's pattern
840 ;; if the expansion starts with a capital letter.
838 (let ((expansion-rest (substring expansion 1))) 841 (let ((expansion-rest (substring expansion 1)))
839 (if (and (not (and (or (string= expansion-rest (downcase expansion-rest)) 842 (if (and (not (and (or (string= expansion-rest (downcase expansion-rest))
840 (string= expansion-rest (upcase expansion-rest))) 843 (string= expansion-rest (upcase expansion-rest)))
841 (or (string= abbrev (downcase abbrev)) 844 (or (string= abbrev (downcase abbrev))
842 (string= abbrev (upcase abbrev))))) 845 (and (string= abbrev (upcase abbrev))
846 (> (length abbrev) 1)))))
843 (string= abbrev 847 (string= abbrev
844 (substring expansion 0 (length abbrev)))) 848 (substring expansion 0 (length abbrev))))
845 (setq use-case-replace nil))) 849 (setq use-case-replace nil)))
846 (if (equal abbrev " ") 850 (if (equal abbrev " ")
847 (setq use-case-replace nil)) 851 (setq use-case-replace nil))