147 |
|
|
148 |
(defcustom dabbrev-upcase-means-case-search nil |
(defcustom dabbrev-upcase-means-case-search nil |
149 |
"*The significance of an uppercase character in an abbreviation. |
"*The significance of an uppercase character in an abbreviation. |
150 |
nil means case fold search, non-nil means case sensitive search. |
nil means case fold search when searching for possible expansions; |
151 |
|
non-nil means case sensitive search. |
152 |
|
|
153 |
This variable has an effect only when the value of |
This variable has an effect only when the value of |
154 |
`dabbrev-case-fold-search' says to ignore case." |
`dabbrev-case-fold-search' says to ignore case." |
155 |
:type 'boolean |
:type 'boolean |
156 |
:group 'dabbrev) |
:group 'dabbrev) |
157 |
|
|
158 |
|
(defcustom dabbrev-case-distinction 'case-replace |
159 |
|
"*Whether dabbrev treats expansions as the same if they differ in case. |
160 |
|
|
161 |
|
A value of nil means treat them as different. |
162 |
|
A value of `case-replace' means distinguish them if `case-replace' is nil. |
163 |
|
Any other non-nil value means to treat them as the same. |
164 |
|
|
165 |
|
This variable has an effect only when the value of |
166 |
|
`dabbrev-case-fold-search' specifies to ignore case." |
167 |
|
:type '(choice (const :tag "off" nil) |
168 |
|
(const :tag "based on `case-replace'" case-replace) |
169 |
|
(other :tag "on" t)) |
170 |
|
:group 'dabbrev |
171 |
|
:version "21.4") |
172 |
|
|
173 |
(defcustom dabbrev-case-replace 'case-replace |
(defcustom dabbrev-case-replace 'case-replace |
174 |
"*Controls whether dabbrev preserves case when expanding the abbreviation. |
"*Whether dabbrev applies the abbreviations's case pattern to the expansion. |
175 |
A value of nil means preserve case. |
|
176 |
A value of `case-replace' means preserve case if `case-replace' is nil. |
A value of nil means preserve the expansion's case pattern. |
177 |
Any other non-nil version means do not preserve case. |
A value of `case-replace' means preserve it if `case-replace' is nil. |
178 |
|
Any other non-nil value means modify the expansion |
179 |
|
by applying the abbreviation's case pattern to it. |
180 |
|
|
181 |
This variable has an effect only when the value of |
This variable has an effect only when the value of |
182 |
`dabbrev-case-fold-search' specifies to ignore case." |
`dabbrev-case-fold-search' specifies to ignore case." |
183 |
:type '(choice (const :tag "off" nil) |
:type '(choice (const :tag "off" nil) |
184 |
(const :tag "like M-x query-replace" case-replace) |
(const :tag "based on `case-replace'" case-replace) |
185 |
(other :tag "on" t)) |
(other :tag "on" t)) |
186 |
:group 'dabbrev) |
:group 'dabbrev) |
187 |
|
|
707 |
(while (and (> count 0) |
(while (and (> count 0) |
708 |
(setq expansion (dabbrev--search abbrev |
(setq expansion (dabbrev--search abbrev |
709 |
reverse |
reverse |
710 |
ignore-case))) |
(and ignore-case |
711 |
|
(if (eq dabbrev-case-distinction 'case-replace) |
712 |
|
case-replace |
713 |
|
dabbrev-case-distinction)) |
714 |
|
))) |
715 |
(setq count (1- count)))) |
(setq count (1- count)))) |
716 |
(and expansion |
(and expansion |
717 |
(setq dabbrev--last-expansion-location (point))) |
(setq dabbrev--last-expansion-location (point))) |
972 |
"\\(" dabbrev--abbrev-char-regexp "\\)")) |
"\\(" dabbrev--abbrev-char-regexp "\\)")) |
973 |
(pattern2 (concat (regexp-quote abbrev) |
(pattern2 (concat (regexp-quote abbrev) |
974 |
"\\(\\(" dabbrev--abbrev-char-regexp "\\)+\\)")) |
"\\(\\(" dabbrev--abbrev-char-regexp "\\)+\\)")) |
975 |
(found-string nil)) |
found-string result) |
976 |
;; Limited search. |
;; Limited search. |
977 |
(save-restriction |
(save-restriction |
978 |
(and dabbrev-limit |
(and dabbrev-limit |
996 |
;; We have a truly valid match. Find the end. |
;; We have a truly valid match. Find the end. |
997 |
(re-search-forward pattern2) |
(re-search-forward pattern2) |
998 |
(setq found-string (buffer-substring-no-properties |
(setq found-string (buffer-substring-no-properties |
999 |
(match-beginning 1) (match-end 1))) |
(match-beginning 0) (match-end 0))) |
1000 |
|
(setq result found-string) |
1001 |
(and ignore-case (setq found-string (downcase found-string))) |
(and ignore-case (setq found-string (downcase found-string))) |
1002 |
;; Ignore this match if it's already in the table. |
;; Ignore this match if it's already in the table. |
1003 |
(if (dabbrev-filter-elements |
(if (dabbrev-filter-elements |
1009 |
(goto-char (match-beginning 0)) |
(goto-char (match-beginning 0)) |
1010 |
(goto-char (match-end 0)))) |
(goto-char (match-end 0)))) |
1011 |
;; If we found something, use it. |
;; If we found something, use it. |
1012 |
(if found-string |
(when found-string |
1013 |
;; Put it into `dabbrev--last-table' |
;; Put it into `dabbrev--last-table' |
1014 |
;; and return it (either downcased, or as is). |
;; and return it (either downcased, or as is). |
1015 |
(let ((result (buffer-substring-no-properties |
(setq dabbrev--last-table |
1016 |
(match-beginning 0) (match-end 0)))) |
(cons found-string dabbrev--last-table)) |
1017 |
(setq dabbrev--last-table |
result))))) |
|
(cons found-string dabbrev--last-table)) |
|
|
(if (and ignore-case (eval dabbrev-case-replace)) |
|
|
result |
|
|
result))))))) |
|
1018 |
|
|
1019 |
(dolist (mess '("^No dynamic expansion for .* found$" |
(dolist (mess '("^No dynamic expansion for .* found$" |
1020 |
"^No further dynamic expansion for .* found$" |
"^No further dynamic expansion for .* found$" |