Mercurial > emacs
annotate lisp/dabbrev.el @ 70769:c1396ff7810f
(show-ifdef-block): Fix bug where parts of a hidden block remained hidden if
`hide-ifdef-lines' is non-nil.
author | Eli Zaretskii <eliz@gnu.org> |
---|---|
date | Sat, 20 May 2006 17:26:27 +0000 |
parents | 3bd95f4f2941 |
children | e3694f1cb928 c5406394f567 |
rev | line source |
---|---|
10231
e88ff4b30786
Don't require cl, picture, or reporter.
Richard M. Stallman <rms@gnu.org>
parents:
10230
diff
changeset
|
1 ;;; dabbrev.el --- dynamic abbreviation package |
14169 | 2 |
64762
41bb365f41c4
Update years in copyright notice; nfc.
Thien-Thi Nguyen <ttn@gnuvola.org>
parents:
64091
diff
changeset
|
3 ;; Copyright (C) 1985, 1986, 1992, 1994, 1996, 1997, 2000, 2001, 2002, |
68651
3bd95f4f2941
Update years in copyright notice; nfc.
Thien-Thi Nguyen <ttn@gnuvola.org>
parents:
67169
diff
changeset
|
4 ;; 2003, 2004, 2005, 2006 Free Software Foundation, Inc. |
846
20674ae6bf52
*** empty log message ***
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
807
diff
changeset
|
5 |
10230
7396503653cf
Complete rewrite by Lars.Lindberg@sypro.cap.se.
Richard M. Stallman <rms@gnu.org>
parents:
5307
diff
changeset
|
6 ;; Author: Don Morrison |
7396503653cf
Complete rewrite by Lars.Lindberg@sypro.cap.se.
Richard M. Stallman <rms@gnu.org>
parents:
5307
diff
changeset
|
7 ;; Maintainer: Lars Lindberg <Lars.Lindberg@sypro.cap.se> |
7396503653cf
Complete rewrite by Lars.Lindberg@sypro.cap.se.
Richard M. Stallman <rms@gnu.org>
parents:
5307
diff
changeset
|
8 ;; Created: 16 Mars 1992 |
11820
362251066737
(dabbrev-completion): Use mapcar, not mapc.
Richard M. Stallman <rms@gnu.org>
parents:
10251
diff
changeset
|
9 ;; Lindberg's last update version: 5.7 |
22250
a77d473867b8
*** empty log message ***
Dan Nicolaescu <done@ece.arizona.edu>
parents:
21669
diff
changeset
|
10 ;; Keywords: abbrev expand completion convenience |
267 | 11 |
14169 | 12 ;; This file is part of GNU Emacs. |
13 | |
14 ;; GNU Emacs is free software; you can redistribute it and/or modify | |
267 | 15 ;; it under the terms of the GNU General Public License as published by |
14169 | 16 ;; the Free Software Foundation; either version 2, or (at your option) |
17 ;; any later version. | |
18 | |
19 ;; GNU Emacs is distributed in the hope that it will be useful, | |
267 | 20 ;; but WITHOUT ANY WARRANTY; without even the implied warranty of |
21 ;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |
22 ;; GNU General Public License for more details. | |
14169 | 23 |
267 | 24 ;; You should have received a copy of the GNU General Public License |
14169 | 25 ;; along with GNU Emacs; see the file COPYING. If not, write to the |
64091 | 26 ;; Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, |
27 ;; Boston, MA 02110-1301, USA. | |
267 | 28 |
807
4f28bd14272c
*** empty log message ***
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
793
diff
changeset
|
29 ;;; Commentary: |
267 | 30 |
10230
7396503653cf
Complete rewrite by Lars.Lindberg@sypro.cap.se.
Richard M. Stallman <rms@gnu.org>
parents:
5307
diff
changeset
|
31 ;; The purpose with this package is to let you write just a few |
7396503653cf
Complete rewrite by Lars.Lindberg@sypro.cap.se.
Richard M. Stallman <rms@gnu.org>
parents:
5307
diff
changeset
|
32 ;; characters of words you've written earlier to be able to expand |
7396503653cf
Complete rewrite by Lars.Lindberg@sypro.cap.se.
Richard M. Stallman <rms@gnu.org>
parents:
5307
diff
changeset
|
33 ;; them. |
7396503653cf
Complete rewrite by Lars.Lindberg@sypro.cap.se.
Richard M. Stallman <rms@gnu.org>
parents:
5307
diff
changeset
|
34 ;; |
7396503653cf
Complete rewrite by Lars.Lindberg@sypro.cap.se.
Richard M. Stallman <rms@gnu.org>
parents:
5307
diff
changeset
|
35 ;; To expand a word, just put the point right after the word and press |
7396503653cf
Complete rewrite by Lars.Lindberg@sypro.cap.se.
Richard M. Stallman <rms@gnu.org>
parents:
5307
diff
changeset
|
36 ;; M-/ (dabbrev-expand) or M-C-/ (dabbrev-completion). |
7396503653cf
Complete rewrite by Lars.Lindberg@sypro.cap.se.
Richard M. Stallman <rms@gnu.org>
parents:
5307
diff
changeset
|
37 ;; |
7396503653cf
Complete rewrite by Lars.Lindberg@sypro.cap.se.
Richard M. Stallman <rms@gnu.org>
parents:
5307
diff
changeset
|
38 ;; Check out the customizable variables below to learn about all the |
7396503653cf
Complete rewrite by Lars.Lindberg@sypro.cap.se.
Richard M. Stallman <rms@gnu.org>
parents:
5307
diff
changeset
|
39 ;; features of this package. |
7396503653cf
Complete rewrite by Lars.Lindberg@sypro.cap.se.
Richard M. Stallman <rms@gnu.org>
parents:
5307
diff
changeset
|
40 |
7396503653cf
Complete rewrite by Lars.Lindberg@sypro.cap.se.
Richard M. Stallman <rms@gnu.org>
parents:
5307
diff
changeset
|
41 ;;; Hints and tips for major modes writers: |
7396503653cf
Complete rewrite by Lars.Lindberg@sypro.cap.se.
Richard M. Stallman <rms@gnu.org>
parents:
5307
diff
changeset
|
42 |
7396503653cf
Complete rewrite by Lars.Lindberg@sypro.cap.se.
Richard M. Stallman <rms@gnu.org>
parents:
5307
diff
changeset
|
43 ;; Recommended values C/Lisp etc text |
7396503653cf
Complete rewrite by Lars.Lindberg@sypro.cap.se.
Richard M. Stallman <rms@gnu.org>
parents:
5307
diff
changeset
|
44 ;; dabbrev-case-fold-search nil t |
7396503653cf
Complete rewrite by Lars.Lindberg@sypro.cap.se.
Richard M. Stallman <rms@gnu.org>
parents:
5307
diff
changeset
|
45 ;; dabbrev-case-replace nil t |
7396503653cf
Complete rewrite by Lars.Lindberg@sypro.cap.se.
Richard M. Stallman <rms@gnu.org>
parents:
5307
diff
changeset
|
46 ;; |
7396503653cf
Complete rewrite by Lars.Lindberg@sypro.cap.se.
Richard M. Stallman <rms@gnu.org>
parents:
5307
diff
changeset
|
47 ;; Set the variables you want special for your mode like this: |
7396503653cf
Complete rewrite by Lars.Lindberg@sypro.cap.se.
Richard M. Stallman <rms@gnu.org>
parents:
5307
diff
changeset
|
48 ;; (set (make-local-variable 'dabbrev-case-replace) nil) |
14040 | 49 ;; Then you don't interfere with other modes. |
10230
7396503653cf
Complete rewrite by Lars.Lindberg@sypro.cap.se.
Richard M. Stallman <rms@gnu.org>
parents:
5307
diff
changeset
|
50 ;; |
7396503653cf
Complete rewrite by Lars.Lindberg@sypro.cap.se.
Richard M. Stallman <rms@gnu.org>
parents:
5307
diff
changeset
|
51 ;; If your mode handles buffers that refers to other buffers |
7396503653cf
Complete rewrite by Lars.Lindberg@sypro.cap.se.
Richard M. Stallman <rms@gnu.org>
parents:
5307
diff
changeset
|
52 ;; (i.e. compilation-mode, gud-mode), then try to set |
7396503653cf
Complete rewrite by Lars.Lindberg@sypro.cap.se.
Richard M. Stallman <rms@gnu.org>
parents:
5307
diff
changeset
|
53 ;; `dabbrev-select-buffers-function' or `dabbrev-friend-buffer-function' |
7396503653cf
Complete rewrite by Lars.Lindberg@sypro.cap.se.
Richard M. Stallman <rms@gnu.org>
parents:
5307
diff
changeset
|
54 ;; to a function that point out those buffers. |
7396503653cf
Complete rewrite by Lars.Lindberg@sypro.cap.se.
Richard M. Stallman <rms@gnu.org>
parents:
5307
diff
changeset
|
55 |
7396503653cf
Complete rewrite by Lars.Lindberg@sypro.cap.se.
Richard M. Stallman <rms@gnu.org>
parents:
5307
diff
changeset
|
56 ;; Same goes for major-modes that are connected to other modes. There |
7396503653cf
Complete rewrite by Lars.Lindberg@sypro.cap.se.
Richard M. Stallman <rms@gnu.org>
parents:
5307
diff
changeset
|
57 ;; are for instance a number of mail-modes. One for reading, one for |
7396503653cf
Complete rewrite by Lars.Lindberg@sypro.cap.se.
Richard M. Stallman <rms@gnu.org>
parents:
5307
diff
changeset
|
58 ;; creating a new mail etc. Maybe those should be connected. |
7396503653cf
Complete rewrite by Lars.Lindberg@sypro.cap.se.
Richard M. Stallman <rms@gnu.org>
parents:
5307
diff
changeset
|
59 |
7396503653cf
Complete rewrite by Lars.Lindberg@sypro.cap.se.
Richard M. Stallman <rms@gnu.org>
parents:
5307
diff
changeset
|
60 ;; Example for GNUS (when we write a reply, we want dabbrev to look in |
7396503653cf
Complete rewrite by Lars.Lindberg@sypro.cap.se.
Richard M. Stallman <rms@gnu.org>
parents:
5307
diff
changeset
|
61 ;; the article for expansion): |
7396503653cf
Complete rewrite by Lars.Lindberg@sypro.cap.se.
Richard M. Stallman <rms@gnu.org>
parents:
5307
diff
changeset
|
62 ;; (set (make-local-variable 'dabbrev-friend-buffer-function) |
7396503653cf
Complete rewrite by Lars.Lindberg@sypro.cap.se.
Richard M. Stallman <rms@gnu.org>
parents:
5307
diff
changeset
|
63 ;; (lambda (buffer) |
7396503653cf
Complete rewrite by Lars.Lindberg@sypro.cap.se.
Richard M. Stallman <rms@gnu.org>
parents:
5307
diff
changeset
|
64 ;; (save-excursion |
7396503653cf
Complete rewrite by Lars.Lindberg@sypro.cap.se.
Richard M. Stallman <rms@gnu.org>
parents:
5307
diff
changeset
|
65 ;; (set-buffer buffer) |
7396503653cf
Complete rewrite by Lars.Lindberg@sypro.cap.se.
Richard M. Stallman <rms@gnu.org>
parents:
5307
diff
changeset
|
66 ;; (memq major-mode '(news-reply-mode gnus-article-mode))))) |
7396503653cf
Complete rewrite by Lars.Lindberg@sypro.cap.se.
Richard M. Stallman <rms@gnu.org>
parents:
5307
diff
changeset
|
67 |
7396503653cf
Complete rewrite by Lars.Lindberg@sypro.cap.se.
Richard M. Stallman <rms@gnu.org>
parents:
5307
diff
changeset
|
68 |
7396503653cf
Complete rewrite by Lars.Lindberg@sypro.cap.se.
Richard M. Stallman <rms@gnu.org>
parents:
5307
diff
changeset
|
69 ;; Known bugs and limitations. |
7396503653cf
Complete rewrite by Lars.Lindberg@sypro.cap.se.
Richard M. Stallman <rms@gnu.org>
parents:
5307
diff
changeset
|
70 ;; - Possible to do several levels of `dabbrev-completion' in the |
7396503653cf
Complete rewrite by Lars.Lindberg@sypro.cap.se.
Richard M. Stallman <rms@gnu.org>
parents:
5307
diff
changeset
|
71 ;; minibuffer. |
7396503653cf
Complete rewrite by Lars.Lindberg@sypro.cap.se.
Richard M. Stallman <rms@gnu.org>
parents:
5307
diff
changeset
|
72 ;; - dabbrev-completion doesn't handle resetting the globals variables |
7396503653cf
Complete rewrite by Lars.Lindberg@sypro.cap.se.
Richard M. Stallman <rms@gnu.org>
parents:
5307
diff
changeset
|
73 ;; right. It resets them after finding the abbrev. |
7396503653cf
Complete rewrite by Lars.Lindberg@sypro.cap.se.
Richard M. Stallman <rms@gnu.org>
parents:
5307
diff
changeset
|
74 |
7396503653cf
Complete rewrite by Lars.Lindberg@sypro.cap.se.
Richard M. Stallman <rms@gnu.org>
parents:
5307
diff
changeset
|
75 ;; Future enhancements |
7396503653cf
Complete rewrite by Lars.Lindberg@sypro.cap.se.
Richard M. Stallman <rms@gnu.org>
parents:
5307
diff
changeset
|
76 ;; - Check the tags-files? Like tags-complete? |
7396503653cf
Complete rewrite by Lars.Lindberg@sypro.cap.se.
Richard M. Stallman <rms@gnu.org>
parents:
5307
diff
changeset
|
77 ;; - Add the possibility of searching both forward and backward to |
7396503653cf
Complete rewrite by Lars.Lindberg@sypro.cap.se.
Richard M. Stallman <rms@gnu.org>
parents:
5307
diff
changeset
|
78 ;; the nearest expansion. |
10231
e88ff4b30786
Don't require cl, picture, or reporter.
Richard M. Stallman <rms@gnu.org>
parents:
10230
diff
changeset
|
79 ;; - Check the kill-ring when everything else fails. (Maybe something |
e88ff4b30786
Don't require cl, picture, or reporter.
Richard M. Stallman <rms@gnu.org>
parents:
10230
diff
changeset
|
80 ;; for hippie-expand?). [Bng] <boris@cs.rochester.edu> |
10230
7396503653cf
Complete rewrite by Lars.Lindberg@sypro.cap.se.
Richard M. Stallman <rms@gnu.org>
parents:
5307
diff
changeset
|
81 |
11820
362251066737
(dabbrev-completion): Use mapcar, not mapc.
Richard M. Stallman <rms@gnu.org>
parents:
10251
diff
changeset
|
82 ;;; These people gave suggestions: |
10230
7396503653cf
Complete rewrite by Lars.Lindberg@sypro.cap.se.
Richard M. Stallman <rms@gnu.org>
parents:
5307
diff
changeset
|
83 ;; [hymie] Hyman Rosen <marks!hymie@jyacc.jyacc.com> |
7396503653cf
Complete rewrite by Lars.Lindberg@sypro.cap.se.
Richard M. Stallman <rms@gnu.org>
parents:
5307
diff
changeset
|
84 ;; [burgett] Steve Burgett <burgett@bizet.eecs.berkeley.edu> |
7396503653cf
Complete rewrite by Lars.Lindberg@sypro.cap.se.
Richard M. Stallman <rms@gnu.org>
parents:
5307
diff
changeset
|
85 ;; [jules] Julian Gosnell <jules@x.co.uk> |
7396503653cf
Complete rewrite by Lars.Lindberg@sypro.cap.se.
Richard M. Stallman <rms@gnu.org>
parents:
5307
diff
changeset
|
86 ;; [kifer] Michael Kifer <kifer@sbcs.sunysb.edu> |
7396503653cf
Complete rewrite by Lars.Lindberg@sypro.cap.se.
Richard M. Stallman <rms@gnu.org>
parents:
5307
diff
changeset
|
87 ;; [ake] Ake Stenhoff <extaksf@aom.ericsson.se> |
7396503653cf
Complete rewrite by Lars.Lindberg@sypro.cap.se.
Richard M. Stallman <rms@gnu.org>
parents:
5307
diff
changeset
|
88 ;; [alon] Alon Albert <al%imercury@uunet.uu.net> |
7396503653cf
Complete rewrite by Lars.Lindberg@sypro.cap.se.
Richard M. Stallman <rms@gnu.org>
parents:
5307
diff
changeset
|
89 ;; [tromey] Tom Tromey <tromey@busco.lanl.gov> |
7396503653cf
Complete rewrite by Lars.Lindberg@sypro.cap.se.
Richard M. Stallman <rms@gnu.org>
parents:
5307
diff
changeset
|
90 ;; [Rolf] Rolf Schreiber <rolf@mathematik.uni-stuttgart.de> |
7396503653cf
Complete rewrite by Lars.Lindberg@sypro.cap.se.
Richard M. Stallman <rms@gnu.org>
parents:
5307
diff
changeset
|
91 ;; [Petri] Petri Raitio <per@tekla.fi> |
20604
cb1af13d913c
(dabbrev-ignored-buffer-names): New variable.
Richard M. Stallman <rms@gnu.org>
parents:
19827
diff
changeset
|
92 ;; [ejb] Jay Berkenbilt <ejb@ql.org> |
10230
7396503653cf
Complete rewrite by Lars.Lindberg@sypro.cap.se.
Richard M. Stallman <rms@gnu.org>
parents:
5307
diff
changeset
|
93 ;; [hawley] Bob Hawley <rth1@quartet.mt.att.com> |
7396503653cf
Complete rewrite by Lars.Lindberg@sypro.cap.se.
Richard M. Stallman <rms@gnu.org>
parents:
5307
diff
changeset
|
94 ;; ... and to all the people who have participated in the beta tests. |
267 | 95 |
807
4f28bd14272c
*** empty log message ***
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
793
diff
changeset
|
96 ;;; Code: |
4f28bd14272c
*** empty log message ***
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
793
diff
changeset
|
97 |
14169 | 98 ;;---------------------------------------------------------------- |
99 ;; Customization variables | |
100 ;;---------------------------------------------------------------- | |
17411
f0ff96a35eb8
Add defgroup's; use defcustom for user vars.
Richard M. Stallman <rms@gnu.org>
parents:
17263
diff
changeset
|
101 |
f0ff96a35eb8
Add defgroup's; use defcustom for user vars.
Richard M. Stallman <rms@gnu.org>
parents:
17263
diff
changeset
|
102 (defgroup dabbrev nil |
64002
47749dcdbecf
(dabbrev): Finish `defgroup' description with period.
Juanma Barranquero <lekktu@gmail.com>
parents:
62531
diff
changeset
|
103 "Dynamic Abbreviations." |
17411
f0ff96a35eb8
Add defgroup's; use defcustom for user vars.
Richard M. Stallman <rms@gnu.org>
parents:
17263
diff
changeset
|
104 :tag "Dynamic Abbreviations" |
22250
a77d473867b8
*** empty log message ***
Dan Nicolaescu <done@ece.arizona.edu>
parents:
21669
diff
changeset
|
105 :group 'abbrev |
a77d473867b8
*** empty log message ***
Dan Nicolaescu <done@ece.arizona.edu>
parents:
21669
diff
changeset
|
106 :group 'convenience) |
10230
7396503653cf
Complete rewrite by Lars.Lindberg@sypro.cap.se.
Richard M. Stallman <rms@gnu.org>
parents:
5307
diff
changeset
|
107 |
17411
f0ff96a35eb8
Add defgroup's; use defcustom for user vars.
Richard M. Stallman <rms@gnu.org>
parents:
17263
diff
changeset
|
108 (defcustom dabbrev-backward-only nil |
f0ff96a35eb8
Add defgroup's; use defcustom for user vars.
Richard M. Stallman <rms@gnu.org>
parents:
17263
diff
changeset
|
109 "*If non-nil, `dabbrev-expand' only looks backwards." |
f0ff96a35eb8
Add defgroup's; use defcustom for user vars.
Richard M. Stallman <rms@gnu.org>
parents:
17263
diff
changeset
|
110 :type 'boolean |
f0ff96a35eb8
Add defgroup's; use defcustom for user vars.
Richard M. Stallman <rms@gnu.org>
parents:
17263
diff
changeset
|
111 :group 'dabbrev) |
10230
7396503653cf
Complete rewrite by Lars.Lindberg@sypro.cap.se.
Richard M. Stallman <rms@gnu.org>
parents:
5307
diff
changeset
|
112 |
17411
f0ff96a35eb8
Add defgroup's; use defcustom for user vars.
Richard M. Stallman <rms@gnu.org>
parents:
17263
diff
changeset
|
113 (defcustom dabbrev-limit nil |
f0ff96a35eb8
Add defgroup's; use defcustom for user vars.
Richard M. Stallman <rms@gnu.org>
parents:
17263
diff
changeset
|
114 "*Limits region searched by `dabbrev-expand' to this many chars away." |
f0ff96a35eb8
Add defgroup's; use defcustom for user vars.
Richard M. Stallman <rms@gnu.org>
parents:
17263
diff
changeset
|
115 :type '(choice (const :tag "off" nil) |
f0ff96a35eb8
Add defgroup's; use defcustom for user vars.
Richard M. Stallman <rms@gnu.org>
parents:
17263
diff
changeset
|
116 integer) |
f0ff96a35eb8
Add defgroup's; use defcustom for user vars.
Richard M. Stallman <rms@gnu.org>
parents:
17263
diff
changeset
|
117 :group 'dabbrev) |
f0ff96a35eb8
Add defgroup's; use defcustom for user vars.
Richard M. Stallman <rms@gnu.org>
parents:
17263
diff
changeset
|
118 |
f0ff96a35eb8
Add defgroup's; use defcustom for user vars.
Richard M. Stallman <rms@gnu.org>
parents:
17263
diff
changeset
|
119 (defcustom dabbrev-abbrev-skip-leading-regexp nil |
10230
7396503653cf
Complete rewrite by Lars.Lindberg@sypro.cap.se.
Richard M. Stallman <rms@gnu.org>
parents:
5307
diff
changeset
|
120 "*Regexp for skipping leading characters of an abbreviation. |
7396503653cf
Complete rewrite by Lars.Lindberg@sypro.cap.se.
Richard M. Stallman <rms@gnu.org>
parents:
5307
diff
changeset
|
121 |
10231
e88ff4b30786
Don't require cl, picture, or reporter.
Richard M. Stallman <rms@gnu.org>
parents:
10230
diff
changeset
|
122 Example: Set this to \"\\\\$\" for programming languages |
e88ff4b30786
Don't require cl, picture, or reporter.
Richard M. Stallman <rms@gnu.org>
parents:
10230
diff
changeset
|
123 in which variable names may appear with or without a leading `$'. |
19308
f7a109d11c10
(dabbrev-abbrev-skip-leading-regexp): Doc fix.
Richard M. Stallman <rms@gnu.org>
parents:
17864
diff
changeset
|
124 \(For example, in Makefiles.\) |
10230
7396503653cf
Complete rewrite by Lars.Lindberg@sypro.cap.se.
Richard M. Stallman <rms@gnu.org>
parents:
5307
diff
changeset
|
125 |
17411
f0ff96a35eb8
Add defgroup's; use defcustom for user vars.
Richard M. Stallman <rms@gnu.org>
parents:
17263
diff
changeset
|
126 Set this to nil if no characters should be skipped." |
f0ff96a35eb8
Add defgroup's; use defcustom for user vars.
Richard M. Stallman <rms@gnu.org>
parents:
17263
diff
changeset
|
127 :type '(choice regexp |
f0ff96a35eb8
Add defgroup's; use defcustom for user vars.
Richard M. Stallman <rms@gnu.org>
parents:
17263
diff
changeset
|
128 (const :tag "off" nil)) |
f0ff96a35eb8
Add defgroup's; use defcustom for user vars.
Richard M. Stallman <rms@gnu.org>
parents:
17263
diff
changeset
|
129 :group 'dabbrev) |
10230
7396503653cf
Complete rewrite by Lars.Lindberg@sypro.cap.se.
Richard M. Stallman <rms@gnu.org>
parents:
5307
diff
changeset
|
130 |
37497
b04b5ca14967
Add doc strings for some functions.
Richard M. Stallman <rms@gnu.org>
parents:
37487
diff
changeset
|
131 (defcustom dabbrev--eliminate-newlines t |
b04b5ca14967
Add doc strings for some functions.
Richard M. Stallman <rms@gnu.org>
parents:
37487
diff
changeset
|
132 "*Non-nil means dabbrev should not insert newlines. |
b04b5ca14967
Add doc strings for some functions.
Richard M. Stallman <rms@gnu.org>
parents:
37487
diff
changeset
|
133 Instead it converts them to spaces." |
b04b5ca14967
Add doc strings for some functions.
Richard M. Stallman <rms@gnu.org>
parents:
37487
diff
changeset
|
134 :type 'boolean |
b04b5ca14967
Add doc strings for some functions.
Richard M. Stallman <rms@gnu.org>
parents:
37487
diff
changeset
|
135 :group 'dabbrev) |
b04b5ca14967
Add doc strings for some functions.
Richard M. Stallman <rms@gnu.org>
parents:
37487
diff
changeset
|
136 |
17411
f0ff96a35eb8
Add defgroup's; use defcustom for user vars.
Richard M. Stallman <rms@gnu.org>
parents:
17263
diff
changeset
|
137 (defcustom dabbrev-case-fold-search 'case-fold-search |
17711
3484851d83b9
(dabbrev-case-replace, dabbrev-case-fold-search):
Richard M. Stallman <rms@gnu.org>
parents:
17411
diff
changeset
|
138 "*Control whether dabbrev searches should ignore case. |
10231
e88ff4b30786
Don't require cl, picture, or reporter.
Richard M. Stallman <rms@gnu.org>
parents:
10230
diff
changeset
|
139 A value of nil means case is significant. |
17711
3484851d83b9
(dabbrev-case-replace, dabbrev-case-fold-search):
Richard M. Stallman <rms@gnu.org>
parents:
17411
diff
changeset
|
140 A value of `case-fold-search' means case is significant |
3484851d83b9
(dabbrev-case-replace, dabbrev-case-fold-search):
Richard M. Stallman <rms@gnu.org>
parents:
17411
diff
changeset
|
141 if `case-fold-search' is nil. |
3484851d83b9
(dabbrev-case-replace, dabbrev-case-fold-search):
Richard M. Stallman <rms@gnu.org>
parents:
17411
diff
changeset
|
142 Any other non-nil version means case is not significant." |
3484851d83b9
(dabbrev-case-replace, dabbrev-case-fold-search):
Richard M. Stallman <rms@gnu.org>
parents:
17411
diff
changeset
|
143 :type '(choice (const :tag "off" nil) |
22572
b1cba467a906
(dabbrev-case-fold-search, dabbrev-case-replace,
Andreas Schwab <schwab@suse.de>
parents:
22250
diff
changeset
|
144 (const :tag "like search" case-fold-search) |
b1cba467a906
(dabbrev-case-fold-search, dabbrev-case-replace,
Andreas Schwab <schwab@suse.de>
parents:
22250
diff
changeset
|
145 (other :tag "on" t)) |
17411
f0ff96a35eb8
Add defgroup's; use defcustom for user vars.
Richard M. Stallman <rms@gnu.org>
parents:
17263
diff
changeset
|
146 :group 'dabbrev) |
10230
7396503653cf
Complete rewrite by Lars.Lindberg@sypro.cap.se.
Richard M. Stallman <rms@gnu.org>
parents:
5307
diff
changeset
|
147 |
17411
f0ff96a35eb8
Add defgroup's; use defcustom for user vars.
Richard M. Stallman <rms@gnu.org>
parents:
17263
diff
changeset
|
148 (defcustom dabbrev-upcase-means-case-search nil |
10230
7396503653cf
Complete rewrite by Lars.Lindberg@sypro.cap.se.
Richard M. Stallman <rms@gnu.org>
parents:
5307
diff
changeset
|
149 "*The significance of an uppercase character in an abbreviation. |
45292
e3ba76f78075
(dabbrev-case-distinction): New option.
Richard M. Stallman <rms@gnu.org>
parents:
43981
diff
changeset
|
150 nil means case fold search when searching for possible expansions; |
e3ba76f78075
(dabbrev-case-distinction): New option.
Richard M. Stallman <rms@gnu.org>
parents:
43981
diff
changeset
|
151 non-nil means case sensitive search. |
10230
7396503653cf
Complete rewrite by Lars.Lindberg@sypro.cap.se.
Richard M. Stallman <rms@gnu.org>
parents:
5307
diff
changeset
|
152 |
10231
e88ff4b30786
Don't require cl, picture, or reporter.
Richard M. Stallman <rms@gnu.org>
parents:
10230
diff
changeset
|
153 This variable has an effect only when the value of |
17711
3484851d83b9
(dabbrev-case-replace, dabbrev-case-fold-search):
Richard M. Stallman <rms@gnu.org>
parents:
17411
diff
changeset
|
154 `dabbrev-case-fold-search' says to ignore case." |
17411
f0ff96a35eb8
Add defgroup's; use defcustom for user vars.
Richard M. Stallman <rms@gnu.org>
parents:
17263
diff
changeset
|
155 :type 'boolean |
f0ff96a35eb8
Add defgroup's; use defcustom for user vars.
Richard M. Stallman <rms@gnu.org>
parents:
17263
diff
changeset
|
156 :group 'dabbrev) |
10230
7396503653cf
Complete rewrite by Lars.Lindberg@sypro.cap.se.
Richard M. Stallman <rms@gnu.org>
parents:
5307
diff
changeset
|
157 |
45292
e3ba76f78075
(dabbrev-case-distinction): New option.
Richard M. Stallman <rms@gnu.org>
parents:
43981
diff
changeset
|
158 (defcustom dabbrev-case-distinction 'case-replace |
e3ba76f78075
(dabbrev-case-distinction): New option.
Richard M. Stallman <rms@gnu.org>
parents:
43981
diff
changeset
|
159 "*Whether dabbrev treats expansions as the same if they differ in case. |
e3ba76f78075
(dabbrev-case-distinction): New option.
Richard M. Stallman <rms@gnu.org>
parents:
43981
diff
changeset
|
160 |
e3ba76f78075
(dabbrev-case-distinction): New option.
Richard M. Stallman <rms@gnu.org>
parents:
43981
diff
changeset
|
161 A value of nil means treat them as different. |
e3ba76f78075
(dabbrev-case-distinction): New option.
Richard M. Stallman <rms@gnu.org>
parents:
43981
diff
changeset
|
162 A value of `case-replace' means distinguish them if `case-replace' is nil. |
e3ba76f78075
(dabbrev-case-distinction): New option.
Richard M. Stallman <rms@gnu.org>
parents:
43981
diff
changeset
|
163 Any other non-nil value means to treat them as the same. |
10230
7396503653cf
Complete rewrite by Lars.Lindberg@sypro.cap.se.
Richard M. Stallman <rms@gnu.org>
parents:
5307
diff
changeset
|
164 |
10231
e88ff4b30786
Don't require cl, picture, or reporter.
Richard M. Stallman <rms@gnu.org>
parents:
10230
diff
changeset
|
165 This variable has an effect only when the value of |
17711
3484851d83b9
(dabbrev-case-replace, dabbrev-case-fold-search):
Richard M. Stallman <rms@gnu.org>
parents:
17411
diff
changeset
|
166 `dabbrev-case-fold-search' specifies to ignore case." |
3484851d83b9
(dabbrev-case-replace, dabbrev-case-fold-search):
Richard M. Stallman <rms@gnu.org>
parents:
17411
diff
changeset
|
167 :type '(choice (const :tag "off" nil) |
45292
e3ba76f78075
(dabbrev-case-distinction): New option.
Richard M. Stallman <rms@gnu.org>
parents:
43981
diff
changeset
|
168 (const :tag "based on `case-replace'" case-replace) |
e3ba76f78075
(dabbrev-case-distinction): New option.
Richard M. Stallman <rms@gnu.org>
parents:
43981
diff
changeset
|
169 (other :tag "on" t)) |
e3ba76f78075
(dabbrev-case-distinction): New option.
Richard M. Stallman <rms@gnu.org>
parents:
43981
diff
changeset
|
170 :group 'dabbrev |
59996
aac0a33f5772
Change release version from 21.4 to 22.1 throughout.
Kim F. Storm <storm@cua.dk>
parents:
58274
diff
changeset
|
171 :version "22.1") |
45292
e3ba76f78075
(dabbrev-case-distinction): New option.
Richard M. Stallman <rms@gnu.org>
parents:
43981
diff
changeset
|
172 |
e3ba76f78075
(dabbrev-case-distinction): New option.
Richard M. Stallman <rms@gnu.org>
parents:
43981
diff
changeset
|
173 (defcustom dabbrev-case-replace 'case-replace |
e3ba76f78075
(dabbrev-case-distinction): New option.
Richard M. Stallman <rms@gnu.org>
parents:
43981
diff
changeset
|
174 "*Whether dabbrev applies the abbreviations's case pattern to the expansion. |
e3ba76f78075
(dabbrev-case-distinction): New option.
Richard M. Stallman <rms@gnu.org>
parents:
43981
diff
changeset
|
175 |
e3ba76f78075
(dabbrev-case-distinction): New option.
Richard M. Stallman <rms@gnu.org>
parents:
43981
diff
changeset
|
176 A value of nil means preserve the expansion's case pattern. |
e3ba76f78075
(dabbrev-case-distinction): New option.
Richard M. Stallman <rms@gnu.org>
parents:
43981
diff
changeset
|
177 A value of `case-replace' means preserve it if `case-replace' is nil. |
e3ba76f78075
(dabbrev-case-distinction): New option.
Richard M. Stallman <rms@gnu.org>
parents:
43981
diff
changeset
|
178 Any other non-nil value means modify the expansion |
e3ba76f78075
(dabbrev-case-distinction): New option.
Richard M. Stallman <rms@gnu.org>
parents:
43981
diff
changeset
|
179 by applying the abbreviation's case pattern to it. |
e3ba76f78075
(dabbrev-case-distinction): New option.
Richard M. Stallman <rms@gnu.org>
parents:
43981
diff
changeset
|
180 |
e3ba76f78075
(dabbrev-case-distinction): New option.
Richard M. Stallman <rms@gnu.org>
parents:
43981
diff
changeset
|
181 This variable has an effect only when the value of |
e3ba76f78075
(dabbrev-case-distinction): New option.
Richard M. Stallman <rms@gnu.org>
parents:
43981
diff
changeset
|
182 `dabbrev-case-fold-search' specifies to ignore case." |
e3ba76f78075
(dabbrev-case-distinction): New option.
Richard M. Stallman <rms@gnu.org>
parents:
43981
diff
changeset
|
183 :type '(choice (const :tag "off" nil) |
e3ba76f78075
(dabbrev-case-distinction): New option.
Richard M. Stallman <rms@gnu.org>
parents:
43981
diff
changeset
|
184 (const :tag "based on `case-replace'" case-replace) |
22572
b1cba467a906
(dabbrev-case-fold-search, dabbrev-case-replace,
Andreas Schwab <schwab@suse.de>
parents:
22250
diff
changeset
|
185 (other :tag "on" t)) |
17411
f0ff96a35eb8
Add defgroup's; use defcustom for user vars.
Richard M. Stallman <rms@gnu.org>
parents:
17263
diff
changeset
|
186 :group 'dabbrev) |
10230
7396503653cf
Complete rewrite by Lars.Lindberg@sypro.cap.se.
Richard M. Stallman <rms@gnu.org>
parents:
5307
diff
changeset
|
187 |
17411
f0ff96a35eb8
Add defgroup's; use defcustom for user vars.
Richard M. Stallman <rms@gnu.org>
parents:
17263
diff
changeset
|
188 (defcustom dabbrev-abbrev-char-regexp nil |
10231
e88ff4b30786
Don't require cl, picture, or reporter.
Richard M. Stallman <rms@gnu.org>
parents:
10230
diff
changeset
|
189 "*Regexp to recognize a character in an abbreviation or expansion. |
e88ff4b30786
Don't require cl, picture, or reporter.
Richard M. Stallman <rms@gnu.org>
parents:
10230
diff
changeset
|
190 This regexp will be surrounded with \\\\( ... \\\\) when actually used. |
10230
7396503653cf
Complete rewrite by Lars.Lindberg@sypro.cap.se.
Richard M. Stallman <rms@gnu.org>
parents:
5307
diff
changeset
|
191 |
10231
e88ff4b30786
Don't require cl, picture, or reporter.
Richard M. Stallman <rms@gnu.org>
parents:
10230
diff
changeset
|
192 Set this variable to \"\\\\sw\" if you want ordinary words or |
11820
362251066737
(dabbrev-completion): Use mapcar, not mapc.
Richard M. Stallman <rms@gnu.org>
parents:
10251
diff
changeset
|
193 \"\\\\sw\\\\|\\\\s_\" if you want symbols (including characters whose |
362251066737
(dabbrev-completion): Use mapcar, not mapc.
Richard M. Stallman <rms@gnu.org>
parents:
10251
diff
changeset
|
194 syntax is \"symbol\" as well as those whose syntax is \"word\". |
10230
7396503653cf
Complete rewrite by Lars.Lindberg@sypro.cap.se.
Richard M. Stallman <rms@gnu.org>
parents:
5307
diff
changeset
|
195 |
11820
362251066737
(dabbrev-completion): Use mapcar, not mapc.
Richard M. Stallman <rms@gnu.org>
parents:
10251
diff
changeset
|
196 The value nil has a special meaning: the abbreviation is from point to |
362251066737
(dabbrev-completion): Use mapcar, not mapc.
Richard M. Stallman <rms@gnu.org>
parents:
10251
diff
changeset
|
197 previous word-start, but the search is for symbols. |
267 | 198 |
10231
e88ff4b30786
Don't require cl, picture, or reporter.
Richard M. Stallman <rms@gnu.org>
parents:
10230
diff
changeset
|
199 For instance, if you are programming in Lisp, `yes-or-no-p' is a symbol, |
11820
362251066737
(dabbrev-completion): Use mapcar, not mapc.
Richard M. Stallman <rms@gnu.org>
parents:
10251
diff
changeset
|
200 while `yes', `or', `no' and `p' are considered words. If this |
362251066737
(dabbrev-completion): Use mapcar, not mapc.
Richard M. Stallman <rms@gnu.org>
parents:
10251
diff
changeset
|
201 variable is nil, then expanding `yes-or-no-' looks for a symbol |
10231
e88ff4b30786
Don't require cl, picture, or reporter.
Richard M. Stallman <rms@gnu.org>
parents:
10230
diff
changeset
|
202 starting with or containing `no-'. If you set this variable to |
e88ff4b30786
Don't require cl, picture, or reporter.
Richard M. Stallman <rms@gnu.org>
parents:
10230
diff
changeset
|
203 \"\\\\sw\\\\|\\\\s_\", that expansion looks for a symbol starting with |
e88ff4b30786
Don't require cl, picture, or reporter.
Richard M. Stallman <rms@gnu.org>
parents:
10230
diff
changeset
|
204 `yes-or-no-'. Finally, if you set this variable to \"\\\\sw\", then |
e88ff4b30786
Don't require cl, picture, or reporter.
Richard M. Stallman <rms@gnu.org>
parents:
10230
diff
changeset
|
205 expanding `yes-or-no-' signals an error because `-' is not part of a word; |
e88ff4b30786
Don't require cl, picture, or reporter.
Richard M. Stallman <rms@gnu.org>
parents:
10230
diff
changeset
|
206 but expanding `yes-or-no' looks for a word starting with `no'. |
10230
7396503653cf
Complete rewrite by Lars.Lindberg@sypro.cap.se.
Richard M. Stallman <rms@gnu.org>
parents:
5307
diff
changeset
|
207 |
17411
f0ff96a35eb8
Add defgroup's; use defcustom for user vars.
Richard M. Stallman <rms@gnu.org>
parents:
17263
diff
changeset
|
208 The recommended value is \"\\\\sw\\\\|\\\\s_\"." |
f0ff96a35eb8
Add defgroup's; use defcustom for user vars.
Richard M. Stallman <rms@gnu.org>
parents:
17263
diff
changeset
|
209 :type '(choice (const nil) |
f0ff96a35eb8
Add defgroup's; use defcustom for user vars.
Richard M. Stallman <rms@gnu.org>
parents:
17263
diff
changeset
|
210 regexp) |
f0ff96a35eb8
Add defgroup's; use defcustom for user vars.
Richard M. Stallman <rms@gnu.org>
parents:
17263
diff
changeset
|
211 :group 'dabbrev) |
10230
7396503653cf
Complete rewrite by Lars.Lindberg@sypro.cap.se.
Richard M. Stallman <rms@gnu.org>
parents:
5307
diff
changeset
|
212 |
17411
f0ff96a35eb8
Add defgroup's; use defcustom for user vars.
Richard M. Stallman <rms@gnu.org>
parents:
17263
diff
changeset
|
213 (defcustom dabbrev-check-all-buffers t |
11820
362251066737
(dabbrev-completion): Use mapcar, not mapc.
Richard M. Stallman <rms@gnu.org>
parents:
10251
diff
changeset
|
214 "*Non-nil means dabbrev package should search *all* buffers. |
10230
7396503653cf
Complete rewrite by Lars.Lindberg@sypro.cap.se.
Richard M. Stallman <rms@gnu.org>
parents:
5307
diff
changeset
|
215 |
11820
362251066737
(dabbrev-completion): Use mapcar, not mapc.
Richard M. Stallman <rms@gnu.org>
parents:
10251
diff
changeset
|
216 Dabbrev always searches the current buffer first. Then, if |
362251066737
(dabbrev-completion): Use mapcar, not mapc.
Richard M. Stallman <rms@gnu.org>
parents:
10251
diff
changeset
|
217 `dabbrev-check-other-buffers' says so, it searches the buffers |
362251066737
(dabbrev-completion): Use mapcar, not mapc.
Richard M. Stallman <rms@gnu.org>
parents:
10251
diff
changeset
|
218 designated by `dabbrev-select-buffers-function'. |
362251066737
(dabbrev-completion): Use mapcar, not mapc.
Richard M. Stallman <rms@gnu.org>
parents:
10251
diff
changeset
|
219 |
362251066737
(dabbrev-completion): Use mapcar, not mapc.
Richard M. Stallman <rms@gnu.org>
parents:
10251
diff
changeset
|
220 Then, if `dabbrev-check-all-buffers' is non-nil, dabbrev searches |
28486
7b327ea7706b
(dabbrev-ignored-regexps): New user-option.
Gerd Moellmann <gerd@gnu.org>
parents:
26459
diff
changeset
|
221 all the other buffers, except those named in `dabbrev-ignored-buffer-names', |
7b327ea7706b
(dabbrev-ignored-regexps): New user-option.
Gerd Moellmann <gerd@gnu.org>
parents:
26459
diff
changeset
|
222 or matched by `dabbrev-ignored-regexps'." |
17411
f0ff96a35eb8
Add defgroup's; use defcustom for user vars.
Richard M. Stallman <rms@gnu.org>
parents:
17263
diff
changeset
|
223 :type 'boolean |
f0ff96a35eb8
Add defgroup's; use defcustom for user vars.
Richard M. Stallman <rms@gnu.org>
parents:
17263
diff
changeset
|
224 :group 'dabbrev) |
10230
7396503653cf
Complete rewrite by Lars.Lindberg@sypro.cap.se.
Richard M. Stallman <rms@gnu.org>
parents:
5307
diff
changeset
|
225 |
22608
e1e08f5e0662
(dabbrev-ignored-buffer-names): Fix typo. Add *Buffer List*.
Richard M. Stallman <rms@gnu.org>
parents:
22572
diff
changeset
|
226 (defcustom dabbrev-ignored-buffer-names '("*Messages*" "*Buffer List*") |
28486
7b327ea7706b
(dabbrev-ignored-regexps): New user-option.
Gerd Moellmann <gerd@gnu.org>
parents:
26459
diff
changeset
|
227 "*List of buffer names that dabbrev should not check. |
35921
d74e2e8f6c1f
(dabbrev-ignored-buffer-regexps): Renamed from
Gerd Moellmann <gerd@gnu.org>
parents:
35636
diff
changeset
|
228 See also `dabbrev-ignored-buffer-regexps'." |
20604
cb1af13d913c
(dabbrev-ignored-buffer-names): New variable.
Richard M. Stallman <rms@gnu.org>
parents:
19827
diff
changeset
|
229 :type '(repeat (string :tag "Buffer name")) |
21669
9861518505cb
*** empty log message ***
Dan Nicolaescu <done@ece.arizona.edu>
parents:
21153
diff
changeset
|
230 :group 'dabbrev |
9861518505cb
*** empty log message ***
Dan Nicolaescu <done@ece.arizona.edu>
parents:
21153
diff
changeset
|
231 :version "20.3") |
20604
cb1af13d913c
(dabbrev-ignored-buffer-names): New variable.
Richard M. Stallman <rms@gnu.org>
parents:
19827
diff
changeset
|
232 |
35921
d74e2e8f6c1f
(dabbrev-ignored-buffer-regexps): Renamed from
Gerd Moellmann <gerd@gnu.org>
parents:
35636
diff
changeset
|
233 (defcustom dabbrev-ignored-buffer-regexps nil |
28486
7b327ea7706b
(dabbrev-ignored-regexps): New user-option.
Gerd Moellmann <gerd@gnu.org>
parents:
26459
diff
changeset
|
234 "*List of regexps matching names of buffers that dabbrev should not check. |
7b327ea7706b
(dabbrev-ignored-regexps): New user-option.
Gerd Moellmann <gerd@gnu.org>
parents:
26459
diff
changeset
|
235 See also `dabbrev-ignored-buffer-names'." |
7b327ea7706b
(dabbrev-ignored-regexps): New user-option.
Gerd Moellmann <gerd@gnu.org>
parents:
26459
diff
changeset
|
236 :type '(repeat regexp) |
7b327ea7706b
(dabbrev-ignored-regexps): New user-option.
Gerd Moellmann <gerd@gnu.org>
parents:
26459
diff
changeset
|
237 :group 'dabbrev |
7b327ea7706b
(dabbrev-ignored-regexps): New user-option.
Gerd Moellmann <gerd@gnu.org>
parents:
26459
diff
changeset
|
238 :version "21.1") |
7b327ea7706b
(dabbrev-ignored-regexps): New user-option.
Gerd Moellmann <gerd@gnu.org>
parents:
26459
diff
changeset
|
239 |
17411
f0ff96a35eb8
Add defgroup's; use defcustom for user vars.
Richard M. Stallman <rms@gnu.org>
parents:
17263
diff
changeset
|
240 (defcustom dabbrev-check-other-buffers t |
10230
7396503653cf
Complete rewrite by Lars.Lindberg@sypro.cap.se.
Richard M. Stallman <rms@gnu.org>
parents:
5307
diff
changeset
|
241 "*Should \\[dabbrev-expand] look in other buffers?\ |
7396503653cf
Complete rewrite by Lars.Lindberg@sypro.cap.se.
Richard M. Stallman <rms@gnu.org>
parents:
5307
diff
changeset
|
242 |
11820
362251066737
(dabbrev-completion): Use mapcar, not mapc.
Richard M. Stallman <rms@gnu.org>
parents:
10251
diff
changeset
|
243 nil: Don't look in other buffers. |
362251066737
(dabbrev-completion): Use mapcar, not mapc.
Richard M. Stallman <rms@gnu.org>
parents:
10251
diff
changeset
|
244 t: Also look for expansions in the buffers pointed out by |
362251066737
(dabbrev-completion): Use mapcar, not mapc.
Richard M. Stallman <rms@gnu.org>
parents:
10251
diff
changeset
|
245 `dabbrev-select-buffers-function'. |
362251066737
(dabbrev-completion): Use mapcar, not mapc.
Richard M. Stallman <rms@gnu.org>
parents:
10251
diff
changeset
|
246 Anything else: When we can't find any more expansions in |
362251066737
(dabbrev-completion): Use mapcar, not mapc.
Richard M. Stallman <rms@gnu.org>
parents:
10251
diff
changeset
|
247 the current buffer, then ask the user whether to look in other |
362251066737
(dabbrev-completion): Use mapcar, not mapc.
Richard M. Stallman <rms@gnu.org>
parents:
10251
diff
changeset
|
248 buffers too. |
362251066737
(dabbrev-completion): Use mapcar, not mapc.
Richard M. Stallman <rms@gnu.org>
parents:
10251
diff
changeset
|
249 |
17411
f0ff96a35eb8
Add defgroup's; use defcustom for user vars.
Richard M. Stallman <rms@gnu.org>
parents:
17263
diff
changeset
|
250 The default value is t." |
f0ff96a35eb8
Add defgroup's; use defcustom for user vars.
Richard M. Stallman <rms@gnu.org>
parents:
17263
diff
changeset
|
251 :type '(choice (const :tag "off" nil) |
f0ff96a35eb8
Add defgroup's; use defcustom for user vars.
Richard M. Stallman <rms@gnu.org>
parents:
17263
diff
changeset
|
252 (const :tag "on" t) |
22572
b1cba467a906
(dabbrev-case-fold-search, dabbrev-case-replace,
Andreas Schwab <schwab@suse.de>
parents:
22250
diff
changeset
|
253 (other :tag "ask" other)) |
17411
f0ff96a35eb8
Add defgroup's; use defcustom for user vars.
Richard M. Stallman <rms@gnu.org>
parents:
17263
diff
changeset
|
254 :group 'dabbrev) |
10230
7396503653cf
Complete rewrite by Lars.Lindberg@sypro.cap.se.
Richard M. Stallman <rms@gnu.org>
parents:
5307
diff
changeset
|
255 |
7396503653cf
Complete rewrite by Lars.Lindberg@sypro.cap.se.
Richard M. Stallman <rms@gnu.org>
parents:
5307
diff
changeset
|
256 ;; I guess setting this to a function that selects all C- or C++- |
7396503653cf
Complete rewrite by Lars.Lindberg@sypro.cap.se.
Richard M. Stallman <rms@gnu.org>
parents:
5307
diff
changeset
|
257 ;; mode buffers would be a good choice for a debugging buffer, |
7396503653cf
Complete rewrite by Lars.Lindberg@sypro.cap.se.
Richard M. Stallman <rms@gnu.org>
parents:
5307
diff
changeset
|
258 ;; when debugging C- or C++-code. |
7396503653cf
Complete rewrite by Lars.Lindberg@sypro.cap.se.
Richard M. Stallman <rms@gnu.org>
parents:
5307
diff
changeset
|
259 (defvar dabbrev-select-buffers-function 'dabbrev--select-buffers |
7396503653cf
Complete rewrite by Lars.Lindberg@sypro.cap.se.
Richard M. Stallman <rms@gnu.org>
parents:
5307
diff
changeset
|
260 "A function that selects buffers that should be searched by dabbrev. |
7396503653cf
Complete rewrite by Lars.Lindberg@sypro.cap.se.
Richard M. Stallman <rms@gnu.org>
parents:
5307
diff
changeset
|
261 The function should take no arguments and return a list of buffers to |
37573
210efced5807
(dabbrev-select-buffers-function): Doc fix.
Richard M. Stallman <rms@gnu.org>
parents:
37504
diff
changeset
|
262 search for expansions. See the source of `dabbrev--select-buffers' |
210efced5807
(dabbrev-select-buffers-function): Doc fix.
Richard M. Stallman <rms@gnu.org>
parents:
37504
diff
changeset
|
263 for an example. |
10230
7396503653cf
Complete rewrite by Lars.Lindberg@sypro.cap.se.
Richard M. Stallman <rms@gnu.org>
parents:
5307
diff
changeset
|
264 |
7396503653cf
Complete rewrite by Lars.Lindberg@sypro.cap.se.
Richard M. Stallman <rms@gnu.org>
parents:
5307
diff
changeset
|
265 A mode setting this variable should make it buffer local.") |
7396503653cf
Complete rewrite by Lars.Lindberg@sypro.cap.se.
Richard M. Stallman <rms@gnu.org>
parents:
5307
diff
changeset
|
266 |
17411
f0ff96a35eb8
Add defgroup's; use defcustom for user vars.
Richard M. Stallman <rms@gnu.org>
parents:
17263
diff
changeset
|
267 (defcustom dabbrev-friend-buffer-function 'dabbrev--same-major-mode-p |
11820
362251066737
(dabbrev-completion): Use mapcar, not mapc.
Richard M. Stallman <rms@gnu.org>
parents:
10251
diff
changeset
|
268 "*A function to decide whether dabbrev should search OTHER-BUFFER. |
10230
7396503653cf
Complete rewrite by Lars.Lindberg@sypro.cap.se.
Richard M. Stallman <rms@gnu.org>
parents:
5307
diff
changeset
|
269 The function should take one argument, OTHER-BUFFER, and return |
7396503653cf
Complete rewrite by Lars.Lindberg@sypro.cap.se.
Richard M. Stallman <rms@gnu.org>
parents:
5307
diff
changeset
|
270 non-nil if that buffer should be searched. Have a look at |
7396503653cf
Complete rewrite by Lars.Lindberg@sypro.cap.se.
Richard M. Stallman <rms@gnu.org>
parents:
5307
diff
changeset
|
271 `dabbrev--same-major-mode-p' for an example. |
7396503653cf
Complete rewrite by Lars.Lindberg@sypro.cap.se.
Richard M. Stallman <rms@gnu.org>
parents:
5307
diff
changeset
|
272 |
10231
e88ff4b30786
Don't require cl, picture, or reporter.
Richard M. Stallman <rms@gnu.org>
parents:
10230
diff
changeset
|
273 The value of `dabbrev-friend-buffer-function' has an effect only if |
e88ff4b30786
Don't require cl, picture, or reporter.
Richard M. Stallman <rms@gnu.org>
parents:
10230
diff
changeset
|
274 the value of `dabbrev-select-buffers-function' uses it. The function |
e88ff4b30786
Don't require cl, picture, or reporter.
Richard M. Stallman <rms@gnu.org>
parents:
10230
diff
changeset
|
275 `dabbrev--select-buffers' is one function you can use here. |
10230
7396503653cf
Complete rewrite by Lars.Lindberg@sypro.cap.se.
Richard M. Stallman <rms@gnu.org>
parents:
5307
diff
changeset
|
276 |
17411
f0ff96a35eb8
Add defgroup's; use defcustom for user vars.
Richard M. Stallman <rms@gnu.org>
parents:
17263
diff
changeset
|
277 A mode setting this variable should make it buffer local." |
f0ff96a35eb8
Add defgroup's; use defcustom for user vars.
Richard M. Stallman <rms@gnu.org>
parents:
17263
diff
changeset
|
278 :type 'function |
f0ff96a35eb8
Add defgroup's; use defcustom for user vars.
Richard M. Stallman <rms@gnu.org>
parents:
17263
diff
changeset
|
279 :group 'dabbrev) |
10230
7396503653cf
Complete rewrite by Lars.Lindberg@sypro.cap.se.
Richard M. Stallman <rms@gnu.org>
parents:
5307
diff
changeset
|
280 |
17411
f0ff96a35eb8
Add defgroup's; use defcustom for user vars.
Richard M. Stallman <rms@gnu.org>
parents:
17263
diff
changeset
|
281 (defcustom dabbrev-search-these-buffers-only nil |
10231
e88ff4b30786
Don't require cl, picture, or reporter.
Richard M. Stallman <rms@gnu.org>
parents:
10230
diff
changeset
|
282 "If non-nil, a list of buffers which dabbrev should search. |
e88ff4b30786
Don't require cl, picture, or reporter.
Richard M. Stallman <rms@gnu.org>
parents:
10230
diff
changeset
|
283 If this variable is non-nil, dabbrev will only look in these buffers. |
e88ff4b30786
Don't require cl, picture, or reporter.
Richard M. Stallman <rms@gnu.org>
parents:
10230
diff
changeset
|
284 It will not even look in the current buffer if it is not a member of |
62531
c905fcf5e3d9
Specify missing group (and type, if simple) in defcustom.
Juanma Barranquero <lekktu@gmail.com>
parents:
59996
diff
changeset
|
285 this list." |
c905fcf5e3d9
Specify missing group (and type, if simple) in defcustom.
Juanma Barranquero <lekktu@gmail.com>
parents:
59996
diff
changeset
|
286 :group 'dabbrev) |
10230
7396503653cf
Complete rewrite by Lars.Lindberg@sypro.cap.se.
Richard M. Stallman <rms@gnu.org>
parents:
5307
diff
changeset
|
287 |
14169 | 288 ;;---------------------------------------------------------------- |
289 ;; Internal variables | |
290 ;;---------------------------------------------------------------- | |
10230
7396503653cf
Complete rewrite by Lars.Lindberg@sypro.cap.se.
Richard M. Stallman <rms@gnu.org>
parents:
5307
diff
changeset
|
291 |
7396503653cf
Complete rewrite by Lars.Lindberg@sypro.cap.se.
Richard M. Stallman <rms@gnu.org>
parents:
5307
diff
changeset
|
292 ;; Last obarray of completions in `dabbrev-completion' |
7396503653cf
Complete rewrite by Lars.Lindberg@sypro.cap.se.
Richard M. Stallman <rms@gnu.org>
parents:
5307
diff
changeset
|
293 (defvar dabbrev--last-obarray nil) |
7396503653cf
Complete rewrite by Lars.Lindberg@sypro.cap.se.
Richard M. Stallman <rms@gnu.org>
parents:
5307
diff
changeset
|
294 |
7396503653cf
Complete rewrite by Lars.Lindberg@sypro.cap.se.
Richard M. Stallman <rms@gnu.org>
parents:
5307
diff
changeset
|
295 ;; Table of expansions seen so far |
7396503653cf
Complete rewrite by Lars.Lindberg@sypro.cap.se.
Richard M. Stallman <rms@gnu.org>
parents:
5307
diff
changeset
|
296 (defvar dabbrev--last-table nil) |
7396503653cf
Complete rewrite by Lars.Lindberg@sypro.cap.se.
Richard M. Stallman <rms@gnu.org>
parents:
5307
diff
changeset
|
297 |
7396503653cf
Complete rewrite by Lars.Lindberg@sypro.cap.se.
Richard M. Stallman <rms@gnu.org>
parents:
5307
diff
changeset
|
298 ;; Last string we tried to expand. |
7396503653cf
Complete rewrite by Lars.Lindberg@sypro.cap.se.
Richard M. Stallman <rms@gnu.org>
parents:
5307
diff
changeset
|
299 (defvar dabbrev--last-abbreviation nil) |
7396503653cf
Complete rewrite by Lars.Lindberg@sypro.cap.se.
Richard M. Stallman <rms@gnu.org>
parents:
5307
diff
changeset
|
300 |
7396503653cf
Complete rewrite by Lars.Lindberg@sypro.cap.se.
Richard M. Stallman <rms@gnu.org>
parents:
5307
diff
changeset
|
301 ;; Location last abbreviation began |
7396503653cf
Complete rewrite by Lars.Lindberg@sypro.cap.se.
Richard M. Stallman <rms@gnu.org>
parents:
5307
diff
changeset
|
302 (defvar dabbrev--last-abbrev-location nil) |
267 | 303 |
10230
7396503653cf
Complete rewrite by Lars.Lindberg@sypro.cap.se.
Richard M. Stallman <rms@gnu.org>
parents:
5307
diff
changeset
|
304 ;; Direction of last dabbrevs search |
7396503653cf
Complete rewrite by Lars.Lindberg@sypro.cap.se.
Richard M. Stallman <rms@gnu.org>
parents:
5307
diff
changeset
|
305 (defvar dabbrev--last-direction 0) |
7396503653cf
Complete rewrite by Lars.Lindberg@sypro.cap.se.
Richard M. Stallman <rms@gnu.org>
parents:
5307
diff
changeset
|
306 |
7396503653cf
Complete rewrite by Lars.Lindberg@sypro.cap.se.
Richard M. Stallman <rms@gnu.org>
parents:
5307
diff
changeset
|
307 ;; Last expansion of an abbreviation. |
7396503653cf
Complete rewrite by Lars.Lindberg@sypro.cap.se.
Richard M. Stallman <rms@gnu.org>
parents:
5307
diff
changeset
|
308 (defvar dabbrev--last-expansion nil) |
7396503653cf
Complete rewrite by Lars.Lindberg@sypro.cap.se.
Richard M. Stallman <rms@gnu.org>
parents:
5307
diff
changeset
|
309 |
7396503653cf
Complete rewrite by Lars.Lindberg@sypro.cap.se.
Richard M. Stallman <rms@gnu.org>
parents:
5307
diff
changeset
|
310 ;; Location the last expansion was found. |
7396503653cf
Complete rewrite by Lars.Lindberg@sypro.cap.se.
Richard M. Stallman <rms@gnu.org>
parents:
5307
diff
changeset
|
311 (defvar dabbrev--last-expansion-location nil) |
7396503653cf
Complete rewrite by Lars.Lindberg@sypro.cap.se.
Richard M. Stallman <rms@gnu.org>
parents:
5307
diff
changeset
|
312 |
7396503653cf
Complete rewrite by Lars.Lindberg@sypro.cap.se.
Richard M. Stallman <rms@gnu.org>
parents:
5307
diff
changeset
|
313 ;; The list of remaining buffers with the same mode as current buffer. |
7396503653cf
Complete rewrite by Lars.Lindberg@sypro.cap.se.
Richard M. Stallman <rms@gnu.org>
parents:
5307
diff
changeset
|
314 (defvar dabbrev--friend-buffer-list nil) |
7396503653cf
Complete rewrite by Lars.Lindberg@sypro.cap.se.
Richard M. Stallman <rms@gnu.org>
parents:
5307
diff
changeset
|
315 |
38138
a7bf2382c0d7
(dabbrev--make-friend-buffer-list): New function,
Richard M. Stallman <rms@gnu.org>
parents:
37573
diff
changeset
|
316 ;; The buffer we looked in last, not counting the current buffer. |
10230
7396503653cf
Complete rewrite by Lars.Lindberg@sypro.cap.se.
Richard M. Stallman <rms@gnu.org>
parents:
5307
diff
changeset
|
317 (defvar dabbrev--last-buffer nil) |
7396503653cf
Complete rewrite by Lars.Lindberg@sypro.cap.se.
Richard M. Stallman <rms@gnu.org>
parents:
5307
diff
changeset
|
318 |
7396503653cf
Complete rewrite by Lars.Lindberg@sypro.cap.se.
Richard M. Stallman <rms@gnu.org>
parents:
5307
diff
changeset
|
319 ;; The buffer we found the expansion last time. |
7396503653cf
Complete rewrite by Lars.Lindberg@sypro.cap.se.
Richard M. Stallman <rms@gnu.org>
parents:
5307
diff
changeset
|
320 (defvar dabbrev--last-buffer-found nil) |
7396503653cf
Complete rewrite by Lars.Lindberg@sypro.cap.se.
Richard M. Stallman <rms@gnu.org>
parents:
5307
diff
changeset
|
321 |
7396503653cf
Complete rewrite by Lars.Lindberg@sypro.cap.se.
Richard M. Stallman <rms@gnu.org>
parents:
5307
diff
changeset
|
322 ;; The buffer we last did a completion in. |
7396503653cf
Complete rewrite by Lars.Lindberg@sypro.cap.se.
Richard M. Stallman <rms@gnu.org>
parents:
5307
diff
changeset
|
323 (defvar dabbrev--last-completion-buffer nil) |
7396503653cf
Complete rewrite by Lars.Lindberg@sypro.cap.se.
Richard M. Stallman <rms@gnu.org>
parents:
5307
diff
changeset
|
324 |
34596
51c08e149a23
(dabbrev--last-case-pattern): Value is now
Gerd Moellmann <gerd@gnu.org>
parents:
30002
diff
changeset
|
325 ;; If non-nil, a function to use when copying successive words. |
51c08e149a23
(dabbrev--last-case-pattern): Value is now
Gerd Moellmann <gerd@gnu.org>
parents:
30002
diff
changeset
|
326 ;; It should be `upcase' or `downcase'. |
15834
71ede15e1ca3
(dabbrev--last-case-pattern): New variable.
Richard M. Stallman <rms@gnu.org>
parents:
15812
diff
changeset
|
327 (defvar dabbrev--last-case-pattern nil) |
71ede15e1ca3
(dabbrev--last-case-pattern): New variable.
Richard M. Stallman <rms@gnu.org>
parents:
15812
diff
changeset
|
328 |
11820
362251066737
(dabbrev-completion): Use mapcar, not mapc.
Richard M. Stallman <rms@gnu.org>
parents:
10251
diff
changeset
|
329 ;; Same as dabbrev-check-other-buffers, but is set for every expand. |
362251066737
(dabbrev-completion): Use mapcar, not mapc.
Richard M. Stallman <rms@gnu.org>
parents:
10251
diff
changeset
|
330 (defvar dabbrev--check-other-buffers dabbrev-check-other-buffers) |
10230
7396503653cf
Complete rewrite by Lars.Lindberg@sypro.cap.se.
Richard M. Stallman <rms@gnu.org>
parents:
5307
diff
changeset
|
331 |
7396503653cf
Complete rewrite by Lars.Lindberg@sypro.cap.se.
Richard M. Stallman <rms@gnu.org>
parents:
5307
diff
changeset
|
332 ;; The regexp for recognizing a character in an abbreviation. |
7396503653cf
Complete rewrite by Lars.Lindberg@sypro.cap.se.
Richard M. Stallman <rms@gnu.org>
parents:
5307
diff
changeset
|
333 (defvar dabbrev--abbrev-char-regexp nil) |
267 | 334 |
14169 | 335 ;;---------------------------------------------------------------- |
336 ;; Macros | |
337 ;;---------------------------------------------------------------- | |
10230
7396503653cf
Complete rewrite by Lars.Lindberg@sypro.cap.se.
Richard M. Stallman <rms@gnu.org>
parents:
5307
diff
changeset
|
338 |
7396503653cf
Complete rewrite by Lars.Lindberg@sypro.cap.se.
Richard M. Stallman <rms@gnu.org>
parents:
5307
diff
changeset
|
339 ;;; Get the buffer that mini-buffer was activated from |
7396503653cf
Complete rewrite by Lars.Lindberg@sypro.cap.se.
Richard M. Stallman <rms@gnu.org>
parents:
5307
diff
changeset
|
340 (defsubst dabbrev--minibuffer-origin () |
7396503653cf
Complete rewrite by Lars.Lindberg@sypro.cap.se.
Richard M. Stallman <rms@gnu.org>
parents:
5307
diff
changeset
|
341 (car (cdr (buffer-list)))) |
7396503653cf
Complete rewrite by Lars.Lindberg@sypro.cap.se.
Richard M. Stallman <rms@gnu.org>
parents:
5307
diff
changeset
|
342 |
10231
e88ff4b30786
Don't require cl, picture, or reporter.
Richard M. Stallman <rms@gnu.org>
parents:
10230
diff
changeset
|
343 ;; Make a list of some of the elements of LIST. |
e88ff4b30786
Don't require cl, picture, or reporter.
Richard M. Stallman <rms@gnu.org>
parents:
10230
diff
changeset
|
344 ;; Check each element of LIST, storing it temporarily in the |
e88ff4b30786
Don't require cl, picture, or reporter.
Richard M. Stallman <rms@gnu.org>
parents:
10230
diff
changeset
|
345 ;; variable ELEMENT, and include it in the result |
e88ff4b30786
Don't require cl, picture, or reporter.
Richard M. Stallman <rms@gnu.org>
parents:
10230
diff
changeset
|
346 ;; if CONDITION evaluates non-nil. |
e88ff4b30786
Don't require cl, picture, or reporter.
Richard M. Stallman <rms@gnu.org>
parents:
10230
diff
changeset
|
347 (defmacro dabbrev-filter-elements (element list condition) |
26459
1ef9d70dfb0f
* dabbrev.el (dabbrev-filter-elements): Use the new backquote syntax.
Sam Steingold <sds@gnu.org>
parents:
23306
diff
changeset
|
348 `(let (dabbrev-result dabbrev-tail ,element) |
1ef9d70dfb0f
* dabbrev.el (dabbrev-filter-elements): Use the new backquote syntax.
Sam Steingold <sds@gnu.org>
parents:
23306
diff
changeset
|
349 (setq dabbrev-tail ,list) |
1ef9d70dfb0f
* dabbrev.el (dabbrev-filter-elements): Use the new backquote syntax.
Sam Steingold <sds@gnu.org>
parents:
23306
diff
changeset
|
350 (while dabbrev-tail |
1ef9d70dfb0f
* dabbrev.el (dabbrev-filter-elements): Use the new backquote syntax.
Sam Steingold <sds@gnu.org>
parents:
23306
diff
changeset
|
351 (setq ,element (car dabbrev-tail)) |
1ef9d70dfb0f
* dabbrev.el (dabbrev-filter-elements): Use the new backquote syntax.
Sam Steingold <sds@gnu.org>
parents:
23306
diff
changeset
|
352 (if ,condition |
1ef9d70dfb0f
* dabbrev.el (dabbrev-filter-elements): Use the new backquote syntax.
Sam Steingold <sds@gnu.org>
parents:
23306
diff
changeset
|
353 (setq dabbrev-result (cons ,element dabbrev-result))) |
1ef9d70dfb0f
* dabbrev.el (dabbrev-filter-elements): Use the new backquote syntax.
Sam Steingold <sds@gnu.org>
parents:
23306
diff
changeset
|
354 (setq dabbrev-tail (cdr dabbrev-tail))) |
1ef9d70dfb0f
* dabbrev.el (dabbrev-filter-elements): Use the new backquote syntax.
Sam Steingold <sds@gnu.org>
parents:
23306
diff
changeset
|
355 (nreverse dabbrev-result))) |
10231
e88ff4b30786
Don't require cl, picture, or reporter.
Richard M. Stallman <rms@gnu.org>
parents:
10230
diff
changeset
|
356 |
14169 | 357 ;;---------------------------------------------------------------- |
358 ;; Exported functions | |
359 ;;---------------------------------------------------------------- | |
10230
7396503653cf
Complete rewrite by Lars.Lindberg@sypro.cap.se.
Richard M. Stallman <rms@gnu.org>
parents:
5307
diff
changeset
|
360 |
52103
1ffb07fde6de
Don't redo key bindings on loading, put them only in loaddefs.el.
Andreas Schwab <schwab@suse.de>
parents:
51422
diff
changeset
|
361 ;;;###autoload (define-key esc-map "/" 'dabbrev-expand) |
10231
e88ff4b30786
Don't require cl, picture, or reporter.
Richard M. Stallman <rms@gnu.org>
parents:
10230
diff
changeset
|
362 ;;;??? Do we want this? |
52103
1ffb07fde6de
Don't redo key bindings on loading, put them only in loaddefs.el.
Andreas Schwab <schwab@suse.de>
parents:
51422
diff
changeset
|
363 ;;;###autoload (define-key esc-map [?\C-/] 'dabbrev-completion) |
10230
7396503653cf
Complete rewrite by Lars.Lindberg@sypro.cap.se.
Richard M. Stallman <rms@gnu.org>
parents:
5307
diff
changeset
|
364 |
7396503653cf
Complete rewrite by Lars.Lindberg@sypro.cap.se.
Richard M. Stallman <rms@gnu.org>
parents:
5307
diff
changeset
|
365 ;;;###autoload |
7396503653cf
Complete rewrite by Lars.Lindberg@sypro.cap.se.
Richard M. Stallman <rms@gnu.org>
parents:
5307
diff
changeset
|
366 (defun dabbrev-completion (&optional arg) |
7396503653cf
Complete rewrite by Lars.Lindberg@sypro.cap.se.
Richard M. Stallman <rms@gnu.org>
parents:
5307
diff
changeset
|
367 "Completion on current word. |
7396503653cf
Complete rewrite by Lars.Lindberg@sypro.cap.se.
Richard M. Stallman <rms@gnu.org>
parents:
5307
diff
changeset
|
368 Like \\[dabbrev-expand] but finds all expansions in the current buffer |
7396503653cf
Complete rewrite by Lars.Lindberg@sypro.cap.se.
Richard M. Stallman <rms@gnu.org>
parents:
5307
diff
changeset
|
369 and presents suggestions for completion. |
7396503653cf
Complete rewrite by Lars.Lindberg@sypro.cap.se.
Richard M. Stallman <rms@gnu.org>
parents:
5307
diff
changeset
|
370 |
10231
e88ff4b30786
Don't require cl, picture, or reporter.
Richard M. Stallman <rms@gnu.org>
parents:
10230
diff
changeset
|
371 With a prefix argument, it searches all buffers accepted by the |
e88ff4b30786
Don't require cl, picture, or reporter.
Richard M. Stallman <rms@gnu.org>
parents:
10230
diff
changeset
|
372 function pointed out by `dabbrev-friend-buffer-function' to find the |
10232
ace1fffa8d96
(dabbrev-completion): Now searches all buffers when given prefix arg 16.
Richard M. Stallman <rms@gnu.org>
parents:
10231
diff
changeset
|
373 completions. |
ace1fffa8d96
(dabbrev-completion): Now searches all buffers when given prefix arg 16.
Richard M. Stallman <rms@gnu.org>
parents:
10231
diff
changeset
|
374 |
ace1fffa8d96
(dabbrev-completion): Now searches all buffers when given prefix arg 16.
Richard M. Stallman <rms@gnu.org>
parents:
10231
diff
changeset
|
375 If the prefix argument is 16 (which comes from C-u C-u), |
67169
e196e2160515
(dabbrev-completion): Simplify code, by getting rid of `if' whose
Luc Teirlinck <teirllm@auburn.edu>
parents:
66114
diff
changeset
|
376 then it searches *all* buffers." |
10230
7396503653cf
Complete rewrite by Lars.Lindberg@sypro.cap.se.
Richard M. Stallman <rms@gnu.org>
parents:
5307
diff
changeset
|
377 (interactive "*P") |
11820
362251066737
(dabbrev-completion): Use mapcar, not mapc.
Richard M. Stallman <rms@gnu.org>
parents:
10251
diff
changeset
|
378 (dabbrev--reset-global-variables) |
362251066737
(dabbrev-completion): Use mapcar, not mapc.
Richard M. Stallman <rms@gnu.org>
parents:
10251
diff
changeset
|
379 (let* ((dabbrev-check-other-buffers (and arg t)) |
362251066737
(dabbrev-completion): Use mapcar, not mapc.
Richard M. Stallman <rms@gnu.org>
parents:
10251
diff
changeset
|
380 (dabbrev-check-all-buffers |
10232
ace1fffa8d96
(dabbrev-completion): Now searches all buffers when given prefix arg 16.
Richard M. Stallman <rms@gnu.org>
parents:
10231
diff
changeset
|
381 (and arg (= (prefix-numeric-value arg) 16))) |
10230
7396503653cf
Complete rewrite by Lars.Lindberg@sypro.cap.se.
Richard M. Stallman <rms@gnu.org>
parents:
5307
diff
changeset
|
382 (abbrev (dabbrev--abbrev-at-point)) |
17711
3484851d83b9
(dabbrev-case-replace, dabbrev-case-fold-search):
Richard M. Stallman <rms@gnu.org>
parents:
17411
diff
changeset
|
383 (ignore-case-p (and (if (eq dabbrev-case-fold-search 'case-fold-search) |
3484851d83b9
(dabbrev-case-replace, dabbrev-case-fold-search):
Richard M. Stallman <rms@gnu.org>
parents:
17411
diff
changeset
|
384 case-fold-search |
3484851d83b9
(dabbrev-case-replace, dabbrev-case-fold-search):
Richard M. Stallman <rms@gnu.org>
parents:
17411
diff
changeset
|
385 dabbrev-case-fold-search) |
3484851d83b9
(dabbrev-case-replace, dabbrev-case-fold-search):
Richard M. Stallman <rms@gnu.org>
parents:
17411
diff
changeset
|
386 (or (not dabbrev-upcase-means-case-search) |
3484851d83b9
(dabbrev-case-replace, dabbrev-case-fold-search):
Richard M. Stallman <rms@gnu.org>
parents:
17411
diff
changeset
|
387 (string= abbrev (downcase abbrev))))) |
10230
7396503653cf
Complete rewrite by Lars.Lindberg@sypro.cap.se.
Richard M. Stallman <rms@gnu.org>
parents:
5307
diff
changeset
|
388 (my-obarray dabbrev--last-obarray) |
7396503653cf
Complete rewrite by Lars.Lindberg@sypro.cap.se.
Richard M. Stallman <rms@gnu.org>
parents:
5307
diff
changeset
|
389 init) |
7396503653cf
Complete rewrite by Lars.Lindberg@sypro.cap.se.
Richard M. Stallman <rms@gnu.org>
parents:
5307
diff
changeset
|
390 (save-excursion |
67169
e196e2160515
(dabbrev-completion): Simplify code, by getting rid of `if' whose
Luc Teirlinck <teirllm@auburn.edu>
parents:
66114
diff
changeset
|
391 ;;-------------------------------- |
e196e2160515
(dabbrev-completion): Simplify code, by getting rid of `if' whose
Luc Teirlinck <teirllm@auburn.edu>
parents:
66114
diff
changeset
|
392 ;; New abbreviation to expand. |
e196e2160515
(dabbrev-completion): Simplify code, by getting rid of `if' whose
Luc Teirlinck <teirllm@auburn.edu>
parents:
66114
diff
changeset
|
393 ;;-------------------------------- |
e196e2160515
(dabbrev-completion): Simplify code, by getting rid of `if' whose
Luc Teirlinck <teirllm@auburn.edu>
parents:
66114
diff
changeset
|
394 (setq dabbrev--last-abbreviation abbrev) |
e196e2160515
(dabbrev-completion): Simplify code, by getting rid of `if' whose
Luc Teirlinck <teirllm@auburn.edu>
parents:
66114
diff
changeset
|
395 ;; Find all expansion |
e196e2160515
(dabbrev-completion): Simplify code, by getting rid of `if' whose
Luc Teirlinck <teirllm@auburn.edu>
parents:
66114
diff
changeset
|
396 (let ((completion-list |
e196e2160515
(dabbrev-completion): Simplify code, by getting rid of `if' whose
Luc Teirlinck <teirllm@auburn.edu>
parents:
66114
diff
changeset
|
397 (dabbrev--find-all-expansions abbrev ignore-case-p)) |
e196e2160515
(dabbrev-completion): Simplify code, by getting rid of `if' whose
Luc Teirlinck <teirllm@auburn.edu>
parents:
66114
diff
changeset
|
398 (completion-ignore-case ignore-case-p)) |
e196e2160515
(dabbrev-completion): Simplify code, by getting rid of `if' whose
Luc Teirlinck <teirllm@auburn.edu>
parents:
66114
diff
changeset
|
399 ;; Make an obarray with all expansions |
e196e2160515
(dabbrev-completion): Simplify code, by getting rid of `if' whose
Luc Teirlinck <teirllm@auburn.edu>
parents:
66114
diff
changeset
|
400 (setq my-obarray (make-vector (length completion-list) 0)) |
e196e2160515
(dabbrev-completion): Simplify code, by getting rid of `if' whose
Luc Teirlinck <teirllm@auburn.edu>
parents:
66114
diff
changeset
|
401 (or (> (length my-obarray) 0) |
e196e2160515
(dabbrev-completion): Simplify code, by getting rid of `if' whose
Luc Teirlinck <teirllm@auburn.edu>
parents:
66114
diff
changeset
|
402 (error "No dynamic expansion for \"%s\" found%s" |
e196e2160515
(dabbrev-completion): Simplify code, by getting rid of `if' whose
Luc Teirlinck <teirllm@auburn.edu>
parents:
66114
diff
changeset
|
403 abbrev |
e196e2160515
(dabbrev-completion): Simplify code, by getting rid of `if' whose
Luc Teirlinck <teirllm@auburn.edu>
parents:
66114
diff
changeset
|
404 (if dabbrev--check-other-buffers "" " in this-buffer"))) |
e196e2160515
(dabbrev-completion): Simplify code, by getting rid of `if' whose
Luc Teirlinck <teirllm@auburn.edu>
parents:
66114
diff
changeset
|
405 (cond |
e196e2160515
(dabbrev-completion): Simplify code, by getting rid of `if' whose
Luc Teirlinck <teirllm@auburn.edu>
parents:
66114
diff
changeset
|
406 ((or (not ignore-case-p) |
e196e2160515
(dabbrev-completion): Simplify code, by getting rid of `if' whose
Luc Teirlinck <teirllm@auburn.edu>
parents:
66114
diff
changeset
|
407 (not dabbrev-case-replace)) |
e196e2160515
(dabbrev-completion): Simplify code, by getting rid of `if' whose
Luc Teirlinck <teirllm@auburn.edu>
parents:
66114
diff
changeset
|
408 (mapc (function (lambda (string) |
e196e2160515
(dabbrev-completion): Simplify code, by getting rid of `if' whose
Luc Teirlinck <teirllm@auburn.edu>
parents:
66114
diff
changeset
|
409 (intern string my-obarray))) |
e196e2160515
(dabbrev-completion): Simplify code, by getting rid of `if' whose
Luc Teirlinck <teirllm@auburn.edu>
parents:
66114
diff
changeset
|
410 completion-list)) |
e196e2160515
(dabbrev-completion): Simplify code, by getting rid of `if' whose
Luc Teirlinck <teirllm@auburn.edu>
parents:
66114
diff
changeset
|
411 ((string= abbrev (upcase abbrev)) |
e196e2160515
(dabbrev-completion): Simplify code, by getting rid of `if' whose
Luc Teirlinck <teirllm@auburn.edu>
parents:
66114
diff
changeset
|
412 (mapc (function (lambda (string) |
e196e2160515
(dabbrev-completion): Simplify code, by getting rid of `if' whose
Luc Teirlinck <teirllm@auburn.edu>
parents:
66114
diff
changeset
|
413 (intern (upcase string) my-obarray))) |
e196e2160515
(dabbrev-completion): Simplify code, by getting rid of `if' whose
Luc Teirlinck <teirllm@auburn.edu>
parents:
66114
diff
changeset
|
414 completion-list)) |
e196e2160515
(dabbrev-completion): Simplify code, by getting rid of `if' whose
Luc Teirlinck <teirllm@auburn.edu>
parents:
66114
diff
changeset
|
415 ((string= (substring abbrev 0 1) |
e196e2160515
(dabbrev-completion): Simplify code, by getting rid of `if' whose
Luc Teirlinck <teirllm@auburn.edu>
parents:
66114
diff
changeset
|
416 (upcase (substring abbrev 0 1))) |
e196e2160515
(dabbrev-completion): Simplify code, by getting rid of `if' whose
Luc Teirlinck <teirllm@auburn.edu>
parents:
66114
diff
changeset
|
417 (mapc (function (lambda (string) |
e196e2160515
(dabbrev-completion): Simplify code, by getting rid of `if' whose
Luc Teirlinck <teirllm@auburn.edu>
parents:
66114
diff
changeset
|
418 (intern (capitalize string) my-obarray))) |
e196e2160515
(dabbrev-completion): Simplify code, by getting rid of `if' whose
Luc Teirlinck <teirllm@auburn.edu>
parents:
66114
diff
changeset
|
419 completion-list)) |
e196e2160515
(dabbrev-completion): Simplify code, by getting rid of `if' whose
Luc Teirlinck <teirllm@auburn.edu>
parents:
66114
diff
changeset
|
420 (t |
e196e2160515
(dabbrev-completion): Simplify code, by getting rid of `if' whose
Luc Teirlinck <teirllm@auburn.edu>
parents:
66114
diff
changeset
|
421 (mapc (function (lambda (string) |
e196e2160515
(dabbrev-completion): Simplify code, by getting rid of `if' whose
Luc Teirlinck <teirllm@auburn.edu>
parents:
66114
diff
changeset
|
422 (intern (downcase string) my-obarray))) |
e196e2160515
(dabbrev-completion): Simplify code, by getting rid of `if' whose
Luc Teirlinck <teirllm@auburn.edu>
parents:
66114
diff
changeset
|
423 completion-list))) |
e196e2160515
(dabbrev-completion): Simplify code, by getting rid of `if' whose
Luc Teirlinck <teirllm@auburn.edu>
parents:
66114
diff
changeset
|
424 (setq dabbrev--last-obarray my-obarray) |
e196e2160515
(dabbrev-completion): Simplify code, by getting rid of `if' whose
Luc Teirlinck <teirllm@auburn.edu>
parents:
66114
diff
changeset
|
425 (setq dabbrev--last-completion-buffer (current-buffer)) |
e196e2160515
(dabbrev-completion): Simplify code, by getting rid of `if' whose
Luc Teirlinck <teirllm@auburn.edu>
parents:
66114
diff
changeset
|
426 ;; Find the longest common string. |
e196e2160515
(dabbrev-completion): Simplify code, by getting rid of `if' whose
Luc Teirlinck <teirllm@auburn.edu>
parents:
66114
diff
changeset
|
427 (setq init (try-completion abbrev my-obarray)))) |
10230
7396503653cf
Complete rewrite by Lars.Lindberg@sypro.cap.se.
Richard M. Stallman <rms@gnu.org>
parents:
5307
diff
changeset
|
428 ;;-------------------------------- |
7396503653cf
Complete rewrite by Lars.Lindberg@sypro.cap.se.
Richard M. Stallman <rms@gnu.org>
parents:
5307
diff
changeset
|
429 ;; Let the user choose between the expansions |
7396503653cf
Complete rewrite by Lars.Lindberg@sypro.cap.se.
Richard M. Stallman <rms@gnu.org>
parents:
5307
diff
changeset
|
430 ;;-------------------------------- |
7396503653cf
Complete rewrite by Lars.Lindberg@sypro.cap.se.
Richard M. Stallman <rms@gnu.org>
parents:
5307
diff
changeset
|
431 (or (stringp init) |
7396503653cf
Complete rewrite by Lars.Lindberg@sypro.cap.se.
Richard M. Stallman <rms@gnu.org>
parents:
5307
diff
changeset
|
432 (setq init abbrev)) |
7396503653cf
Complete rewrite by Lars.Lindberg@sypro.cap.se.
Richard M. Stallman <rms@gnu.org>
parents:
5307
diff
changeset
|
433 (cond |
7396503653cf
Complete rewrite by Lars.Lindberg@sypro.cap.se.
Richard M. Stallman <rms@gnu.org>
parents:
5307
diff
changeset
|
434 ;; * Replace string fragment with matched common substring completion. |
7396503653cf
Complete rewrite by Lars.Lindberg@sypro.cap.se.
Richard M. Stallman <rms@gnu.org>
parents:
5307
diff
changeset
|
435 ((and (not (string-equal init "")) |
7396503653cf
Complete rewrite by Lars.Lindberg@sypro.cap.se.
Richard M. Stallman <rms@gnu.org>
parents:
5307
diff
changeset
|
436 (not (string-equal (downcase init) (downcase abbrev)))) |
7396503653cf
Complete rewrite by Lars.Lindberg@sypro.cap.se.
Richard M. Stallman <rms@gnu.org>
parents:
5307
diff
changeset
|
437 (if (> (length (all-completions init my-obarray)) 1) |
10231
e88ff4b30786
Don't require cl, picture, or reporter.
Richard M. Stallman <rms@gnu.org>
parents:
10230
diff
changeset
|
438 (message "Repeat `%s' to see all completions" |
e88ff4b30786
Don't require cl, picture, or reporter.
Richard M. Stallman <rms@gnu.org>
parents:
10230
diff
changeset
|
439 (key-description (this-command-keys))) |
10230
7396503653cf
Complete rewrite by Lars.Lindberg@sypro.cap.se.
Richard M. Stallman <rms@gnu.org>
parents:
5307
diff
changeset
|
440 (message "The only possible completion")) |
34596
51c08e149a23
(dabbrev--last-case-pattern): Value is now
Gerd Moellmann <gerd@gnu.org>
parents:
30002
diff
changeset
|
441 (dabbrev--substitute-expansion nil abbrev init nil)) |
10230
7396503653cf
Complete rewrite by Lars.Lindberg@sypro.cap.se.
Richard M. Stallman <rms@gnu.org>
parents:
5307
diff
changeset
|
442 (t |
7396503653cf
Complete rewrite by Lars.Lindberg@sypro.cap.se.
Richard M. Stallman <rms@gnu.org>
parents:
5307
diff
changeset
|
443 ;; * String is a common substring completion already. Make list. |
7396503653cf
Complete rewrite by Lars.Lindberg@sypro.cap.se.
Richard M. Stallman <rms@gnu.org>
parents:
5307
diff
changeset
|
444 (message "Making completion list...") |
40820
598a96e93a20
(dabbrev-completion): Use "*Completions*".
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
38142
diff
changeset
|
445 (with-output-to-temp-buffer "*Completions*" |
66114
13abee3a9bc6
* message.el (message-expand-group): Pass the common
Masatake YAMATO <jet@gyve.org>
parents:
64762
diff
changeset
|
446 (display-completion-list (all-completions init my-obarray) |
13abee3a9bc6
* message.el (message-expand-group): Pass the common
Masatake YAMATO <jet@gyve.org>
parents:
64762
diff
changeset
|
447 init)) |
10231
e88ff4b30786
Don't require cl, picture, or reporter.
Richard M. Stallman <rms@gnu.org>
parents:
10230
diff
changeset
|
448 (message "Making completion list...done"))) |
10230
7396503653cf
Complete rewrite by Lars.Lindberg@sypro.cap.se.
Richard M. Stallman <rms@gnu.org>
parents:
5307
diff
changeset
|
449 (and (window-minibuffer-p (selected-window)) |
7396503653cf
Complete rewrite by Lars.Lindberg@sypro.cap.se.
Richard M. Stallman <rms@gnu.org>
parents:
5307
diff
changeset
|
450 (message nil)))) |
267 | 451 |
452 ;;;###autoload | |
453 (defun dabbrev-expand (arg) | |
454 "Expand previous word \"dynamically\". | |
455 | |
10230
7396503653cf
Complete rewrite by Lars.Lindberg@sypro.cap.se.
Richard M. Stallman <rms@gnu.org>
parents:
5307
diff
changeset
|
456 Expands to the most recent, preceding word for which this is a prefix. |
7396503653cf
Complete rewrite by Lars.Lindberg@sypro.cap.se.
Richard M. Stallman <rms@gnu.org>
parents:
5307
diff
changeset
|
457 If no suitable preceding word is found, words following point are |
7396503653cf
Complete rewrite by Lars.Lindberg@sypro.cap.se.
Richard M. Stallman <rms@gnu.org>
parents:
5307
diff
changeset
|
458 considered. If still no suitable word is found, then look in the |
7396503653cf
Complete rewrite by Lars.Lindberg@sypro.cap.se.
Richard M. Stallman <rms@gnu.org>
parents:
5307
diff
changeset
|
459 buffers accepted by the function pointed out by variable |
7396503653cf
Complete rewrite by Lars.Lindberg@sypro.cap.se.
Richard M. Stallman <rms@gnu.org>
parents:
5307
diff
changeset
|
460 `dabbrev-friend-buffer-function'. |
267 | 461 |
10231
e88ff4b30786
Don't require cl, picture, or reporter.
Richard M. Stallman <rms@gnu.org>
parents:
10230
diff
changeset
|
462 A positive prefix argument, N, says to take the Nth backward *distinct* |
10230
7396503653cf
Complete rewrite by Lars.Lindberg@sypro.cap.se.
Richard M. Stallman <rms@gnu.org>
parents:
5307
diff
changeset
|
463 possibility. A negative argument says search forward. |
267 | 464 |
465 If the cursor has not moved from the end of the previous expansion and | |
466 no argument is given, replace the previously-made expansion | |
10230
7396503653cf
Complete rewrite by Lars.Lindberg@sypro.cap.se.
Richard M. Stallman <rms@gnu.org>
parents:
5307
diff
changeset
|
467 with the next possible expansion not yet tried. |
7396503653cf
Complete rewrite by Lars.Lindberg@sypro.cap.se.
Richard M. Stallman <rms@gnu.org>
parents:
5307
diff
changeset
|
468 |
7396503653cf
Complete rewrite by Lars.Lindberg@sypro.cap.se.
Richard M. Stallman <rms@gnu.org>
parents:
5307
diff
changeset
|
469 The variable `dabbrev-backward-only' may be used to limit the |
7396503653cf
Complete rewrite by Lars.Lindberg@sypro.cap.se.
Richard M. Stallman <rms@gnu.org>
parents:
5307
diff
changeset
|
470 direction of search to backward if set non-nil. |
7396503653cf
Complete rewrite by Lars.Lindberg@sypro.cap.se.
Richard M. Stallman <rms@gnu.org>
parents:
5307
diff
changeset
|
471 |
10231
e88ff4b30786
Don't require cl, picture, or reporter.
Richard M. Stallman <rms@gnu.org>
parents:
10230
diff
changeset
|
472 See also `dabbrev-abbrev-char-regexp' and \\[dabbrev-completion]." |
267 | 473 (interactive "*P") |
15834
71ede15e1ca3
(dabbrev--last-case-pattern): New variable.
Richard M. Stallman <rms@gnu.org>
parents:
15812
diff
changeset
|
474 (let (abbrev record-case-pattern |
71ede15e1ca3
(dabbrev--last-case-pattern): New variable.
Richard M. Stallman <rms@gnu.org>
parents:
15812
diff
changeset
|
475 expansion old direction (orig-point (point))) |
267 | 476 ;; abbrev -- the abbrev to expand |
477 ;; expansion -- the expansion found (eventually) or nil until then | |
478 ;; old -- the text currently in the buffer | |
479 ;; (the abbrev, or the previously-made expansion) | |
480 (save-excursion | |
481 (if (and (null arg) | |
11820
362251066737
(dabbrev-completion): Use mapcar, not mapc.
Richard M. Stallman <rms@gnu.org>
parents:
10251
diff
changeset
|
482 (markerp dabbrev--last-abbrev-location) |
362251066737
(dabbrev-completion): Use mapcar, not mapc.
Richard M. Stallman <rms@gnu.org>
parents:
10251
diff
changeset
|
483 (marker-position dabbrev--last-abbrev-location) |
10230
7396503653cf
Complete rewrite by Lars.Lindberg@sypro.cap.se.
Richard M. Stallman <rms@gnu.org>
parents:
5307
diff
changeset
|
484 (or (eq last-command this-command) |
7396503653cf
Complete rewrite by Lars.Lindberg@sypro.cap.se.
Richard M. Stallman <rms@gnu.org>
parents:
5307
diff
changeset
|
485 (and (window-minibuffer-p (selected-window)) |
7396503653cf
Complete rewrite by Lars.Lindberg@sypro.cap.se.
Richard M. Stallman <rms@gnu.org>
parents:
5307
diff
changeset
|
486 (= dabbrev--last-abbrev-location |
7396503653cf
Complete rewrite by Lars.Lindberg@sypro.cap.se.
Richard M. Stallman <rms@gnu.org>
parents:
5307
diff
changeset
|
487 (point))))) |
10231
e88ff4b30786
Don't require cl, picture, or reporter.
Richard M. Stallman <rms@gnu.org>
parents:
10230
diff
changeset
|
488 ;; Find a different expansion for the same abbrev as last time. |
267 | 489 (progn |
10230
7396503653cf
Complete rewrite by Lars.Lindberg@sypro.cap.se.
Richard M. Stallman <rms@gnu.org>
parents:
5307
diff
changeset
|
490 (setq abbrev dabbrev--last-abbreviation) |
7396503653cf
Complete rewrite by Lars.Lindberg@sypro.cap.se.
Richard M. Stallman <rms@gnu.org>
parents:
5307
diff
changeset
|
491 (setq old dabbrev--last-expansion) |
7396503653cf
Complete rewrite by Lars.Lindberg@sypro.cap.se.
Richard M. Stallman <rms@gnu.org>
parents:
5307
diff
changeset
|
492 (setq direction dabbrev--last-direction)) |
11976
e862c6697f39
(dabbrev--abbrev-at-point): If point is after
Karl Heuer <kwzh@gnu.org>
parents:
11820
diff
changeset
|
493 ;; If the user inserts a space after expanding |
e862c6697f39
(dabbrev--abbrev-at-point): If point is after
Karl Heuer <kwzh@gnu.org>
parents:
11820
diff
changeset
|
494 ;; and then asks to expand again, always fetch the next word. |
64002
47749dcdbecf
(dabbrev): Finish `defgroup' description with period.
Juanma Barranquero <lekktu@gmail.com>
parents:
62531
diff
changeset
|
495 (if (and (eq (preceding-char) ?\s) |
11976
e862c6697f39
(dabbrev--abbrev-at-point): If point is after
Karl Heuer <kwzh@gnu.org>
parents:
11820
diff
changeset
|
496 (markerp dabbrev--last-abbrev-location) |
e862c6697f39
(dabbrev--abbrev-at-point): If point is after
Karl Heuer <kwzh@gnu.org>
parents:
11820
diff
changeset
|
497 (marker-position dabbrev--last-abbrev-location) |
e862c6697f39
(dabbrev--abbrev-at-point): If point is after
Karl Heuer <kwzh@gnu.org>
parents:
11820
diff
changeset
|
498 (= (point) (1+ dabbrev--last-abbrev-location))) |
15834
71ede15e1ca3
(dabbrev--last-case-pattern): New variable.
Richard M. Stallman <rms@gnu.org>
parents:
15812
diff
changeset
|
499 (progn |
11976
e862c6697f39
(dabbrev--abbrev-at-point): If point is after
Karl Heuer <kwzh@gnu.org>
parents:
11820
diff
changeset
|
500 ;; The "abbrev" to expand is just the space. |
e862c6697f39
(dabbrev--abbrev-at-point): If point is after
Karl Heuer <kwzh@gnu.org>
parents:
11820
diff
changeset
|
501 (setq abbrev " ") |
e862c6697f39
(dabbrev--abbrev-at-point): If point is after
Karl Heuer <kwzh@gnu.org>
parents:
11820
diff
changeset
|
502 (save-excursion |
58274
98c7fc5c718b
(dabbrev-expand): When handling SPC M-/,
Richard M. Stallman <rms@gnu.org>
parents:
55051
diff
changeset
|
503 (save-restriction |
98c7fc5c718b
(dabbrev-expand): When handling SPC M-/,
Richard M. Stallman <rms@gnu.org>
parents:
55051
diff
changeset
|
504 (widen) |
98c7fc5c718b
(dabbrev-expand): When handling SPC M-/,
Richard M. Stallman <rms@gnu.org>
parents:
55051
diff
changeset
|
505 (if dabbrev--last-buffer |
98c7fc5c718b
(dabbrev-expand): When handling SPC M-/,
Richard M. Stallman <rms@gnu.org>
parents:
55051
diff
changeset
|
506 (set-buffer dabbrev--last-buffer)) |
98c7fc5c718b
(dabbrev-expand): When handling SPC M-/,
Richard M. Stallman <rms@gnu.org>
parents:
55051
diff
changeset
|
507 ;; Find the end of the last "expansion" word. |
98c7fc5c718b
(dabbrev-expand): When handling SPC M-/,
Richard M. Stallman <rms@gnu.org>
parents:
55051
diff
changeset
|
508 (if (or (eq dabbrev--last-direction 1) |
98c7fc5c718b
(dabbrev-expand): When handling SPC M-/,
Richard M. Stallman <rms@gnu.org>
parents:
55051
diff
changeset
|
509 (and (eq dabbrev--last-direction 0) |
98c7fc5c718b
(dabbrev-expand): When handling SPC M-/,
Richard M. Stallman <rms@gnu.org>
parents:
55051
diff
changeset
|
510 (< dabbrev--last-expansion-location (point)))) |
98c7fc5c718b
(dabbrev-expand): When handling SPC M-/,
Richard M. Stallman <rms@gnu.org>
parents:
55051
diff
changeset
|
511 (setq dabbrev--last-expansion-location |
98c7fc5c718b
(dabbrev-expand): When handling SPC M-/,
Richard M. Stallman <rms@gnu.org>
parents:
55051
diff
changeset
|
512 (+ dabbrev--last-expansion-location |
98c7fc5c718b
(dabbrev-expand): When handling SPC M-/,
Richard M. Stallman <rms@gnu.org>
parents:
55051
diff
changeset
|
513 (length dabbrev--last-expansion)))) |
98c7fc5c718b
(dabbrev-expand): When handling SPC M-/,
Richard M. Stallman <rms@gnu.org>
parents:
55051
diff
changeset
|
514 (goto-char dabbrev--last-expansion-location) |
98c7fc5c718b
(dabbrev-expand): When handling SPC M-/,
Richard M. Stallman <rms@gnu.org>
parents:
55051
diff
changeset
|
515 ;; Take the following word, with intermediate separators, |
98c7fc5c718b
(dabbrev-expand): When handling SPC M-/,
Richard M. Stallman <rms@gnu.org>
parents:
55051
diff
changeset
|
516 ;; as our expansion this time. |
98c7fc5c718b
(dabbrev-expand): When handling SPC M-/,
Richard M. Stallman <rms@gnu.org>
parents:
55051
diff
changeset
|
517 (re-search-forward |
98c7fc5c718b
(dabbrev-expand): When handling SPC M-/,
Richard M. Stallman <rms@gnu.org>
parents:
55051
diff
changeset
|
518 (concat "\\(?:" dabbrev--abbrev-char-regexp "\\)+")) |
98c7fc5c718b
(dabbrev-expand): When handling SPC M-/,
Richard M. Stallman <rms@gnu.org>
parents:
55051
diff
changeset
|
519 (setq expansion (buffer-substring-no-properties |
98c7fc5c718b
(dabbrev-expand): When handling SPC M-/,
Richard M. Stallman <rms@gnu.org>
parents:
55051
diff
changeset
|
520 dabbrev--last-expansion-location (point))) |
11976
e862c6697f39
(dabbrev--abbrev-at-point): If point is after
Karl Heuer <kwzh@gnu.org>
parents:
11820
diff
changeset
|
521 |
58274
98c7fc5c718b
(dabbrev-expand): When handling SPC M-/,
Richard M. Stallman <rms@gnu.org>
parents:
55051
diff
changeset
|
522 ;; Record the end of this expansion, in case we repeat this. |
98c7fc5c718b
(dabbrev-expand): When handling SPC M-/,
Richard M. Stallman <rms@gnu.org>
parents:
55051
diff
changeset
|
523 (setq dabbrev--last-expansion-location (point)))) |
11976
e862c6697f39
(dabbrev--abbrev-at-point): If point is after
Karl Heuer <kwzh@gnu.org>
parents:
11820
diff
changeset
|
524 ;; Indicate that dabbrev--last-expansion-location is |
e862c6697f39
(dabbrev--abbrev-at-point): If point is after
Karl Heuer <kwzh@gnu.org>
parents:
11820
diff
changeset
|
525 ;; at the end of the expansion. |
e862c6697f39
(dabbrev--abbrev-at-point): If point is after
Karl Heuer <kwzh@gnu.org>
parents:
11820
diff
changeset
|
526 (setq dabbrev--last-direction -1)) |
e862c6697f39
(dabbrev--abbrev-at-point): If point is after
Karl Heuer <kwzh@gnu.org>
parents:
11820
diff
changeset
|
527 |
e862c6697f39
(dabbrev--abbrev-at-point): If point is after
Karl Heuer <kwzh@gnu.org>
parents:
11820
diff
changeset
|
528 ;; We have a different abbrev to expand. |
e862c6697f39
(dabbrev--abbrev-at-point): If point is after
Karl Heuer <kwzh@gnu.org>
parents:
11820
diff
changeset
|
529 (dabbrev--reset-global-variables) |
e862c6697f39
(dabbrev--abbrev-at-point): If point is after
Karl Heuer <kwzh@gnu.org>
parents:
11820
diff
changeset
|
530 (setq direction (if (null arg) |
e862c6697f39
(dabbrev--abbrev-at-point): If point is after
Karl Heuer <kwzh@gnu.org>
parents:
11820
diff
changeset
|
531 (if dabbrev-backward-only 1 0) |
e862c6697f39
(dabbrev--abbrev-at-point): If point is after
Karl Heuer <kwzh@gnu.org>
parents:
11820
diff
changeset
|
532 (prefix-numeric-value arg))) |
e862c6697f39
(dabbrev--abbrev-at-point): If point is after
Karl Heuer <kwzh@gnu.org>
parents:
11820
diff
changeset
|
533 (setq abbrev (dabbrev--abbrev-at-point)) |
15834
71ede15e1ca3
(dabbrev--last-case-pattern): New variable.
Richard M. Stallman <rms@gnu.org>
parents:
15812
diff
changeset
|
534 (setq record-case-pattern t) |
11976
e862c6697f39
(dabbrev--abbrev-at-point): If point is after
Karl Heuer <kwzh@gnu.org>
parents:
11820
diff
changeset
|
535 (setq old nil))) |
10230
7396503653cf
Complete rewrite by Lars.Lindberg@sypro.cap.se.
Richard M. Stallman <rms@gnu.org>
parents:
5307
diff
changeset
|
536 |
7396503653cf
Complete rewrite by Lars.Lindberg@sypro.cap.se.
Richard M. Stallman <rms@gnu.org>
parents:
5307
diff
changeset
|
537 ;;-------------------------------- |
7396503653cf
Complete rewrite by Lars.Lindberg@sypro.cap.se.
Richard M. Stallman <rms@gnu.org>
parents:
5307
diff
changeset
|
538 ;; Find the expansion |
7396503653cf
Complete rewrite by Lars.Lindberg@sypro.cap.se.
Richard M. Stallman <rms@gnu.org>
parents:
5307
diff
changeset
|
539 ;;-------------------------------- |
11976
e862c6697f39
(dabbrev--abbrev-at-point): If point is after
Karl Heuer <kwzh@gnu.org>
parents:
11820
diff
changeset
|
540 (or expansion |
e862c6697f39
(dabbrev--abbrev-at-point): If point is after
Karl Heuer <kwzh@gnu.org>
parents:
11820
diff
changeset
|
541 (setq expansion |
e862c6697f39
(dabbrev--abbrev-at-point): If point is after
Karl Heuer <kwzh@gnu.org>
parents:
11820
diff
changeset
|
542 (dabbrev--find-expansion abbrev direction |
17711
3484851d83b9
(dabbrev-case-replace, dabbrev-case-fold-search):
Richard M. Stallman <rms@gnu.org>
parents:
17411
diff
changeset
|
543 (and (if (eq dabbrev-case-fold-search 'case-fold-search) |
3484851d83b9
(dabbrev-case-replace, dabbrev-case-fold-search):
Richard M. Stallman <rms@gnu.org>
parents:
17411
diff
changeset
|
544 case-fold-search |
3484851d83b9
(dabbrev-case-replace, dabbrev-case-fold-search):
Richard M. Stallman <rms@gnu.org>
parents:
17411
diff
changeset
|
545 dabbrev-case-fold-search) |
11976
e862c6697f39
(dabbrev--abbrev-at-point): If point is after
Karl Heuer <kwzh@gnu.org>
parents:
11820
diff
changeset
|
546 (or (not dabbrev-upcase-means-case-search) |
e862c6697f39
(dabbrev--abbrev-at-point): If point is after
Karl Heuer <kwzh@gnu.org>
parents:
11820
diff
changeset
|
547 (string= abbrev (downcase abbrev)))))))) |
10230
7396503653cf
Complete rewrite by Lars.Lindberg@sypro.cap.se.
Richard M. Stallman <rms@gnu.org>
parents:
5307
diff
changeset
|
548 (cond |
7396503653cf
Complete rewrite by Lars.Lindberg@sypro.cap.se.
Richard M. Stallman <rms@gnu.org>
parents:
5307
diff
changeset
|
549 ((not expansion) |
7396503653cf
Complete rewrite by Lars.Lindberg@sypro.cap.se.
Richard M. Stallman <rms@gnu.org>
parents:
5307
diff
changeset
|
550 (dabbrev--reset-global-variables) |
7396503653cf
Complete rewrite by Lars.Lindberg@sypro.cap.se.
Richard M. Stallman <rms@gnu.org>
parents:
5307
diff
changeset
|
551 (if old |
7396503653cf
Complete rewrite by Lars.Lindberg@sypro.cap.se.
Richard M. Stallman <rms@gnu.org>
parents:
5307
diff
changeset
|
552 (save-excursion |
12724
c3cb2b06e05f
(dabbrev-expand): Save previous point for undo.
Richard M. Stallman <rms@gnu.org>
parents:
12555
diff
changeset
|
553 (setq buffer-undo-list (cons orig-point buffer-undo-list)) |
13256
d9c469af1ee0
(dabbrev-expand): When no more expansions,
Richard M. Stallman <rms@gnu.org>
parents:
12724
diff
changeset
|
554 ;; Put back the original abbrev with its original case pattern. |
d9c469af1ee0
(dabbrev-expand): When no more expansions,
Richard M. Stallman <rms@gnu.org>
parents:
12724
diff
changeset
|
555 (search-backward old) |
d9c469af1ee0
(dabbrev-expand): When no more expansions,
Richard M. Stallman <rms@gnu.org>
parents:
12724
diff
changeset
|
556 (insert abbrev) |
d9c469af1ee0
(dabbrev-expand): When no more expansions,
Richard M. Stallman <rms@gnu.org>
parents:
12724
diff
changeset
|
557 (delete-region (point) (+ (point) (length old))))) |
10231
e88ff4b30786
Don't require cl, picture, or reporter.
Richard M. Stallman <rms@gnu.org>
parents:
10230
diff
changeset
|
558 (error "No%s dynamic expansion for `%s' found" |
10230
7396503653cf
Complete rewrite by Lars.Lindberg@sypro.cap.se.
Richard M. Stallman <rms@gnu.org>
parents:
5307
diff
changeset
|
559 (if old " further" "") abbrev)) |
7396503653cf
Complete rewrite by Lars.Lindberg@sypro.cap.se.
Richard M. Stallman <rms@gnu.org>
parents:
5307
diff
changeset
|
560 (t |
29294
5784ff2ff5df
(dabbrev-expand): Don't display messages in the
Gerd Moellmann <gerd@gnu.org>
parents:
29077
diff
changeset
|
561 (if (not (or (eq dabbrev--last-buffer dabbrev--last-buffer-found) |
5784ff2ff5df
(dabbrev-expand): Don't display messages in the
Gerd Moellmann <gerd@gnu.org>
parents:
29077
diff
changeset
|
562 (minibuffer-window-active-p (selected-window)))) |
10230
7396503653cf
Complete rewrite by Lars.Lindberg@sypro.cap.se.
Richard M. Stallman <rms@gnu.org>
parents:
5307
diff
changeset
|
563 (progn |
7396503653cf
Complete rewrite by Lars.Lindberg@sypro.cap.se.
Richard M. Stallman <rms@gnu.org>
parents:
5307
diff
changeset
|
564 (message "Expansion found in '%s'" |
7396503653cf
Complete rewrite by Lars.Lindberg@sypro.cap.se.
Richard M. Stallman <rms@gnu.org>
parents:
5307
diff
changeset
|
565 (buffer-name dabbrev--last-buffer)) |
7396503653cf
Complete rewrite by Lars.Lindberg@sypro.cap.se.
Richard M. Stallman <rms@gnu.org>
parents:
5307
diff
changeset
|
566 (setq dabbrev--last-buffer-found dabbrev--last-buffer)) |
7396503653cf
Complete rewrite by Lars.Lindberg@sypro.cap.se.
Richard M. Stallman <rms@gnu.org>
parents:
5307
diff
changeset
|
567 (message nil)) |
11976
e862c6697f39
(dabbrev--abbrev-at-point): If point is after
Karl Heuer <kwzh@gnu.org>
parents:
11820
diff
changeset
|
568 (if (and (or (eq (current-buffer) dabbrev--last-buffer) |
e862c6697f39
(dabbrev--abbrev-at-point): If point is after
Karl Heuer <kwzh@gnu.org>
parents:
11820
diff
changeset
|
569 (null dabbrev--last-buffer)) |
e862c6697f39
(dabbrev--abbrev-at-point): If point is after
Karl Heuer <kwzh@gnu.org>
parents:
11820
diff
changeset
|
570 (numberp dabbrev--last-expansion-location) |
e862c6697f39
(dabbrev--abbrev-at-point): If point is after
Karl Heuer <kwzh@gnu.org>
parents:
11820
diff
changeset
|
571 (and (> dabbrev--last-expansion-location (point)))) |
e862c6697f39
(dabbrev--abbrev-at-point): If point is after
Karl Heuer <kwzh@gnu.org>
parents:
11820
diff
changeset
|
572 (setq dabbrev--last-expansion-location |
e862c6697f39
(dabbrev--abbrev-at-point): If point is after
Karl Heuer <kwzh@gnu.org>
parents:
11820
diff
changeset
|
573 (copy-marker dabbrev--last-expansion-location))) |
10230
7396503653cf
Complete rewrite by Lars.Lindberg@sypro.cap.se.
Richard M. Stallman <rms@gnu.org>
parents:
5307
diff
changeset
|
574 ;; Success: stick it in and return. |
12724
c3cb2b06e05f
(dabbrev-expand): Save previous point for undo.
Richard M. Stallman <rms@gnu.org>
parents:
12555
diff
changeset
|
575 (setq buffer-undo-list (cons orig-point buffer-undo-list)) |
34596
51c08e149a23
(dabbrev--last-case-pattern): Value is now
Gerd Moellmann <gerd@gnu.org>
parents:
30002
diff
changeset
|
576 (dabbrev--substitute-expansion old abbrev expansion |
51c08e149a23
(dabbrev--last-case-pattern): Value is now
Gerd Moellmann <gerd@gnu.org>
parents:
30002
diff
changeset
|
577 record-case-pattern) |
15834
71ede15e1ca3
(dabbrev--last-case-pattern): New variable.
Richard M. Stallman <rms@gnu.org>
parents:
15812
diff
changeset
|
578 |
10230
7396503653cf
Complete rewrite by Lars.Lindberg@sypro.cap.se.
Richard M. Stallman <rms@gnu.org>
parents:
5307
diff
changeset
|
579 ;; Save state for re-expand. |
26459
1ef9d70dfb0f
* dabbrev.el (dabbrev-filter-elements): Use the new backquote syntax.
Sam Steingold <sds@gnu.org>
parents:
23306
diff
changeset
|
580 (setq dabbrev--last-expansion expansion) |
10230
7396503653cf
Complete rewrite by Lars.Lindberg@sypro.cap.se.
Richard M. Stallman <rms@gnu.org>
parents:
5307
diff
changeset
|
581 (setq dabbrev--last-abbreviation abbrev) |
7396503653cf
Complete rewrite by Lars.Lindberg@sypro.cap.se.
Richard M. Stallman <rms@gnu.org>
parents:
5307
diff
changeset
|
582 (setq dabbrev--last-abbrev-location (point-marker)))))) |
7396503653cf
Complete rewrite by Lars.Lindberg@sypro.cap.se.
Richard M. Stallman <rms@gnu.org>
parents:
5307
diff
changeset
|
583 |
14169 | 584 ;;---------------------------------------------------------------- |
585 ;; Local functions | |
586 ;;---------------------------------------------------------------- | |
10230
7396503653cf
Complete rewrite by Lars.Lindberg@sypro.cap.se.
Richard M. Stallman <rms@gnu.org>
parents:
5307
diff
changeset
|
587 |
7396503653cf
Complete rewrite by Lars.Lindberg@sypro.cap.se.
Richard M. Stallman <rms@gnu.org>
parents:
5307
diff
changeset
|
588 ;;; Checks if OTHER-BUFFER has the same major mode as current buffer. |
7396503653cf
Complete rewrite by Lars.Lindberg@sypro.cap.se.
Richard M. Stallman <rms@gnu.org>
parents:
5307
diff
changeset
|
589 (defun dabbrev--same-major-mode-p (other-buffer) |
10231
e88ff4b30786
Don't require cl, picture, or reporter.
Richard M. Stallman <rms@gnu.org>
parents:
10230
diff
changeset
|
590 (eq major-mode |
e88ff4b30786
Don't require cl, picture, or reporter.
Richard M. Stallman <rms@gnu.org>
parents:
10230
diff
changeset
|
591 (save-excursion |
e88ff4b30786
Don't require cl, picture, or reporter.
Richard M. Stallman <rms@gnu.org>
parents:
10230
diff
changeset
|
592 (set-buffer other-buffer) |
e88ff4b30786
Don't require cl, picture, or reporter.
Richard M. Stallman <rms@gnu.org>
parents:
10230
diff
changeset
|
593 major-mode))) |
267 | 594 |
10230
7396503653cf
Complete rewrite by Lars.Lindberg@sypro.cap.se.
Richard M. Stallman <rms@gnu.org>
parents:
5307
diff
changeset
|
595 ;;; Back over all abbrev type characters and then moves forward over |
7396503653cf
Complete rewrite by Lars.Lindberg@sypro.cap.se.
Richard M. Stallman <rms@gnu.org>
parents:
5307
diff
changeset
|
596 ;;; all skip characters. |
7396503653cf
Complete rewrite by Lars.Lindberg@sypro.cap.se.
Richard M. Stallman <rms@gnu.org>
parents:
5307
diff
changeset
|
597 (defun dabbrev--goto-start-of-abbrev () |
7396503653cf
Complete rewrite by Lars.Lindberg@sypro.cap.se.
Richard M. Stallman <rms@gnu.org>
parents:
5307
diff
changeset
|
598 ;; Move backwards over abbrev chars |
7396503653cf
Complete rewrite by Lars.Lindberg@sypro.cap.se.
Richard M. Stallman <rms@gnu.org>
parents:
5307
diff
changeset
|
599 (save-match-data |
51422
509508a92422
(dabbrev--goto-start-of-abbrev): Use minibuffer-prompt-end.
Richard M. Stallman <rms@gnu.org>
parents:
49588
diff
changeset
|
600 (when (> (point) (minibuffer-prompt-end)) |
509508a92422
(dabbrev--goto-start-of-abbrev): Use minibuffer-prompt-end.
Richard M. Stallman <rms@gnu.org>
parents:
49588
diff
changeset
|
601 (forward-char -1) |
509508a92422
(dabbrev--goto-start-of-abbrev): Use minibuffer-prompt-end.
Richard M. Stallman <rms@gnu.org>
parents:
49588
diff
changeset
|
602 (while (and (looking-at dabbrev--abbrev-char-regexp) |
509508a92422
(dabbrev--goto-start-of-abbrev): Use minibuffer-prompt-end.
Richard M. Stallman <rms@gnu.org>
parents:
49588
diff
changeset
|
603 (> (point) (minibuffer-prompt-end)) |
509508a92422
(dabbrev--goto-start-of-abbrev): Use minibuffer-prompt-end.
Richard M. Stallman <rms@gnu.org>
parents:
49588
diff
changeset
|
604 (not (= (point) (field-beginning (point) nil |
509508a92422
(dabbrev--goto-start-of-abbrev): Use minibuffer-prompt-end.
Richard M. Stallman <rms@gnu.org>
parents:
49588
diff
changeset
|
605 (1- (point)))))) |
509508a92422
(dabbrev--goto-start-of-abbrev): Use minibuffer-prompt-end.
Richard M. Stallman <rms@gnu.org>
parents:
49588
diff
changeset
|
606 (forward-char -1)) |
509508a92422
(dabbrev--goto-start-of-abbrev): Use minibuffer-prompt-end.
Richard M. Stallman <rms@gnu.org>
parents:
49588
diff
changeset
|
607 (or (looking-at dabbrev--abbrev-char-regexp) |
509508a92422
(dabbrev--goto-start-of-abbrev): Use minibuffer-prompt-end.
Richard M. Stallman <rms@gnu.org>
parents:
49588
diff
changeset
|
608 (forward-char 1))) |
10230
7396503653cf
Complete rewrite by Lars.Lindberg@sypro.cap.se.
Richard M. Stallman <rms@gnu.org>
parents:
5307
diff
changeset
|
609 (and dabbrev-abbrev-skip-leading-regexp |
7396503653cf
Complete rewrite by Lars.Lindberg@sypro.cap.se.
Richard M. Stallman <rms@gnu.org>
parents:
5307
diff
changeset
|
610 (while (looking-at dabbrev-abbrev-skip-leading-regexp) |
7396503653cf
Complete rewrite by Lars.Lindberg@sypro.cap.se.
Richard M. Stallman <rms@gnu.org>
parents:
5307
diff
changeset
|
611 (forward-char 1))))) |
7396503653cf
Complete rewrite by Lars.Lindberg@sypro.cap.se.
Richard M. Stallman <rms@gnu.org>
parents:
5307
diff
changeset
|
612 |
10231
e88ff4b30786
Don't require cl, picture, or reporter.
Richard M. Stallman <rms@gnu.org>
parents:
10230
diff
changeset
|
613 ;;; Extract the symbol at point to serve as abbreviation. |
10230
7396503653cf
Complete rewrite by Lars.Lindberg@sypro.cap.se.
Richard M. Stallman <rms@gnu.org>
parents:
5307
diff
changeset
|
614 (defun dabbrev--abbrev-at-point () |
7396503653cf
Complete rewrite by Lars.Lindberg@sypro.cap.se.
Richard M. Stallman <rms@gnu.org>
parents:
5307
diff
changeset
|
615 ;; Check for error |
11976
e862c6697f39
(dabbrev--abbrev-at-point): If point is after
Karl Heuer <kwzh@gnu.org>
parents:
11820
diff
changeset
|
616 (if (bobp) |
e862c6697f39
(dabbrev--abbrev-at-point): If point is after
Karl Heuer <kwzh@gnu.org>
parents:
11820
diff
changeset
|
617 (error "No possible abbreviation preceding point")) |
10230
7396503653cf
Complete rewrite by Lars.Lindberg@sypro.cap.se.
Richard M. Stallman <rms@gnu.org>
parents:
5307
diff
changeset
|
618 ;; Return abbrev at point |
7396503653cf
Complete rewrite by Lars.Lindberg@sypro.cap.se.
Richard M. Stallman <rms@gnu.org>
parents:
5307
diff
changeset
|
619 (save-excursion |
11976
e862c6697f39
(dabbrev--abbrev-at-point): If point is after
Karl Heuer <kwzh@gnu.org>
parents:
11820
diff
changeset
|
620 ;; Record the end of the abbreviation. |
10230
7396503653cf
Complete rewrite by Lars.Lindberg@sypro.cap.se.
Richard M. Stallman <rms@gnu.org>
parents:
5307
diff
changeset
|
621 (setq dabbrev--last-abbrev-location (point)) |
11976
e862c6697f39
(dabbrev--abbrev-at-point): If point is after
Karl Heuer <kwzh@gnu.org>
parents:
11820
diff
changeset
|
622 ;; If we aren't right after an abbreviation, |
e862c6697f39
(dabbrev--abbrev-at-point): If point is after
Karl Heuer <kwzh@gnu.org>
parents:
11820
diff
changeset
|
623 ;; move point back to just after one. |
e862c6697f39
(dabbrev--abbrev-at-point): If point is after
Karl Heuer <kwzh@gnu.org>
parents:
11820
diff
changeset
|
624 ;; This is so the user can get successive words |
e862c6697f39
(dabbrev--abbrev-at-point): If point is after
Karl Heuer <kwzh@gnu.org>
parents:
11820
diff
changeset
|
625 ;; by typing the punctuation followed by M-/. |
e862c6697f39
(dabbrev--abbrev-at-point): If point is after
Karl Heuer <kwzh@gnu.org>
parents:
11820
diff
changeset
|
626 (save-match-data |
e862c6697f39
(dabbrev--abbrev-at-point): If point is after
Karl Heuer <kwzh@gnu.org>
parents:
11820
diff
changeset
|
627 (if (save-excursion |
e862c6697f39
(dabbrev--abbrev-at-point): If point is after
Karl Heuer <kwzh@gnu.org>
parents:
11820
diff
changeset
|
628 (forward-char -1) |
e862c6697f39
(dabbrev--abbrev-at-point): If point is after
Karl Heuer <kwzh@gnu.org>
parents:
11820
diff
changeset
|
629 (not (looking-at (concat "\\(" |
e862c6697f39
(dabbrev--abbrev-at-point): If point is after
Karl Heuer <kwzh@gnu.org>
parents:
11820
diff
changeset
|
630 (or dabbrev-abbrev-char-regexp |
e862c6697f39
(dabbrev--abbrev-at-point): If point is after
Karl Heuer <kwzh@gnu.org>
parents:
11820
diff
changeset
|
631 "\\sw\\|\\s_") |
e862c6697f39
(dabbrev--abbrev-at-point): If point is after
Karl Heuer <kwzh@gnu.org>
parents:
11820
diff
changeset
|
632 "\\)+")))) |
e862c6697f39
(dabbrev--abbrev-at-point): If point is after
Karl Heuer <kwzh@gnu.org>
parents:
11820
diff
changeset
|
633 (if (re-search-backward (or dabbrev-abbrev-char-regexp |
e862c6697f39
(dabbrev--abbrev-at-point): If point is after
Karl Heuer <kwzh@gnu.org>
parents:
11820
diff
changeset
|
634 "\\sw\\|\\s_") |
e862c6697f39
(dabbrev--abbrev-at-point): If point is after
Karl Heuer <kwzh@gnu.org>
parents:
11820
diff
changeset
|
635 nil t) |
e862c6697f39
(dabbrev--abbrev-at-point): If point is after
Karl Heuer <kwzh@gnu.org>
parents:
11820
diff
changeset
|
636 (forward-char 1) |
e862c6697f39
(dabbrev--abbrev-at-point): If point is after
Karl Heuer <kwzh@gnu.org>
parents:
11820
diff
changeset
|
637 (error "No possible abbreviation preceding point")))) |
e862c6697f39
(dabbrev--abbrev-at-point): If point is after
Karl Heuer <kwzh@gnu.org>
parents:
11820
diff
changeset
|
638 ;; Now find the beginning of that one. |
e862c6697f39
(dabbrev--abbrev-at-point): If point is after
Karl Heuer <kwzh@gnu.org>
parents:
11820
diff
changeset
|
639 (dabbrev--goto-start-of-abbrev) |
17864
c662a8633943
(dabbrev-expand, dabbrev--abbrev-at-point)
Richard M. Stallman <rms@gnu.org>
parents:
17711
diff
changeset
|
640 (buffer-substring-no-properties |
c662a8633943
(dabbrev-expand, dabbrev--abbrev-at-point)
Richard M. Stallman <rms@gnu.org>
parents:
17711
diff
changeset
|
641 dabbrev--last-abbrev-location (point)))) |
26459
1ef9d70dfb0f
* dabbrev.el (dabbrev-filter-elements): Use the new backquote syntax.
Sam Steingold <sds@gnu.org>
parents:
23306
diff
changeset
|
642 |
10230
7396503653cf
Complete rewrite by Lars.Lindberg@sypro.cap.se.
Richard M. Stallman <rms@gnu.org>
parents:
5307
diff
changeset
|
643 ;;; Initializes all global variables |
7396503653cf
Complete rewrite by Lars.Lindberg@sypro.cap.se.
Richard M. Stallman <rms@gnu.org>
parents:
5307
diff
changeset
|
644 (defun dabbrev--reset-global-variables () |
7396503653cf
Complete rewrite by Lars.Lindberg@sypro.cap.se.
Richard M. Stallman <rms@gnu.org>
parents:
5307
diff
changeset
|
645 ;; dabbrev--last-obarray and dabbrev--last-completion-buffer |
7396503653cf
Complete rewrite by Lars.Lindberg@sypro.cap.se.
Richard M. Stallman <rms@gnu.org>
parents:
5307
diff
changeset
|
646 ;; must not be reset here. |
7396503653cf
Complete rewrite by Lars.Lindberg@sypro.cap.se.
Richard M. Stallman <rms@gnu.org>
parents:
5307
diff
changeset
|
647 (setq dabbrev--last-table nil |
7396503653cf
Complete rewrite by Lars.Lindberg@sypro.cap.se.
Richard M. Stallman <rms@gnu.org>
parents:
5307
diff
changeset
|
648 dabbrev--last-abbreviation nil |
7396503653cf
Complete rewrite by Lars.Lindberg@sypro.cap.se.
Richard M. Stallman <rms@gnu.org>
parents:
5307
diff
changeset
|
649 dabbrev--last-abbrev-location nil |
7396503653cf
Complete rewrite by Lars.Lindberg@sypro.cap.se.
Richard M. Stallman <rms@gnu.org>
parents:
5307
diff
changeset
|
650 dabbrev--last-direction nil |
7396503653cf
Complete rewrite by Lars.Lindberg@sypro.cap.se.
Richard M. Stallman <rms@gnu.org>
parents:
5307
diff
changeset
|
651 dabbrev--last-expansion nil |
7396503653cf
Complete rewrite by Lars.Lindberg@sypro.cap.se.
Richard M. Stallman <rms@gnu.org>
parents:
5307
diff
changeset
|
652 dabbrev--last-expansion-location nil |
7396503653cf
Complete rewrite by Lars.Lindberg@sypro.cap.se.
Richard M. Stallman <rms@gnu.org>
parents:
5307
diff
changeset
|
653 dabbrev--friend-buffer-list nil |
7396503653cf
Complete rewrite by Lars.Lindberg@sypro.cap.se.
Richard M. Stallman <rms@gnu.org>
parents:
5307
diff
changeset
|
654 dabbrev--last-buffer nil |
7396503653cf
Complete rewrite by Lars.Lindberg@sypro.cap.se.
Richard M. Stallman <rms@gnu.org>
parents:
5307
diff
changeset
|
655 dabbrev--last-buffer-found nil |
7396503653cf
Complete rewrite by Lars.Lindberg@sypro.cap.se.
Richard M. Stallman <rms@gnu.org>
parents:
5307
diff
changeset
|
656 dabbrev--abbrev-char-regexp (or dabbrev-abbrev-char-regexp |
7396503653cf
Complete rewrite by Lars.Lindberg@sypro.cap.se.
Richard M. Stallman <rms@gnu.org>
parents:
5307
diff
changeset
|
657 "\\sw\\|\\s_") |
11820
362251066737
(dabbrev-completion): Use mapcar, not mapc.
Richard M. Stallman <rms@gnu.org>
parents:
10251
diff
changeset
|
658 dabbrev--check-other-buffers dabbrev-check-other-buffers)) |
267 | 659 |
10230
7396503653cf
Complete rewrite by Lars.Lindberg@sypro.cap.se.
Richard M. Stallman <rms@gnu.org>
parents:
5307
diff
changeset
|
660 (defun dabbrev--select-buffers () |
38138
a7bf2382c0d7
(dabbrev--make-friend-buffer-list): New function,
Richard M. Stallman <rms@gnu.org>
parents:
37573
diff
changeset
|
661 "Return a list of other buffers to search for a possible abbrev. |
a7bf2382c0d7
(dabbrev--make-friend-buffer-list): New function,
Richard M. Stallman <rms@gnu.org>
parents:
37573
diff
changeset
|
662 The current buffer is not included in the list. |
37487
ed8e6a4af6ef
(dabbrev--select-buffers): Add a doc string.
Eli Zaretskii <eliz@gnu.org>
parents:
35921
diff
changeset
|
663 |
38138
a7bf2382c0d7
(dabbrev--make-friend-buffer-list): New function,
Richard M. Stallman <rms@gnu.org>
parents:
37573
diff
changeset
|
664 This function makes a list of all the buffers returned by `buffer-list', |
a7bf2382c0d7
(dabbrev--make-friend-buffer-list): New function,
Richard M. Stallman <rms@gnu.org>
parents:
37573
diff
changeset
|
665 then discards buffers whose names match `dabbrev-ignored-buffer-names' |
a7bf2382c0d7
(dabbrev--make-friend-buffer-list): New function,
Richard M. Stallman <rms@gnu.org>
parents:
37573
diff
changeset
|
666 or `dabbrev-ignored-buffer-regexps'. It also discards buffers for which |
a7bf2382c0d7
(dabbrev--make-friend-buffer-list): New function,
Richard M. Stallman <rms@gnu.org>
parents:
37573
diff
changeset
|
667 `dabbrev-friend-buffer-function', if it is bound, returns nil when called |
a7bf2382c0d7
(dabbrev--make-friend-buffer-list): New function,
Richard M. Stallman <rms@gnu.org>
parents:
37573
diff
changeset
|
668 with the buffer as argument. |
a7bf2382c0d7
(dabbrev--make-friend-buffer-list): New function,
Richard M. Stallman <rms@gnu.org>
parents:
37573
diff
changeset
|
669 It returns the list of the buffers that are not discarded." |
a7bf2382c0d7
(dabbrev--make-friend-buffer-list): New function,
Richard M. Stallman <rms@gnu.org>
parents:
37573
diff
changeset
|
670 (dabbrev-filter-elements |
a7bf2382c0d7
(dabbrev--make-friend-buffer-list): New function,
Richard M. Stallman <rms@gnu.org>
parents:
37573
diff
changeset
|
671 buffer (buffer-list) |
a7bf2382c0d7
(dabbrev--make-friend-buffer-list): New function,
Richard M. Stallman <rms@gnu.org>
parents:
37573
diff
changeset
|
672 (and (not (eq (current-buffer) buffer)) |
a7bf2382c0d7
(dabbrev--make-friend-buffer-list): New function,
Richard M. Stallman <rms@gnu.org>
parents:
37573
diff
changeset
|
673 (not (dabbrev--ignore-buffer-p buffer)) |
a7bf2382c0d7
(dabbrev--make-friend-buffer-list): New function,
Richard M. Stallman <rms@gnu.org>
parents:
37573
diff
changeset
|
674 (boundp 'dabbrev-friend-buffer-function) |
38142
121f029b6b4a
(dabbrev--select-buffers): Fix last change.
Eli Zaretskii <eliz@gnu.org>
parents:
38138
diff
changeset
|
675 (funcall dabbrev-friend-buffer-function buffer)))) |
10230
7396503653cf
Complete rewrite by Lars.Lindberg@sypro.cap.se.
Richard M. Stallman <rms@gnu.org>
parents:
5307
diff
changeset
|
676 |
7396503653cf
Complete rewrite by Lars.Lindberg@sypro.cap.se.
Richard M. Stallman <rms@gnu.org>
parents:
5307
diff
changeset
|
677 (defun dabbrev--try-find (abbrev reverse n ignore-case) |
37497
b04b5ca14967
Add doc strings for some functions.
Richard M. Stallman <rms@gnu.org>
parents:
37487
diff
changeset
|
678 "Search for ABBREV, backwards if REVERSE, N times. |
b04b5ca14967
Add doc strings for some functions.
Richard M. Stallman <rms@gnu.org>
parents:
37487
diff
changeset
|
679 If IGNORE-CASE is non-nil, ignore case while searching. |
b04b5ca14967
Add doc strings for some functions.
Richard M. Stallman <rms@gnu.org>
parents:
37487
diff
changeset
|
680 Return the expansion found, and save the location of the start |
b04b5ca14967
Add doc strings for some functions.
Richard M. Stallman <rms@gnu.org>
parents:
37487
diff
changeset
|
681 of the expansion in `dabbrev--last-expansion-location'." |
10230
7396503653cf
Complete rewrite by Lars.Lindberg@sypro.cap.se.
Richard M. Stallman <rms@gnu.org>
parents:
5307
diff
changeset
|
682 (save-excursion |
11820
362251066737
(dabbrev-completion): Use mapcar, not mapc.
Richard M. Stallman <rms@gnu.org>
parents:
10251
diff
changeset
|
683 (save-restriction |
362251066737
(dabbrev-completion): Use mapcar, not mapc.
Richard M. Stallman <rms@gnu.org>
parents:
10251
diff
changeset
|
684 (widen) |
362251066737
(dabbrev-completion): Use mapcar, not mapc.
Richard M. Stallman <rms@gnu.org>
parents:
10251
diff
changeset
|
685 (let ((expansion nil)) |
362251066737
(dabbrev-completion): Use mapcar, not mapc.
Richard M. Stallman <rms@gnu.org>
parents:
10251
diff
changeset
|
686 (and dabbrev--last-expansion-location |
362251066737
(dabbrev-completion): Use mapcar, not mapc.
Richard M. Stallman <rms@gnu.org>
parents:
10251
diff
changeset
|
687 (goto-char dabbrev--last-expansion-location)) |
362251066737
(dabbrev-completion): Use mapcar, not mapc.
Richard M. Stallman <rms@gnu.org>
parents:
10251
diff
changeset
|
688 (let ((case-fold-search ignore-case) |
362251066737
(dabbrev-completion): Use mapcar, not mapc.
Richard M. Stallman <rms@gnu.org>
parents:
10251
diff
changeset
|
689 (count n)) |
362251066737
(dabbrev-completion): Use mapcar, not mapc.
Richard M. Stallman <rms@gnu.org>
parents:
10251
diff
changeset
|
690 (while (and (> count 0) |
362251066737
(dabbrev-completion): Use mapcar, not mapc.
Richard M. Stallman <rms@gnu.org>
parents:
10251
diff
changeset
|
691 (setq expansion (dabbrev--search abbrev |
362251066737
(dabbrev-completion): Use mapcar, not mapc.
Richard M. Stallman <rms@gnu.org>
parents:
10251
diff
changeset
|
692 reverse |
45292
e3ba76f78075
(dabbrev-case-distinction): New option.
Richard M. Stallman <rms@gnu.org>
parents:
43981
diff
changeset
|
693 (and ignore-case |
e3ba76f78075
(dabbrev-case-distinction): New option.
Richard M. Stallman <rms@gnu.org>
parents:
43981
diff
changeset
|
694 (if (eq dabbrev-case-distinction 'case-replace) |
e3ba76f78075
(dabbrev-case-distinction): New option.
Richard M. Stallman <rms@gnu.org>
parents:
43981
diff
changeset
|
695 case-replace |
e3ba76f78075
(dabbrev-case-distinction): New option.
Richard M. Stallman <rms@gnu.org>
parents:
43981
diff
changeset
|
696 dabbrev-case-distinction)) |
e3ba76f78075
(dabbrev-case-distinction): New option.
Richard M. Stallman <rms@gnu.org>
parents:
43981
diff
changeset
|
697 ))) |
11820
362251066737
(dabbrev-completion): Use mapcar, not mapc.
Richard M. Stallman <rms@gnu.org>
parents:
10251
diff
changeset
|
698 (setq count (1- count)))) |
362251066737
(dabbrev-completion): Use mapcar, not mapc.
Richard M. Stallman <rms@gnu.org>
parents:
10251
diff
changeset
|
699 (and expansion |
362251066737
(dabbrev-completion): Use mapcar, not mapc.
Richard M. Stallman <rms@gnu.org>
parents:
10251
diff
changeset
|
700 (setq dabbrev--last-expansion-location (point))) |
362251066737
(dabbrev-completion): Use mapcar, not mapc.
Richard M. Stallman <rms@gnu.org>
parents:
10251
diff
changeset
|
701 expansion)))) |
10230
7396503653cf
Complete rewrite by Lars.Lindberg@sypro.cap.se.
Richard M. Stallman <rms@gnu.org>
parents:
5307
diff
changeset
|
702 |
7396503653cf
Complete rewrite by Lars.Lindberg@sypro.cap.se.
Richard M. Stallman <rms@gnu.org>
parents:
5307
diff
changeset
|
703 (defun dabbrev--find-all-expansions (abbrev ignore-case) |
37497
b04b5ca14967
Add doc strings for some functions.
Richard M. Stallman <rms@gnu.org>
parents:
37487
diff
changeset
|
704 "Return a list of all possible expansions of ABBREV. |
b04b5ca14967
Add doc strings for some functions.
Richard M. Stallman <rms@gnu.org>
parents:
37487
diff
changeset
|
705 If IGNORE-CASE is non-nil, accept matches which differ in case." |
10230
7396503653cf
Complete rewrite by Lars.Lindberg@sypro.cap.se.
Richard M. Stallman <rms@gnu.org>
parents:
5307
diff
changeset
|
706 (let ((all-expansions nil) |
7396503653cf
Complete rewrite by Lars.Lindberg@sypro.cap.se.
Richard M. Stallman <rms@gnu.org>
parents:
5307
diff
changeset
|
707 expansion) |
7396503653cf
Complete rewrite by Lars.Lindberg@sypro.cap.se.
Richard M. Stallman <rms@gnu.org>
parents:
5307
diff
changeset
|
708 (save-excursion |
7396503653cf
Complete rewrite by Lars.Lindberg@sypro.cap.se.
Richard M. Stallman <rms@gnu.org>
parents:
5307
diff
changeset
|
709 (goto-char (point-min)) |
7396503653cf
Complete rewrite by Lars.Lindberg@sypro.cap.se.
Richard M. Stallman <rms@gnu.org>
parents:
5307
diff
changeset
|
710 (while (setq expansion (dabbrev--find-expansion abbrev -1 ignore-case)) |
11820
362251066737
(dabbrev-completion): Use mapcar, not mapc.
Richard M. Stallman <rms@gnu.org>
parents:
10251
diff
changeset
|
711 (setq all-expansions (cons expansion all-expansions)))) |
10230
7396503653cf
Complete rewrite by Lars.Lindberg@sypro.cap.se.
Richard M. Stallman <rms@gnu.org>
parents:
5307
diff
changeset
|
712 all-expansions)) |
7396503653cf
Complete rewrite by Lars.Lindberg@sypro.cap.se.
Richard M. Stallman <rms@gnu.org>
parents:
5307
diff
changeset
|
713 |
7396503653cf
Complete rewrite by Lars.Lindberg@sypro.cap.se.
Richard M. Stallman <rms@gnu.org>
parents:
5307
diff
changeset
|
714 (defun dabbrev--scanning-message () |
38138
a7bf2382c0d7
(dabbrev--make-friend-buffer-list): New function,
Richard M. Stallman <rms@gnu.org>
parents:
37573
diff
changeset
|
715 (unless (window-minibuffer-p (selected-window)) |
a7bf2382c0d7
(dabbrev--make-friend-buffer-list): New function,
Richard M. Stallman <rms@gnu.org>
parents:
37573
diff
changeset
|
716 (message "Scanning `%s'" (buffer-name (current-buffer))))) |
10230
7396503653cf
Complete rewrite by Lars.Lindberg@sypro.cap.se.
Richard M. Stallman <rms@gnu.org>
parents:
5307
diff
changeset
|
717 |
37504
cf707ac71b73
(dabbrev--ignore-buffer-p): New function.
Miles Bader <miles@gnu.org>
parents:
37497
diff
changeset
|
718 (defun dabbrev--ignore-buffer-p (buffer) |
cf707ac71b73
(dabbrev--ignore-buffer-p): New function.
Miles Bader <miles@gnu.org>
parents:
37497
diff
changeset
|
719 "Return non-nil if BUFFER should be ignored by dabbrev." |
cf707ac71b73
(dabbrev--ignore-buffer-p): New function.
Miles Bader <miles@gnu.org>
parents:
37497
diff
changeset
|
720 (let ((bn (buffer-name buffer))) |
cf707ac71b73
(dabbrev--ignore-buffer-p): New function.
Miles Bader <miles@gnu.org>
parents:
37497
diff
changeset
|
721 (or (member bn dabbrev-ignored-buffer-names) |
cf707ac71b73
(dabbrev--ignore-buffer-p): New function.
Miles Bader <miles@gnu.org>
parents:
37497
diff
changeset
|
722 (let ((tail dabbrev-ignored-buffer-regexps) |
cf707ac71b73
(dabbrev--ignore-buffer-p): New function.
Miles Bader <miles@gnu.org>
parents:
37497
diff
changeset
|
723 (match nil)) |
cf707ac71b73
(dabbrev--ignore-buffer-p): New function.
Miles Bader <miles@gnu.org>
parents:
37497
diff
changeset
|
724 (while (and tail (not match)) |
cf707ac71b73
(dabbrev--ignore-buffer-p): New function.
Miles Bader <miles@gnu.org>
parents:
37497
diff
changeset
|
725 (setq match (string-match (car tail) bn) |
cf707ac71b73
(dabbrev--ignore-buffer-p): New function.
Miles Bader <miles@gnu.org>
parents:
37497
diff
changeset
|
726 tail (cdr tail))) |
cf707ac71b73
(dabbrev--ignore-buffer-p): New function.
Miles Bader <miles@gnu.org>
parents:
37497
diff
changeset
|
727 match)))) |
cf707ac71b73
(dabbrev--ignore-buffer-p): New function.
Miles Bader <miles@gnu.org>
parents:
37497
diff
changeset
|
728 |
10230
7396503653cf
Complete rewrite by Lars.Lindberg@sypro.cap.se.
Richard M. Stallman <rms@gnu.org>
parents:
5307
diff
changeset
|
729 (defun dabbrev--find-expansion (abbrev direction ignore-case) |
37497
b04b5ca14967
Add doc strings for some functions.
Richard M. Stallman <rms@gnu.org>
parents:
37487
diff
changeset
|
730 "Find one occurrence of ABBREV, and return the expansion. |
b04b5ca14967
Add doc strings for some functions.
Richard M. Stallman <rms@gnu.org>
parents:
37487
diff
changeset
|
731 DIRECTION > 0 means look that many times backwards. |
b04b5ca14967
Add doc strings for some functions.
Richard M. Stallman <rms@gnu.org>
parents:
37487
diff
changeset
|
732 DIRECTION < 0 means look that many times forward. |
b04b5ca14967
Add doc strings for some functions.
Richard M. Stallman <rms@gnu.org>
parents:
37487
diff
changeset
|
733 DIRECTION = 0 means try both backward and forward. |
b04b5ca14967
Add doc strings for some functions.
Richard M. Stallman <rms@gnu.org>
parents:
37487
diff
changeset
|
734 IGNORE-CASE non-nil means ignore case when searching. |
b04b5ca14967
Add doc strings for some functions.
Richard M. Stallman <rms@gnu.org>
parents:
37487
diff
changeset
|
735 This sets `dabbrev--last-direction' to 1 or -1 according |
b04b5ca14967
Add doc strings for some functions.
Richard M. Stallman <rms@gnu.org>
parents:
37487
diff
changeset
|
736 to the direction in which the occurrence was actually found. |
49588
37645a051842
Trailing whitespace deleted.
Juanma Barranquero <lekktu@gmail.com>
parents:
49067
diff
changeset
|
737 It sets `dabbrev--last-expansion-location' to the location |
37497
b04b5ca14967
Add doc strings for some functions.
Richard M. Stallman <rms@gnu.org>
parents:
37487
diff
changeset
|
738 of the start of the occurrence." |
38138
a7bf2382c0d7
(dabbrev--make-friend-buffer-list): New function,
Richard M. Stallman <rms@gnu.org>
parents:
37573
diff
changeset
|
739 (save-excursion |
a7bf2382c0d7
(dabbrev--make-friend-buffer-list): New function,
Richard M. Stallman <rms@gnu.org>
parents:
37573
diff
changeset
|
740 ;; If we were scanning something other than the current buffer, |
a7bf2382c0d7
(dabbrev--make-friend-buffer-list): New function,
Richard M. Stallman <rms@gnu.org>
parents:
37573
diff
changeset
|
741 ;; continue scanning there. |
a7bf2382c0d7
(dabbrev--make-friend-buffer-list): New function,
Richard M. Stallman <rms@gnu.org>
parents:
37573
diff
changeset
|
742 (when dabbrev--last-buffer |
a7bf2382c0d7
(dabbrev--make-friend-buffer-list): New function,
Richard M. Stallman <rms@gnu.org>
parents:
37573
diff
changeset
|
743 (set-buffer dabbrev--last-buffer) |
a7bf2382c0d7
(dabbrev--make-friend-buffer-list): New function,
Richard M. Stallman <rms@gnu.org>
parents:
37573
diff
changeset
|
744 (dabbrev--scanning-message)) |
a7bf2382c0d7
(dabbrev--make-friend-buffer-list): New function,
Richard M. Stallman <rms@gnu.org>
parents:
37573
diff
changeset
|
745 (or |
a7bf2382c0d7
(dabbrev--make-friend-buffer-list): New function,
Richard M. Stallman <rms@gnu.org>
parents:
37573
diff
changeset
|
746 ;; ------------------------------------------ |
a7bf2382c0d7
(dabbrev--make-friend-buffer-list): New function,
Richard M. Stallman <rms@gnu.org>
parents:
37573
diff
changeset
|
747 ;; Look backward in current buffer. |
a7bf2382c0d7
(dabbrev--make-friend-buffer-list): New function,
Richard M. Stallman <rms@gnu.org>
parents:
37573
diff
changeset
|
748 ;; ------------------------------------------ |
a7bf2382c0d7
(dabbrev--make-friend-buffer-list): New function,
Richard M. Stallman <rms@gnu.org>
parents:
37573
diff
changeset
|
749 (and (not dabbrev-search-these-buffers-only) |
a7bf2382c0d7
(dabbrev--make-friend-buffer-list): New function,
Richard M. Stallman <rms@gnu.org>
parents:
37573
diff
changeset
|
750 (>= direction 0) |
a7bf2382c0d7
(dabbrev--make-friend-buffer-list): New function,
Richard M. Stallman <rms@gnu.org>
parents:
37573
diff
changeset
|
751 (setq dabbrev--last-direction (min 1 direction)) |
a7bf2382c0d7
(dabbrev--make-friend-buffer-list): New function,
Richard M. Stallman <rms@gnu.org>
parents:
37573
diff
changeset
|
752 (dabbrev--try-find abbrev t |
a7bf2382c0d7
(dabbrev--make-friend-buffer-list): New function,
Richard M. Stallman <rms@gnu.org>
parents:
37573
diff
changeset
|
753 (max 1 direction) |
a7bf2382c0d7
(dabbrev--make-friend-buffer-list): New function,
Richard M. Stallman <rms@gnu.org>
parents:
37573
diff
changeset
|
754 ignore-case)) |
a7bf2382c0d7
(dabbrev--make-friend-buffer-list): New function,
Richard M. Stallman <rms@gnu.org>
parents:
37573
diff
changeset
|
755 ;; ------------------------------------------ |
a7bf2382c0d7
(dabbrev--make-friend-buffer-list): New function,
Richard M. Stallman <rms@gnu.org>
parents:
37573
diff
changeset
|
756 ;; Look forward in current buffer |
a7bf2382c0d7
(dabbrev--make-friend-buffer-list): New function,
Richard M. Stallman <rms@gnu.org>
parents:
37573
diff
changeset
|
757 ;; or whatever buffer we were last scanning. |
a7bf2382c0d7
(dabbrev--make-friend-buffer-list): New function,
Richard M. Stallman <rms@gnu.org>
parents:
37573
diff
changeset
|
758 ;; ------------------------------------------ |
a7bf2382c0d7
(dabbrev--make-friend-buffer-list): New function,
Richard M. Stallman <rms@gnu.org>
parents:
37573
diff
changeset
|
759 (and (or (not dabbrev-search-these-buffers-only) |
a7bf2382c0d7
(dabbrev--make-friend-buffer-list): New function,
Richard M. Stallman <rms@gnu.org>
parents:
37573
diff
changeset
|
760 dabbrev--last-buffer) |
a7bf2382c0d7
(dabbrev--make-friend-buffer-list): New function,
Richard M. Stallman <rms@gnu.org>
parents:
37573
diff
changeset
|
761 (<= direction 0) |
a7bf2382c0d7
(dabbrev--make-friend-buffer-list): New function,
Richard M. Stallman <rms@gnu.org>
parents:
37573
diff
changeset
|
762 (setq dabbrev--last-direction -1) |
a7bf2382c0d7
(dabbrev--make-friend-buffer-list): New function,
Richard M. Stallman <rms@gnu.org>
parents:
37573
diff
changeset
|
763 (dabbrev--try-find abbrev nil |
a7bf2382c0d7
(dabbrev--make-friend-buffer-list): New function,
Richard M. Stallman <rms@gnu.org>
parents:
37573
diff
changeset
|
764 (max 1 (- direction)) |
a7bf2382c0d7
(dabbrev--make-friend-buffer-list): New function,
Richard M. Stallman <rms@gnu.org>
parents:
37573
diff
changeset
|
765 ignore-case)) |
a7bf2382c0d7
(dabbrev--make-friend-buffer-list): New function,
Richard M. Stallman <rms@gnu.org>
parents:
37573
diff
changeset
|
766 ;; ------------------------------------------ |
a7bf2382c0d7
(dabbrev--make-friend-buffer-list): New function,
Richard M. Stallman <rms@gnu.org>
parents:
37573
diff
changeset
|
767 ;; Look in other buffers. |
a7bf2382c0d7
(dabbrev--make-friend-buffer-list): New function,
Richard M. Stallman <rms@gnu.org>
parents:
37573
diff
changeset
|
768 ;; Always start at (point-min) and look forward. |
a7bf2382c0d7
(dabbrev--make-friend-buffer-list): New function,
Richard M. Stallman <rms@gnu.org>
parents:
37573
diff
changeset
|
769 ;; ------------------------------------------ |
a7bf2382c0d7
(dabbrev--make-friend-buffer-list): New function,
Richard M. Stallman <rms@gnu.org>
parents:
37573
diff
changeset
|
770 (progn |
a7bf2382c0d7
(dabbrev--make-friend-buffer-list): New function,
Richard M. Stallman <rms@gnu.org>
parents:
37573
diff
changeset
|
771 (setq dabbrev--last-direction -1) |
a7bf2382c0d7
(dabbrev--make-friend-buffer-list): New function,
Richard M. Stallman <rms@gnu.org>
parents:
37573
diff
changeset
|
772 (unless dabbrev--last-buffer |
a7bf2382c0d7
(dabbrev--make-friend-buffer-list): New function,
Richard M. Stallman <rms@gnu.org>
parents:
37573
diff
changeset
|
773 ;; If we have just now begun to search other buffers, |
a7bf2382c0d7
(dabbrev--make-friend-buffer-list): New function,
Richard M. Stallman <rms@gnu.org>
parents:
37573
diff
changeset
|
774 ;; determine which other buffers we should check. |
a7bf2382c0d7
(dabbrev--make-friend-buffer-list): New function,
Richard M. Stallman <rms@gnu.org>
parents:
37573
diff
changeset
|
775 ;; Put that list in dabbrev--friend-buffer-list. |
a7bf2382c0d7
(dabbrev--make-friend-buffer-list): New function,
Richard M. Stallman <rms@gnu.org>
parents:
37573
diff
changeset
|
776 (or dabbrev--friend-buffer-list |
a7bf2382c0d7
(dabbrev--make-friend-buffer-list): New function,
Richard M. Stallman <rms@gnu.org>
parents:
37573
diff
changeset
|
777 (setq dabbrev--friend-buffer-list |
a7bf2382c0d7
(dabbrev--make-friend-buffer-list): New function,
Richard M. Stallman <rms@gnu.org>
parents:
37573
diff
changeset
|
778 (dabbrev--make-friend-buffer-list)))) |
a7bf2382c0d7
(dabbrev--make-friend-buffer-list): New function,
Richard M. Stallman <rms@gnu.org>
parents:
37573
diff
changeset
|
779 ;; Walk through the buffers till we find a match. |
a7bf2382c0d7
(dabbrev--make-friend-buffer-list): New function,
Richard M. Stallman <rms@gnu.org>
parents:
37573
diff
changeset
|
780 (let (expansion) |
a7bf2382c0d7
(dabbrev--make-friend-buffer-list): New function,
Richard M. Stallman <rms@gnu.org>
parents:
37573
diff
changeset
|
781 (while (and (not expansion) dabbrev--friend-buffer-list) |
54578
9e27d826339c
(dabbrev-expand): Fix regexp construction.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
52401
diff
changeset
|
782 (setq dabbrev--last-buffer (pop dabbrev--friend-buffer-list)) |
38138
a7bf2382c0d7
(dabbrev--make-friend-buffer-list): New function,
Richard M. Stallman <rms@gnu.org>
parents:
37573
diff
changeset
|
783 (set-buffer dabbrev--last-buffer) |
a7bf2382c0d7
(dabbrev--make-friend-buffer-list): New function,
Richard M. Stallman <rms@gnu.org>
parents:
37573
diff
changeset
|
784 (dabbrev--scanning-message) |
a7bf2382c0d7
(dabbrev--make-friend-buffer-list): New function,
Richard M. Stallman <rms@gnu.org>
parents:
37573
diff
changeset
|
785 (setq dabbrev--last-expansion-location (point-min)) |
a7bf2382c0d7
(dabbrev--make-friend-buffer-list): New function,
Richard M. Stallman <rms@gnu.org>
parents:
37573
diff
changeset
|
786 (setq expansion (dabbrev--try-find abbrev nil 1 ignore-case))) |
a7bf2382c0d7
(dabbrev--make-friend-buffer-list): New function,
Richard M. Stallman <rms@gnu.org>
parents:
37573
diff
changeset
|
787 expansion))))) |
a7bf2382c0d7
(dabbrev--make-friend-buffer-list): New function,
Richard M. Stallman <rms@gnu.org>
parents:
37573
diff
changeset
|
788 |
a7bf2382c0d7
(dabbrev--make-friend-buffer-list): New function,
Richard M. Stallman <rms@gnu.org>
parents:
37573
diff
changeset
|
789 ;; Compute the list of buffers to scan. |
a7bf2382c0d7
(dabbrev--make-friend-buffer-list): New function,
Richard M. Stallman <rms@gnu.org>
parents:
37573
diff
changeset
|
790 ;; If dabbrev-search-these-buffers-only, then the current buffer |
a7bf2382c0d7
(dabbrev--make-friend-buffer-list): New function,
Richard M. Stallman <rms@gnu.org>
parents:
37573
diff
changeset
|
791 ;; is included in this list if it should be searched. |
a7bf2382c0d7
(dabbrev--make-friend-buffer-list): New function,
Richard M. Stallman <rms@gnu.org>
parents:
37573
diff
changeset
|
792 ;; Otherwise, the current buffer is searched first specially., |
a7bf2382c0d7
(dabbrev--make-friend-buffer-list): New function,
Richard M. Stallman <rms@gnu.org>
parents:
37573
diff
changeset
|
793 ;; and it is not included in this list. |
a7bf2382c0d7
(dabbrev--make-friend-buffer-list): New function,
Richard M. Stallman <rms@gnu.org>
parents:
37573
diff
changeset
|
794 (defun dabbrev--make-friend-buffer-list () |
a7bf2382c0d7
(dabbrev--make-friend-buffer-list): New function,
Richard M. Stallman <rms@gnu.org>
parents:
37573
diff
changeset
|
795 (let ((list (mapcar (function get-buffer) |
a7bf2382c0d7
(dabbrev--make-friend-buffer-list): New function,
Richard M. Stallman <rms@gnu.org>
parents:
37573
diff
changeset
|
796 dabbrev-search-these-buffers-only))) |
a7bf2382c0d7
(dabbrev--make-friend-buffer-list): New function,
Richard M. Stallman <rms@gnu.org>
parents:
37573
diff
changeset
|
797 (when (and (null dabbrev-search-these-buffers-only) |
a7bf2382c0d7
(dabbrev--make-friend-buffer-list): New function,
Richard M. Stallman <rms@gnu.org>
parents:
37573
diff
changeset
|
798 dabbrev--check-other-buffers |
a7bf2382c0d7
(dabbrev--make-friend-buffer-list): New function,
Richard M. Stallman <rms@gnu.org>
parents:
37573
diff
changeset
|
799 (or (eq dabbrev--check-other-buffers t) |
a7bf2382c0d7
(dabbrev--make-friend-buffer-list): New function,
Richard M. Stallman <rms@gnu.org>
parents:
37573
diff
changeset
|
800 (setq dabbrev--check-other-buffers |
a7bf2382c0d7
(dabbrev--make-friend-buffer-list): New function,
Richard M. Stallman <rms@gnu.org>
parents:
37573
diff
changeset
|
801 (y-or-n-p "Scan other buffers also? ")))) |
a7bf2382c0d7
(dabbrev--make-friend-buffer-list): New function,
Richard M. Stallman <rms@gnu.org>
parents:
37573
diff
changeset
|
802 (setq list (funcall dabbrev-select-buffers-function)) |
a7bf2382c0d7
(dabbrev--make-friend-buffer-list): New function,
Richard M. Stallman <rms@gnu.org>
parents:
37573
diff
changeset
|
803 ;; If dabbrev-check-all-buffers, tack on all the other |
a7bf2382c0d7
(dabbrev--make-friend-buffer-list): New function,
Richard M. Stallman <rms@gnu.org>
parents:
37573
diff
changeset
|
804 ;; buffers at the end of the list, except those which are |
a7bf2382c0d7
(dabbrev--make-friend-buffer-list): New function,
Richard M. Stallman <rms@gnu.org>
parents:
37573
diff
changeset
|
805 ;; specifically to be ignored. |
a7bf2382c0d7
(dabbrev--make-friend-buffer-list): New function,
Richard M. Stallman <rms@gnu.org>
parents:
37573
diff
changeset
|
806 (if dabbrev-check-all-buffers |
a7bf2382c0d7
(dabbrev--make-friend-buffer-list): New function,
Richard M. Stallman <rms@gnu.org>
parents:
37573
diff
changeset
|
807 (setq list |
a7bf2382c0d7
(dabbrev--make-friend-buffer-list): New function,
Richard M. Stallman <rms@gnu.org>
parents:
37573
diff
changeset
|
808 (append list |
34596
51c08e149a23
(dabbrev--last-case-pattern): Value is now
Gerd Moellmann <gerd@gnu.org>
parents:
30002
diff
changeset
|
809 (dabbrev-filter-elements |
51c08e149a23
(dabbrev--last-case-pattern): Value is now
Gerd Moellmann <gerd@gnu.org>
parents:
30002
diff
changeset
|
810 buffer (buffer-list) |
38138
a7bf2382c0d7
(dabbrev--make-friend-buffer-list): New function,
Richard M. Stallman <rms@gnu.org>
parents:
37573
diff
changeset
|
811 (and (not (memq buffer list)) |
a7bf2382c0d7
(dabbrev--make-friend-buffer-list): New function,
Richard M. Stallman <rms@gnu.org>
parents:
37573
diff
changeset
|
812 (not (dabbrev--ignore-buffer-p buffer))))))) |
a7bf2382c0d7
(dabbrev--make-friend-buffer-list): New function,
Richard M. Stallman <rms@gnu.org>
parents:
37573
diff
changeset
|
813 ;; Remove the current buffer. |
a7bf2382c0d7
(dabbrev--make-friend-buffer-list): New function,
Richard M. Stallman <rms@gnu.org>
parents:
37573
diff
changeset
|
814 (setq list (delq (current-buffer) list))) |
a7bf2382c0d7
(dabbrev--make-friend-buffer-list): New function,
Richard M. Stallman <rms@gnu.org>
parents:
37573
diff
changeset
|
815 ;; Move buffers in the list that are visible on the screen |
a7bf2382c0d7
(dabbrev--make-friend-buffer-list): New function,
Richard M. Stallman <rms@gnu.org>
parents:
37573
diff
changeset
|
816 ;; to the front of the list, but don't add anything to the list. |
a7bf2382c0d7
(dabbrev--make-friend-buffer-list): New function,
Richard M. Stallman <rms@gnu.org>
parents:
37573
diff
changeset
|
817 (if list |
a7bf2382c0d7
(dabbrev--make-friend-buffer-list): New function,
Richard M. Stallman <rms@gnu.org>
parents:
37573
diff
changeset
|
818 (walk-windows (lambda (w) |
a7bf2382c0d7
(dabbrev--make-friend-buffer-list): New function,
Richard M. Stallman <rms@gnu.org>
parents:
37573
diff
changeset
|
819 (unless (eq w (selected-window)) |
a7bf2382c0d7
(dabbrev--make-friend-buffer-list): New function,
Richard M. Stallman <rms@gnu.org>
parents:
37573
diff
changeset
|
820 (if (memq (window-buffer w) list) |
a7bf2382c0d7
(dabbrev--make-friend-buffer-list): New function,
Richard M. Stallman <rms@gnu.org>
parents:
37573
diff
changeset
|
821 (setq list |
a7bf2382c0d7
(dabbrev--make-friend-buffer-list): New function,
Richard M. Stallman <rms@gnu.org>
parents:
37573
diff
changeset
|
822 (cons (window-buffer w) |
a7bf2382c0d7
(dabbrev--make-friend-buffer-list): New function,
Richard M. Stallman <rms@gnu.org>
parents:
37573
diff
changeset
|
823 (delq (window-buffer w) |
a7bf2382c0d7
(dabbrev--make-friend-buffer-list): New function,
Richard M. Stallman <rms@gnu.org>
parents:
37573
diff
changeset
|
824 list)))))))) |
a7bf2382c0d7
(dabbrev--make-friend-buffer-list): New function,
Richard M. Stallman <rms@gnu.org>
parents:
37573
diff
changeset
|
825 ;; In a minibuffer, search the buffer it was activated from, |
a7bf2382c0d7
(dabbrev--make-friend-buffer-list): New function,
Richard M. Stallman <rms@gnu.org>
parents:
37573
diff
changeset
|
826 ;; first after the minibuffer itself. Unless we aren't supposed |
a7bf2382c0d7
(dabbrev--make-friend-buffer-list): New function,
Richard M. Stallman <rms@gnu.org>
parents:
37573
diff
changeset
|
827 ;; to search the current buffer either. |
a7bf2382c0d7
(dabbrev--make-friend-buffer-list): New function,
Richard M. Stallman <rms@gnu.org>
parents:
37573
diff
changeset
|
828 (if (and (window-minibuffer-p (selected-window)) |
a7bf2382c0d7
(dabbrev--make-friend-buffer-list): New function,
Richard M. Stallman <rms@gnu.org>
parents:
37573
diff
changeset
|
829 (not dabbrev-search-these-buffers-only)) |
a7bf2382c0d7
(dabbrev--make-friend-buffer-list): New function,
Richard M. Stallman <rms@gnu.org>
parents:
37573
diff
changeset
|
830 (setq list |
a7bf2382c0d7
(dabbrev--make-friend-buffer-list): New function,
Richard M. Stallman <rms@gnu.org>
parents:
37573
diff
changeset
|
831 (cons (dabbrev--minibuffer-origin) |
a7bf2382c0d7
(dabbrev--make-friend-buffer-list): New function,
Richard M. Stallman <rms@gnu.org>
parents:
37573
diff
changeset
|
832 (delq (dabbrev--minibuffer-origin) list)))) |
a7bf2382c0d7
(dabbrev--make-friend-buffer-list): New function,
Richard M. Stallman <rms@gnu.org>
parents:
37573
diff
changeset
|
833 list)) |
10230
7396503653cf
Complete rewrite by Lars.Lindberg@sypro.cap.se.
Richard M. Stallman <rms@gnu.org>
parents:
5307
diff
changeset
|
834 |
7396503653cf
Complete rewrite by Lars.Lindberg@sypro.cap.se.
Richard M. Stallman <rms@gnu.org>
parents:
5307
diff
changeset
|
835 (defun dabbrev--safe-replace-match (string &optional fixedcase literal) |
7396503653cf
Complete rewrite by Lars.Lindberg@sypro.cap.se.
Richard M. Stallman <rms@gnu.org>
parents:
5307
diff
changeset
|
836 (if (eq major-mode 'picture-mode) |
52206
de409240d09e
(dabbrev--safe-replace-match): Use with-no-warnings.
Richard M. Stallman <rms@gnu.org>
parents:
52103
diff
changeset
|
837 (with-no-warnings |
de409240d09e
(dabbrev--safe-replace-match): Use with-no-warnings.
Richard M. Stallman <rms@gnu.org>
parents:
52103
diff
changeset
|
838 (picture-replace-match string fixedcase literal)) |
10230
7396503653cf
Complete rewrite by Lars.Lindberg@sypro.cap.se.
Richard M. Stallman <rms@gnu.org>
parents:
5307
diff
changeset
|
839 (replace-match string fixedcase literal))) |
7396503653cf
Complete rewrite by Lars.Lindberg@sypro.cap.se.
Richard M. Stallman <rms@gnu.org>
parents:
5307
diff
changeset
|
840 |
7396503653cf
Complete rewrite by Lars.Lindberg@sypro.cap.se.
Richard M. Stallman <rms@gnu.org>
parents:
5307
diff
changeset
|
841 ;;;---------------------------------------------------------------- |
34596
51c08e149a23
(dabbrev--last-case-pattern): Value is now
Gerd Moellmann <gerd@gnu.org>
parents:
30002
diff
changeset
|
842 (defun dabbrev--substitute-expansion (old abbrev expansion record-case-pattern) |
51c08e149a23
(dabbrev--last-case-pattern): Value is now
Gerd Moellmann <gerd@gnu.org>
parents:
30002
diff
changeset
|
843 "Replace OLD with EXPANSION in the buffer. |
51c08e149a23
(dabbrev--last-case-pattern): Value is now
Gerd Moellmann <gerd@gnu.org>
parents:
30002
diff
changeset
|
844 OLD is text currently in the buffer, perhaps the abbreviation |
51c08e149a23
(dabbrev--last-case-pattern): Value is now
Gerd Moellmann <gerd@gnu.org>
parents:
30002
diff
changeset
|
845 or perhaps another expansion that was tried previously. |
51c08e149a23
(dabbrev--last-case-pattern): Value is now
Gerd Moellmann <gerd@gnu.org>
parents:
30002
diff
changeset
|
846 ABBREV is the abbreviation we are expanding. |
51c08e149a23
(dabbrev--last-case-pattern): Value is now
Gerd Moellmann <gerd@gnu.org>
parents:
30002
diff
changeset
|
847 It is \" \" if we are copying subsequent words. |
51c08e149a23
(dabbrev--last-case-pattern): Value is now
Gerd Moellmann <gerd@gnu.org>
parents:
30002
diff
changeset
|
848 EXPANSION is the expansion substring to be used this time. |
51c08e149a23
(dabbrev--last-case-pattern): Value is now
Gerd Moellmann <gerd@gnu.org>
parents:
30002
diff
changeset
|
849 RECORD-CASE-PATTERN, if non-nil, means set `dabbrev--last-case-pattern' |
51c08e149a23
(dabbrev--last-case-pattern): Value is now
Gerd Moellmann <gerd@gnu.org>
parents:
30002
diff
changeset
|
850 to record whether we upcased the expansion, downcased it, or did neither." |
10230
7396503653cf
Complete rewrite by Lars.Lindberg@sypro.cap.se.
Richard M. Stallman <rms@gnu.org>
parents:
5307
diff
changeset
|
851 ;;(undo-boundary) |
17711
3484851d83b9
(dabbrev-case-replace, dabbrev-case-fold-search):
Richard M. Stallman <rms@gnu.org>
parents:
17411
diff
changeset
|
852 (let ((use-case-replace (and (if (eq dabbrev-case-fold-search 'case-fold-search) |
3484851d83b9
(dabbrev-case-replace, dabbrev-case-fold-search):
Richard M. Stallman <rms@gnu.org>
parents:
17411
diff
changeset
|
853 case-fold-search |
3484851d83b9
(dabbrev-case-replace, dabbrev-case-fold-search):
Richard M. Stallman <rms@gnu.org>
parents:
17411
diff
changeset
|
854 dabbrev-case-fold-search) |
10230
7396503653cf
Complete rewrite by Lars.Lindberg@sypro.cap.se.
Richard M. Stallman <rms@gnu.org>
parents:
5307
diff
changeset
|
855 (or (not dabbrev-upcase-means-case-search) |
7396503653cf
Complete rewrite by Lars.Lindberg@sypro.cap.se.
Richard M. Stallman <rms@gnu.org>
parents:
5307
diff
changeset
|
856 (string= abbrev (downcase abbrev))) |
17711
3484851d83b9
(dabbrev-case-replace, dabbrev-case-fold-search):
Richard M. Stallman <rms@gnu.org>
parents:
17411
diff
changeset
|
857 (if (eq dabbrev-case-replace 'case-replace) |
3484851d83b9
(dabbrev-case-replace, dabbrev-case-fold-search):
Richard M. Stallman <rms@gnu.org>
parents:
17411
diff
changeset
|
858 case-replace |
3484851d83b9
(dabbrev-case-replace, dabbrev-case-fold-search):
Richard M. Stallman <rms@gnu.org>
parents:
17411
diff
changeset
|
859 dabbrev-case-replace)))) |
34596
51c08e149a23
(dabbrev--last-case-pattern): Value is now
Gerd Moellmann <gerd@gnu.org>
parents:
30002
diff
changeset
|
860 |
51c08e149a23
(dabbrev--last-case-pattern): Value is now
Gerd Moellmann <gerd@gnu.org>
parents:
30002
diff
changeset
|
861 ;; If we upcased or downcased the original expansion, |
51c08e149a23
(dabbrev--last-case-pattern): Value is now
Gerd Moellmann <gerd@gnu.org>
parents:
30002
diff
changeset
|
862 ;; do likewise for the subsequent words when we copy them. |
37497
b04b5ca14967
Add doc strings for some functions.
Richard M. Stallman <rms@gnu.org>
parents:
37487
diff
changeset
|
863 ;; Don't do any of the usual case processing, though. |
b04b5ca14967
Add doc strings for some functions.
Richard M. Stallman <rms@gnu.org>
parents:
37487
diff
changeset
|
864 (when (equal abbrev " ") |
b04b5ca14967
Add doc strings for some functions.
Richard M. Stallman <rms@gnu.org>
parents:
37487
diff
changeset
|
865 (if dabbrev--last-case-pattern |
b04b5ca14967
Add doc strings for some functions.
Richard M. Stallman <rms@gnu.org>
parents:
37487
diff
changeset
|
866 (setq expansion |
b04b5ca14967
Add doc strings for some functions.
Richard M. Stallman <rms@gnu.org>
parents:
37487
diff
changeset
|
867 (funcall dabbrev--last-case-pattern expansion))) |
b04b5ca14967
Add doc strings for some functions.
Richard M. Stallman <rms@gnu.org>
parents:
37487
diff
changeset
|
868 (setq use-case-replace nil)) |
34596
51c08e149a23
(dabbrev--last-case-pattern): Value is now
Gerd Moellmann <gerd@gnu.org>
parents:
30002
diff
changeset
|
869 |
17263
b712c50d2c84
(dabbrev--substitute-expansion):
Richard M. Stallman <rms@gnu.org>
parents:
15834
diff
changeset
|
870 ;; If the expansion has mixed case |
b712c50d2c84
(dabbrev--substitute-expansion):
Richard M. Stallman <rms@gnu.org>
parents:
15834
diff
changeset
|
871 ;; and it is not simply a capitalized word, |
b712c50d2c84
(dabbrev--substitute-expansion):
Richard M. Stallman <rms@gnu.org>
parents:
15834
diff
changeset
|
872 ;; or if the abbrev has mixed case, |
b712c50d2c84
(dabbrev--substitute-expansion):
Richard M. Stallman <rms@gnu.org>
parents:
15834
diff
changeset
|
873 ;; and if the given abbrev's case pattern |
15751
022815791330
(dabbrev--search): Don't downcase the result here.
Richard M. Stallman <rms@gnu.org>
parents:
15652
diff
changeset
|
874 ;; matches the start of the expansion, |
022815791330
(dabbrev--search): Don't downcase the result here.
Richard M. Stallman <rms@gnu.org>
parents:
15652
diff
changeset
|
875 ;; copy the expansion's case |
022815791330
(dabbrev--search): Don't downcase the result here.
Richard M. Stallman <rms@gnu.org>
parents:
15652
diff
changeset
|
876 ;; instead of downcasing all the rest. |
55051
f0f07a220562
(dabbrev--substitute-expansion): Fix a bug which lead
Richard M. Stallman <rms@gnu.org>
parents:
54578
diff
changeset
|
877 ;; |
f0f07a220562
(dabbrev--substitute-expansion): Fix a bug which lead
Richard M. Stallman <rms@gnu.org>
parents:
54578
diff
changeset
|
878 ;; Treat a one-capital-letter (possibly with preceding non-letter |
f0f07a220562
(dabbrev--substitute-expansion): Fix a bug which lead
Richard M. Stallman <rms@gnu.org>
parents:
54578
diff
changeset
|
879 ;; characters) abbrev as "not all upper case", so as to force |
f0f07a220562
(dabbrev--substitute-expansion): Fix a bug which lead
Richard M. Stallman <rms@gnu.org>
parents:
54578
diff
changeset
|
880 ;; preservation of the expansion's pattern if the expansion starts |
f0f07a220562
(dabbrev--substitute-expansion): Fix a bug which lead
Richard M. Stallman <rms@gnu.org>
parents:
54578
diff
changeset
|
881 ;; with a capital letter. |
f0f07a220562
(dabbrev--substitute-expansion): Fix a bug which lead
Richard M. Stallman <rms@gnu.org>
parents:
54578
diff
changeset
|
882 (let ((expansion-rest (substring expansion 1)) |
f0f07a220562
(dabbrev--substitute-expansion): Fix a bug which lead
Richard M. Stallman <rms@gnu.org>
parents:
54578
diff
changeset
|
883 (first-letter-position (string-match "[[:alpha:]]" abbrev))) |
f0f07a220562
(dabbrev--substitute-expansion): Fix a bug which lead
Richard M. Stallman <rms@gnu.org>
parents:
54578
diff
changeset
|
884 (if (or (null first-letter-position) |
f0f07a220562
(dabbrev--substitute-expansion): Fix a bug which lead
Richard M. Stallman <rms@gnu.org>
parents:
54578
diff
changeset
|
885 (and (not (and (or (string= expansion-rest (downcase expansion-rest)) |
f0f07a220562
(dabbrev--substitute-expansion): Fix a bug which lead
Richard M. Stallman <rms@gnu.org>
parents:
54578
diff
changeset
|
886 (string= expansion-rest (upcase expansion-rest))) |
f0f07a220562
(dabbrev--substitute-expansion): Fix a bug which lead
Richard M. Stallman <rms@gnu.org>
parents:
54578
diff
changeset
|
887 (or (string= abbrev (downcase abbrev)) |
f0f07a220562
(dabbrev--substitute-expansion): Fix a bug which lead
Richard M. Stallman <rms@gnu.org>
parents:
54578
diff
changeset
|
888 (and (string= abbrev (upcase abbrev)) |
f0f07a220562
(dabbrev--substitute-expansion): Fix a bug which lead
Richard M. Stallman <rms@gnu.org>
parents:
54578
diff
changeset
|
889 (> (- (length abbrev) first-letter-position) |
f0f07a220562
(dabbrev--substitute-expansion): Fix a bug which lead
Richard M. Stallman <rms@gnu.org>
parents:
54578
diff
changeset
|
890 1))))) |
f0f07a220562
(dabbrev--substitute-expansion): Fix a bug which lead
Richard M. Stallman <rms@gnu.org>
parents:
54578
diff
changeset
|
891 (string= abbrev |
f0f07a220562
(dabbrev--substitute-expansion): Fix a bug which lead
Richard M. Stallman <rms@gnu.org>
parents:
54578
diff
changeset
|
892 (substring expansion 0 (length abbrev))))) |
17263
b712c50d2c84
(dabbrev--substitute-expansion):
Richard M. Stallman <rms@gnu.org>
parents:
15834
diff
changeset
|
893 (setq use-case-replace nil))) |
37497
b04b5ca14967
Add doc strings for some functions.
Richard M. Stallman <rms@gnu.org>
parents:
37487
diff
changeset
|
894 |
b04b5ca14967
Add doc strings for some functions.
Richard M. Stallman <rms@gnu.org>
parents:
37487
diff
changeset
|
895 ;; If the abbrev and the expansion are both all-lower-case |
b04b5ca14967
Add doc strings for some functions.
Richard M. Stallman <rms@gnu.org>
parents:
37487
diff
changeset
|
896 ;; then don't do any conversion. The conversion would be a no-op |
b04b5ca14967
Add doc strings for some functions.
Richard M. Stallman <rms@gnu.org>
parents:
37487
diff
changeset
|
897 ;; for this replacement, but it would carry forward to subsequent words. |
55051
f0f07a220562
(dabbrev--substitute-expansion): Fix a bug which lead
Richard M. Stallman <rms@gnu.org>
parents:
54578
diff
changeset
|
898 ;; The goal of this is to prevent that carrying forward. |
37497
b04b5ca14967
Add doc strings for some functions.
Richard M. Stallman <rms@gnu.org>
parents:
37487
diff
changeset
|
899 (if (and (string= expansion (downcase expansion)) |
b04b5ca14967
Add doc strings for some functions.
Richard M. Stallman <rms@gnu.org>
parents:
37487
diff
changeset
|
900 (string= abbrev (downcase abbrev))) |
15812
63076f19cbc5
(dabbrev-expand): When snarfing consecutive words,
Richard M. Stallman <rms@gnu.org>
parents:
15789
diff
changeset
|
901 (setq use-case-replace nil)) |
37497
b04b5ca14967
Add doc strings for some functions.
Richard M. Stallman <rms@gnu.org>
parents:
37487
diff
changeset
|
902 |
15812
63076f19cbc5
(dabbrev-expand): When snarfing consecutive words,
Richard M. Stallman <rms@gnu.org>
parents:
15789
diff
changeset
|
903 (if use-case-replace |
63076f19cbc5
(dabbrev-expand): When snarfing consecutive words,
Richard M. Stallman <rms@gnu.org>
parents:
15789
diff
changeset
|
904 (setq expansion (downcase expansion))) |
34596
51c08e149a23
(dabbrev--last-case-pattern): Value is now
Gerd Moellmann <gerd@gnu.org>
parents:
30002
diff
changeset
|
905 |
51c08e149a23
(dabbrev--last-case-pattern): Value is now
Gerd Moellmann <gerd@gnu.org>
parents:
30002
diff
changeset
|
906 ;; In case we insert subsequent words, |
51c08e149a23
(dabbrev--last-case-pattern): Value is now
Gerd Moellmann <gerd@gnu.org>
parents:
30002
diff
changeset
|
907 ;; record if we upcased or downcased the first word, |
51c08e149a23
(dabbrev--last-case-pattern): Value is now
Gerd Moellmann <gerd@gnu.org>
parents:
30002
diff
changeset
|
908 ;; in order to do likewise for subsequent words. |
51c08e149a23
(dabbrev--last-case-pattern): Value is now
Gerd Moellmann <gerd@gnu.org>
parents:
30002
diff
changeset
|
909 (and record-case-pattern |
49588
37645a051842
Trailing whitespace deleted.
Juanma Barranquero <lekktu@gmail.com>
parents:
49067
diff
changeset
|
910 (setq dabbrev--last-case-pattern |
34596
51c08e149a23
(dabbrev--last-case-pattern): Value is now
Gerd Moellmann <gerd@gnu.org>
parents:
30002
diff
changeset
|
911 (and use-case-replace |
51c08e149a23
(dabbrev--last-case-pattern): Value is now
Gerd Moellmann <gerd@gnu.org>
parents:
30002
diff
changeset
|
912 (cond ((equal abbrev (upcase abbrev)) 'upcase) |
51c08e149a23
(dabbrev--last-case-pattern): Value is now
Gerd Moellmann <gerd@gnu.org>
parents:
30002
diff
changeset
|
913 ((equal abbrev (downcase abbrev)) 'downcase))))) |
51c08e149a23
(dabbrev--last-case-pattern): Value is now
Gerd Moellmann <gerd@gnu.org>
parents:
30002
diff
changeset
|
914 |
49067
c0e98fdf377f
(dabbrev--substitute-expansion):
Richard M. Stallman <rms@gnu.org>
parents:
46518
diff
changeset
|
915 ;; Convert whitespace to single spaces. |
37497
b04b5ca14967
Add doc strings for some functions.
Richard M. Stallman <rms@gnu.org>
parents:
37487
diff
changeset
|
916 (if dabbrev--eliminate-newlines |
49067
c0e98fdf377f
(dabbrev--substitute-expansion):
Richard M. Stallman <rms@gnu.org>
parents:
46518
diff
changeset
|
917 ;; Start searching at end of ABBREV so that any whitespace |
c0e98fdf377f
(dabbrev--substitute-expansion):
Richard M. Stallman <rms@gnu.org>
parents:
46518
diff
changeset
|
918 ;; carried over from the existing text is not changed. |
c0e98fdf377f
(dabbrev--substitute-expansion):
Richard M. Stallman <rms@gnu.org>
parents:
46518
diff
changeset
|
919 (let ((pos (length abbrev))) |
c0e98fdf377f
(dabbrev--substitute-expansion):
Richard M. Stallman <rms@gnu.org>
parents:
46518
diff
changeset
|
920 (while (string-match "[\n \t]+" expansion pos) |
c0e98fdf377f
(dabbrev--substitute-expansion):
Richard M. Stallman <rms@gnu.org>
parents:
46518
diff
changeset
|
921 (setq pos (1+ (match-beginning 0))) |
c0e98fdf377f
(dabbrev--substitute-expansion):
Richard M. Stallman <rms@gnu.org>
parents:
46518
diff
changeset
|
922 (setq expansion (replace-match " " nil nil expansion))))) |
37497
b04b5ca14967
Add doc strings for some functions.
Richard M. Stallman <rms@gnu.org>
parents:
37487
diff
changeset
|
923 |
10230
7396503653cf
Complete rewrite by Lars.Lindberg@sypro.cap.se.
Richard M. Stallman <rms@gnu.org>
parents:
5307
diff
changeset
|
924 (if old |
267 | 925 (save-excursion |
10230
7396503653cf
Complete rewrite by Lars.Lindberg@sypro.cap.se.
Richard M. Stallman <rms@gnu.org>
parents:
5307
diff
changeset
|
926 (search-backward old)) |
21153 | 927 ;;(set-match-data (list (point-marker) (point-marker))) |
37497
b04b5ca14967
Add doc strings for some functions.
Richard M. Stallman <rms@gnu.org>
parents:
37487
diff
changeset
|
928 (search-backward abbrev) |
b04b5ca14967
Add doc strings for some functions.
Richard M. Stallman <rms@gnu.org>
parents:
37487
diff
changeset
|
929 (search-forward abbrev)) |
b04b5ca14967
Add doc strings for some functions.
Richard M. Stallman <rms@gnu.org>
parents:
37487
diff
changeset
|
930 |
10230
7396503653cf
Complete rewrite by Lars.Lindberg@sypro.cap.se.
Richard M. Stallman <rms@gnu.org>
parents:
5307
diff
changeset
|
931 ;; Make case of replacement conform to case of abbreviation |
7396503653cf
Complete rewrite by Lars.Lindberg@sypro.cap.se.
Richard M. Stallman <rms@gnu.org>
parents:
5307
diff
changeset
|
932 ;; provided (1) that kind of thing is enabled in this buffer |
7396503653cf
Complete rewrite by Lars.Lindberg@sypro.cap.se.
Richard M. Stallman <rms@gnu.org>
parents:
5307
diff
changeset
|
933 ;; and (2) the replacement itself is all lower case. |
7396503653cf
Complete rewrite by Lars.Lindberg@sypro.cap.se.
Richard M. Stallman <rms@gnu.org>
parents:
5307
diff
changeset
|
934 (dabbrev--safe-replace-match expansion |
7396503653cf
Complete rewrite by Lars.Lindberg@sypro.cap.se.
Richard M. Stallman <rms@gnu.org>
parents:
5307
diff
changeset
|
935 (not use-case-replace) |
7396503653cf
Complete rewrite by Lars.Lindberg@sypro.cap.se.
Richard M. Stallman <rms@gnu.org>
parents:
5307
diff
changeset
|
936 t))) |
267 | 937 |
938 | |
10230
7396503653cf
Complete rewrite by Lars.Lindberg@sypro.cap.se.
Richard M. Stallman <rms@gnu.org>
parents:
5307
diff
changeset
|
939 ;;;---------------------------------------------------------------- |
7396503653cf
Complete rewrite by Lars.Lindberg@sypro.cap.se.
Richard M. Stallman <rms@gnu.org>
parents:
5307
diff
changeset
|
940 ;;; Search function used by dabbrevs library. |
267 | 941 |
942 | |
10230
7396503653cf
Complete rewrite by Lars.Lindberg@sypro.cap.se.
Richard M. Stallman <rms@gnu.org>
parents:
5307
diff
changeset
|
943 (defun dabbrev--search (abbrev reverse ignore-case) |
37497
b04b5ca14967
Add doc strings for some functions.
Richard M. Stallman <rms@gnu.org>
parents:
37487
diff
changeset
|
944 "Search for something that could be used to expand ABBREV. |
b04b5ca14967
Add doc strings for some functions.
Richard M. Stallman <rms@gnu.org>
parents:
37487
diff
changeset
|
945 |
b04b5ca14967
Add doc strings for some functions.
Richard M. Stallman <rms@gnu.org>
parents:
37487
diff
changeset
|
946 Second arg, REVERSE, is t for reverse search, nil for forward. |
b04b5ca14967
Add doc strings for some functions.
Richard M. Stallman <rms@gnu.org>
parents:
37487
diff
changeset
|
947 The variable `dabbrev-limit' controls the maximum search region size. |
b04b5ca14967
Add doc strings for some functions.
Richard M. Stallman <rms@gnu.org>
parents:
37487
diff
changeset
|
948 Third argument IGNORE-CASE non-nil means treat case as insignificant while |
b04b5ca14967
Add doc strings for some functions.
Richard M. Stallman <rms@gnu.org>
parents:
37487
diff
changeset
|
949 looking for a match and when comparing with previous matches. Also if |
b04b5ca14967
Add doc strings for some functions.
Richard M. Stallman <rms@gnu.org>
parents:
37487
diff
changeset
|
950 that's non-nil and the match is found at the beginning of a sentence |
b04b5ca14967
Add doc strings for some functions.
Richard M. Stallman <rms@gnu.org>
parents:
37487
diff
changeset
|
951 and is in lower case except for the initial then it is converted to |
b04b5ca14967
Add doc strings for some functions.
Richard M. Stallman <rms@gnu.org>
parents:
37487
diff
changeset
|
952 all lower case for return. |
b04b5ca14967
Add doc strings for some functions.
Richard M. Stallman <rms@gnu.org>
parents:
37487
diff
changeset
|
953 |
b04b5ca14967
Add doc strings for some functions.
Richard M. Stallman <rms@gnu.org>
parents:
37487
diff
changeset
|
954 Table of expansions already seen is examined in buffer |
b04b5ca14967
Add doc strings for some functions.
Richard M. Stallman <rms@gnu.org>
parents:
37487
diff
changeset
|
955 `dabbrev--last-table' so that only distinct possibilities are found |
b04b5ca14967
Add doc strings for some functions.
Richard M. Stallman <rms@gnu.org>
parents:
37487
diff
changeset
|
956 by dabbrev-re-expand. |
b04b5ca14967
Add doc strings for some functions.
Richard M. Stallman <rms@gnu.org>
parents:
37487
diff
changeset
|
957 |
b04b5ca14967
Add doc strings for some functions.
Richard M. Stallman <rms@gnu.org>
parents:
37487
diff
changeset
|
958 Returns the expansion found, or nil if not found. |
b04b5ca14967
Add doc strings for some functions.
Richard M. Stallman <rms@gnu.org>
parents:
37487
diff
changeset
|
959 Leaves point at the location of the start of the expansion." |
10230
7396503653cf
Complete rewrite by Lars.Lindberg@sypro.cap.se.
Richard M. Stallman <rms@gnu.org>
parents:
5307
diff
changeset
|
960 (save-match-data |
7396503653cf
Complete rewrite by Lars.Lindberg@sypro.cap.se.
Richard M. Stallman <rms@gnu.org>
parents:
5307
diff
changeset
|
961 (let ((pattern1 (concat (regexp-quote abbrev) |
7396503653cf
Complete rewrite by Lars.Lindberg@sypro.cap.se.
Richard M. Stallman <rms@gnu.org>
parents:
5307
diff
changeset
|
962 "\\(" dabbrev--abbrev-char-regexp "\\)")) |
7396503653cf
Complete rewrite by Lars.Lindberg@sypro.cap.se.
Richard M. Stallman <rms@gnu.org>
parents:
5307
diff
changeset
|
963 (pattern2 (concat (regexp-quote abbrev) |
7396503653cf
Complete rewrite by Lars.Lindberg@sypro.cap.se.
Richard M. Stallman <rms@gnu.org>
parents:
5307
diff
changeset
|
964 "\\(\\(" dabbrev--abbrev-char-regexp "\\)+\\)")) |
46518
c6ca69a1c8d3
(dabbrev--search): Use inhibit-point-motion-hooks.
Richard M. Stallman <rms@gnu.org>
parents:
45292
diff
changeset
|
965 ;; This makes it possible to find matches in minibuffer prompts |
c6ca69a1c8d3
(dabbrev--search): Use inhibit-point-motion-hooks.
Richard M. Stallman <rms@gnu.org>
parents:
45292
diff
changeset
|
966 ;; even when they are "inviolable". |
c6ca69a1c8d3
(dabbrev--search): Use inhibit-point-motion-hooks.
Richard M. Stallman <rms@gnu.org>
parents:
45292
diff
changeset
|
967 (inhibit-point-motion-hooks t) |
45292
e3ba76f78075
(dabbrev-case-distinction): New option.
Richard M. Stallman <rms@gnu.org>
parents:
43981
diff
changeset
|
968 found-string result) |
10230
7396503653cf
Complete rewrite by Lars.Lindberg@sypro.cap.se.
Richard M. Stallman <rms@gnu.org>
parents:
5307
diff
changeset
|
969 ;; Limited search. |
7396503653cf
Complete rewrite by Lars.Lindberg@sypro.cap.se.
Richard M. Stallman <rms@gnu.org>
parents:
5307
diff
changeset
|
970 (save-restriction |
7396503653cf
Complete rewrite by Lars.Lindberg@sypro.cap.se.
Richard M. Stallman <rms@gnu.org>
parents:
5307
diff
changeset
|
971 (and dabbrev-limit |
7396503653cf
Complete rewrite by Lars.Lindberg@sypro.cap.se.
Richard M. Stallman <rms@gnu.org>
parents:
5307
diff
changeset
|
972 (narrow-to-region dabbrev--last-expansion-location |
7396503653cf
Complete rewrite by Lars.Lindberg@sypro.cap.se.
Richard M. Stallman <rms@gnu.org>
parents:
5307
diff
changeset
|
973 (+ (point) |
7396503653cf
Complete rewrite by Lars.Lindberg@sypro.cap.se.
Richard M. Stallman <rms@gnu.org>
parents:
5307
diff
changeset
|
974 (if reverse (- dabbrev-limit) dabbrev-limit)))) |
7396503653cf
Complete rewrite by Lars.Lindberg@sypro.cap.se.
Richard M. Stallman <rms@gnu.org>
parents:
5307
diff
changeset
|
975 ;;-------------------------------- |
7396503653cf
Complete rewrite by Lars.Lindberg@sypro.cap.se.
Richard M. Stallman <rms@gnu.org>
parents:
5307
diff
changeset
|
976 ;; Look for a distinct expansion, using dabbrev--last-table. |
7396503653cf
Complete rewrite by Lars.Lindberg@sypro.cap.se.
Richard M. Stallman <rms@gnu.org>
parents:
5307
diff
changeset
|
977 ;;-------------------------------- |
7396503653cf
Complete rewrite by Lars.Lindberg@sypro.cap.se.
Richard M. Stallman <rms@gnu.org>
parents:
5307
diff
changeset
|
978 (while (and (not found-string) |
7396503653cf
Complete rewrite by Lars.Lindberg@sypro.cap.se.
Richard M. Stallman <rms@gnu.org>
parents:
5307
diff
changeset
|
979 (if reverse |
7396503653cf
Complete rewrite by Lars.Lindberg@sypro.cap.se.
Richard M. Stallman <rms@gnu.org>
parents:
5307
diff
changeset
|
980 (re-search-backward pattern1 nil t) |
7396503653cf
Complete rewrite by Lars.Lindberg@sypro.cap.se.
Richard M. Stallman <rms@gnu.org>
parents:
5307
diff
changeset
|
981 (re-search-forward pattern1 nil t))) |
12555
a2a2aa391773
(dabbrev--search): Don't let spurious match in middle
Karl Heuer <kwzh@gnu.org>
parents:
11976
diff
changeset
|
982 (goto-char (match-beginning 0)) |
a2a2aa391773
(dabbrev--search): Don't let spurious match in middle
Karl Heuer <kwzh@gnu.org>
parents:
11976
diff
changeset
|
983 ;; In case we matched in the middle of a word, |
a2a2aa391773
(dabbrev--search): Don't let spurious match in middle
Karl Heuer <kwzh@gnu.org>
parents:
11976
diff
changeset
|
984 ;; back up to start of word and verify we still match. |
a2a2aa391773
(dabbrev--search): Don't let spurious match in middle
Karl Heuer <kwzh@gnu.org>
parents:
11976
diff
changeset
|
985 (dabbrev--goto-start-of-abbrev) |
a2a2aa391773
(dabbrev--search): Don't let spurious match in middle
Karl Heuer <kwzh@gnu.org>
parents:
11976
diff
changeset
|
986 |
a2a2aa391773
(dabbrev--search): Don't let spurious match in middle
Karl Heuer <kwzh@gnu.org>
parents:
11976
diff
changeset
|
987 (if (not (looking-at pattern1)) |
a2a2aa391773
(dabbrev--search): Don't let spurious match in middle
Karl Heuer <kwzh@gnu.org>
parents:
11976
diff
changeset
|
988 nil |
a2a2aa391773
(dabbrev--search): Don't let spurious match in middle
Karl Heuer <kwzh@gnu.org>
parents:
11976
diff
changeset
|
989 ;; We have a truly valid match. Find the end. |
10230
7396503653cf
Complete rewrite by Lars.Lindberg@sypro.cap.se.
Richard M. Stallman <rms@gnu.org>
parents:
5307
diff
changeset
|
990 (re-search-forward pattern2) |
54578
9e27d826339c
(dabbrev-expand): Fix regexp construction.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
52401
diff
changeset
|
991 (setq found-string (match-string-no-properties 0)) |
45292
e3ba76f78075
(dabbrev-case-distinction): New option.
Richard M. Stallman <rms@gnu.org>
parents:
43981
diff
changeset
|
992 (setq result found-string) |
10230
7396503653cf
Complete rewrite by Lars.Lindberg@sypro.cap.se.
Richard M. Stallman <rms@gnu.org>
parents:
5307
diff
changeset
|
993 (and ignore-case (setq found-string (downcase found-string))) |
12555
a2a2aa391773
(dabbrev--search): Don't let spurious match in middle
Karl Heuer <kwzh@gnu.org>
parents:
11976
diff
changeset
|
994 ;; Ignore this match if it's already in the table. |
10231
e88ff4b30786
Don't require cl, picture, or reporter.
Richard M. Stallman <rms@gnu.org>
parents:
10230
diff
changeset
|
995 (if (dabbrev-filter-elements |
e88ff4b30786
Don't require cl, picture, or reporter.
Richard M. Stallman <rms@gnu.org>
parents:
10230
diff
changeset
|
996 table-string dabbrev--last-table |
e88ff4b30786
Don't require cl, picture, or reporter.
Richard M. Stallman <rms@gnu.org>
parents:
10230
diff
changeset
|
997 (string= found-string table-string)) |
12555
a2a2aa391773
(dabbrev--search): Don't let spurious match in middle
Karl Heuer <kwzh@gnu.org>
parents:
11976
diff
changeset
|
998 (setq found-string nil))) |
a2a2aa391773
(dabbrev--search): Don't let spurious match in middle
Karl Heuer <kwzh@gnu.org>
parents:
11976
diff
changeset
|
999 ;; Prepare to continue searching. |
54578
9e27d826339c
(dabbrev-expand): Fix regexp construction.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
52401
diff
changeset
|
1000 (goto-char (if reverse (match-beginning 0) (match-end 0)))) |
12555
a2a2aa391773
(dabbrev--search): Don't let spurious match in middle
Karl Heuer <kwzh@gnu.org>
parents:
11976
diff
changeset
|
1001 ;; If we found something, use it. |
45292
e3ba76f78075
(dabbrev-case-distinction): New option.
Richard M. Stallman <rms@gnu.org>
parents:
43981
diff
changeset
|
1002 (when found-string |
e3ba76f78075
(dabbrev-case-distinction): New option.
Richard M. Stallman <rms@gnu.org>
parents:
43981
diff
changeset
|
1003 ;; Put it into `dabbrev--last-table' |
e3ba76f78075
(dabbrev-case-distinction): New option.
Richard M. Stallman <rms@gnu.org>
parents:
43981
diff
changeset
|
1004 ;; and return it (either downcased, or as is). |
e3ba76f78075
(dabbrev-case-distinction): New option.
Richard M. Stallman <rms@gnu.org>
parents:
43981
diff
changeset
|
1005 (setq dabbrev--last-table |
e3ba76f78075
(dabbrev-case-distinction): New option.
Richard M. Stallman <rms@gnu.org>
parents:
43981
diff
changeset
|
1006 (cons found-string dabbrev--last-table)) |
e3ba76f78075
(dabbrev-case-distinction): New option.
Richard M. Stallman <rms@gnu.org>
parents:
43981
diff
changeset
|
1007 result))))) |
267 | 1008 |
29077 | 1009 (dolist (mess '("^No dynamic expansion for .* found$" |
1010 "^No further dynamic expansion for .* found$" | |
1011 "^No possible abbreviation preceding point$")) | |
1012 (add-to-list 'debug-ignored-errors mess)) | |
1013 | |
10230
7396503653cf
Complete rewrite by Lars.Lindberg@sypro.cap.se.
Richard M. Stallman <rms@gnu.org>
parents:
5307
diff
changeset
|
1014 (provide 'dabbrev) |
10231
e88ff4b30786
Don't require cl, picture, or reporter.
Richard M. Stallman <rms@gnu.org>
parents:
10230
diff
changeset
|
1015 |
52401 | 1016 ;;; arch-tag: 29e58596-f080-4306-a409-70296cf9d46f |
14169 | 1017 ;;; dabbrev.el ends here |