annotate lisp/hippie-exp.el @ 110410:f2e111723c3a

Merge changes made in Gnus trunk. Reimplement nnimap, and do tweaks to the rest of the code to support that. * gnus-int.el (gnus-finish-retrieve-group-infos) (gnus-retrieve-group-data-early): New functions. * gnus-range.el (gnus-range-nconcat): New function. * gnus-start.el (gnus-get-unread-articles): Support early retrieval of data. (gnus-read-active-for-groups): Support finishing the early retrieval of data. * gnus-sum.el (gnus-summary-move-article): Pass the move-to group name if the move is internal, so that nnimap can do fast internal moves. * gnus.el (gnus-article-special-mark-lists): Add uid/active tuples, for nnimap usage. * nnimap.el: Rewritten. * nnmail.el (nnmail-inhibit-default-split-group): New internal variable to allow the mail splitting to not return a default group. This is useful for nnimap, which will leave unmatched mail in the inbox. * utf7.el (utf7-encode): Autoload. Implement shell connection. * nnimap.el (nnimap-open-shell-stream): New function. (nnimap-open-connection): Use it. Get the number of lines by using BODYSTRUCTURE. (nnimap-transform-headers): Get the number of lines in each message. (nnimap-retrieve-headers): Query for BODYSTRUCTURE so that we get the number of lines. Not all servers return UIDNEXT. Work past this problem. Remove junk from end of file. Fix typo in "bogus" section. Make capabilties be case-insensitive. Require cl when compiling. Don't bug out if the LIST command doesn't have any parameters. 2010-09-17 Knut Anders Hatlen <kahatlen@gmail.com> (tiny change) * nnimap.el (nnimap-get-groups): Don't bug out if the LIST command doesn't have any parameters. (mm-text-html-renderer): Document gnus-article-html. 2010-09-17 Julien Danjou <julien@danjou.info> (tiny fix) * mm-decode.el (mm-text-html-renderer): Document gnus-article-html. * dgnushack.el: Define netrc-credentials. If the user doesn't have a /etc/services, supply some sensible port defaults. Have `unseen-or-unread' select an unread unseen article first. (nntp-open-server): Return whether the open was successful or not. Throughout all files, replace (save-excursion (set-buffer ...)) with (with-current-buffer ... ). Save result so that it doesn't say "failed" all the time. Add ~/.authinfo to the default, since that's probably most useful for users. Don't use the "finish" method when we're reading from the agent. Add some more nnimap-relevant agent stuff to nnagent.el. * nnimap.el (nnimap-with-process-buffer): Removed. Revert one line that was changed by mistake in the last checkin. (nnimap-open-connection): Don't error out when we can't make a connection nnimap-related changes to avoid bugging out if we can't contact a server. * gnus-start.el (gnus-get-unread-articles): Don't try to scan groups from methods that are denied. * nnimap.el (nnimap-possibly-change-group): Return nil if we can't log in. (nnimap-finish-retrieve-group-infos): Make sure we're not waiting for nothing. * gnus-sum.el (gnus-select-newsgroup): Indent.
author Katsumi Yamaoka <yamaoka@jpl.org>
date Sat, 18 Sep 2010 10:02:19 +0000
parents 1d1d5d9bd884
children 56b71cddc9c5 376148b31b5e
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
38436
b174db545cfd Some fixes to follow coding conventions.
Pavel Janík <Pavel@Janik.cz>
parents: 30645
diff changeset
1 ;;; hippie-exp.el --- expand text trying various ways to find its expansion
2230
6314334d7c2b Add standard library headers.
Eric S. Raymond <esr@snark.thyrsus.com>
parents: 1737
diff changeset
2
104552
10c38084881d Remove code for defunct system-types emx, macos, mswindows,
Glenn Morris <rgm@gnu.org>
parents: 100908
diff changeset
3 ;; Copyright (C) 1992, 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008,
106815
1d1d5d9bd884 Add 2010 to copyright years.
Glenn Morris <rgm@gnu.org>
parents: 106377
diff changeset
4 ;; 2009, 2010 Free Software Foundation, Inc.
14169
83f275dcd93a Update FSF's address.
Erik Naggum <erik@naggum.no>
parents: 13225
diff changeset
5
2230
6314334d7c2b Add standard library headers.
Eric S. Raymond <esr@snark.thyrsus.com>
parents: 1737
diff changeset
6 ;; Author: Anders Holst <aho@sans.kth.se>
21131
e4acb217b4af (hippie-expand-dabbrev-skip-space): Renamed `he-dabbrev-skip-space'.
Richard M. Stallman <rms@gnu.org>
parents: 18584
diff changeset
7 ;; Last change: 3 March 1998
e4acb217b4af (hippie-expand-dabbrev-skip-space): Renamed `he-dabbrev-skip-space'.
Richard M. Stallman <rms@gnu.org>
parents: 18584
diff changeset
8 ;; Version: 1.6
22250
a77d473867b8 *** empty log message ***
Dan Nicolaescu <done@ece.arizona.edu>
parents: 21131
diff changeset
9 ;; Keywords: abbrev convenience
2230
6314334d7c2b Add standard library headers.
Eric S. Raymond <esr@snark.thyrsus.com>
parents: 1737
diff changeset
10
1737
d7e9186edefa entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
11 ;; This file is part of GNU Emacs.
d7e9186edefa entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
12
94678
ee5932bf781d Switch to recommended form of GPLv3 permissions notice.
Glenn Morris <rgm@gnu.org>
parents: 93975
diff changeset
13 ;; GNU Emacs is free software: you can redistribute it and/or modify
1737
d7e9186edefa entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
14 ;; it under the terms of the GNU General Public License as published by
94678
ee5932bf781d Switch to recommended form of GPLv3 permissions notice.
Glenn Morris <rgm@gnu.org>
parents: 93975
diff changeset
15 ;; the Free Software Foundation, either version 3 of the License, or
ee5932bf781d Switch to recommended form of GPLv3 permissions notice.
Glenn Morris <rgm@gnu.org>
parents: 93975
diff changeset
16 ;; (at your option) any later version.
1737
d7e9186edefa entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
17
d7e9186edefa entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
18 ;; GNU Emacs is distributed in the hope that it will be useful,
d7e9186edefa entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
19 ;; but WITHOUT ANY WARRANTY; without even the implied warranty of
d7e9186edefa entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
20 ;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
d7e9186edefa entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
21 ;; GNU General Public License for more details.
d7e9186edefa entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
22
d7e9186edefa entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
23 ;; You should have received a copy of the GNU General Public License
94678
ee5932bf781d Switch to recommended form of GPLv3 permissions notice.
Glenn Morris <rgm@gnu.org>
parents: 93975
diff changeset
24 ;; along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>.
1737
d7e9186edefa entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
25
2233
fb0ed5a1d0f3 Add standard library headers.
Eric S. Raymond <esr@snark.thyrsus.com>
parents: 2230
diff changeset
26 ;;; Commentary:
14169
83f275dcd93a Update FSF's address.
Erik Naggum <erik@naggum.no>
parents: 13225
diff changeset
27
1737
d7e9186edefa entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
28 ;; `hippie-expand' is a single function for a lot of different kinds
d7e9186edefa entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
29 ;; of completions and expansions. Called repeatedly it tries all
49549
99be3a1e2589 Cygwin support patch.
Juanma Barranquero <lekktu@gmail.com>
parents: 42205
diff changeset
30 ;; possible completions in succession.
1737
d7e9186edefa entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
31 ;; Which kinds of completions to try, and in which order, is
d7e9186edefa entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
32 ;; determined by the contents of `hippie-expand-try-functions-list'.
d7e9186edefa entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
33 ;; Much customization of `hippie-expand' can be made by changing the
d7e9186edefa entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
34 ;; order of, removing, or inserting new functions in this list.
d7e9186edefa entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
35 ;; Given a positive numeric argument, `hippie-expand' jumps directly
d7e9186edefa entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
36 ;; ARG functions forward in this list. Given some other argument
d7e9186edefa entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
37 ;; (a negative argument or just Ctrl-U) it undoes the tried
d7e9186edefa entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
38 ;; completion.
5296
81b21ef5290d (;; Keywords:): Changed to "abbrev".
Richard M. Stallman <rms@gnu.org>
parents: 4130
diff changeset
39 ;;
1737
d7e9186edefa entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
40 ;; If the variable `hippie-expand-verbose' is non-nil, `hippie-expand'
d7e9186edefa entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
41 ;; outputs in a message which try-function in the list that is used
d7e9186edefa entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
42 ;; currently (ie. was used currently and will be tried first the next
d7e9186edefa entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
43 ;; time).
4130
e5aee6a3bb75 * hippie-exp.el: Renamed from hippie.el.
Jim Blandy <jimb@redhat.com>
parents: 2233
diff changeset
44 ;; The variable `hippie-expand-max-buffers' determines in how many
e5aee6a3bb75 * hippie-exp.el: Renamed from hippie.el.
Jim Blandy <jimb@redhat.com>
parents: 2233
diff changeset
45 ;; buffers, apart from the current, to search for expansions in. It
e5aee6a3bb75 * hippie-exp.el: Renamed from hippie.el.
Jim Blandy <jimb@redhat.com>
parents: 2233
diff changeset
46 ;; is used by the try-functions named "-all-buffers".
5296
81b21ef5290d (;; Keywords:): Changed to "abbrev".
Richard M. Stallman <rms@gnu.org>
parents: 4130
diff changeset
47 ;; The variable `hippie-expand-ignore-buffers' is a list of regexps
81b21ef5290d (;; Keywords:): Changed to "abbrev".
Richard M. Stallman <rms@gnu.org>
parents: 4130
diff changeset
48 ;; matching buffer names (as strings) or major modes (as atoms) of
81b21ef5290d (;; Keywords:): Changed to "abbrev".
Richard M. Stallman <rms@gnu.org>
parents: 4130
diff changeset
49 ;; buffers that should not be searched by the try-functions named
81b21ef5290d (;; Keywords:): Changed to "abbrev".
Richard M. Stallman <rms@gnu.org>
parents: 4130
diff changeset
50 ;; "-all-buffers".
21131
e4acb217b4af (hippie-expand-dabbrev-skip-space): Renamed `he-dabbrev-skip-space'.
Richard M. Stallman <rms@gnu.org>
parents: 18584
diff changeset
51 ;; If set, the variable `hippie-expand-only-buffers' does the opposite
e4acb217b4af (hippie-expand-dabbrev-skip-space): Renamed `he-dabbrev-skip-space'.
Richard M. Stallman <rms@gnu.org>
parents: 18584
diff changeset
52 ;; of `hippie-expand-ignore-buffers', in that the search is restricted
e4acb217b4af (hippie-expand-dabbrev-skip-space): Renamed `he-dabbrev-skip-space'.
Richard M. Stallman <rms@gnu.org>
parents: 18584
diff changeset
53 ;; to only the kind of buffers listed.
e4acb217b4af (hippie-expand-dabbrev-skip-space): Renamed `he-dabbrev-skip-space'.
Richard M. Stallman <rms@gnu.org>
parents: 18584
diff changeset
54 ;; If the variable `hippie-expand-no-restriction' is non-nil, narrowed
e4acb217b4af (hippie-expand-dabbrev-skip-space): Renamed `he-dabbrev-skip-space'.
Richard M. Stallman <rms@gnu.org>
parents: 18584
diff changeset
55 ;; buffers are widened before they are searched.
e4acb217b4af (hippie-expand-dabbrev-skip-space): Renamed `he-dabbrev-skip-space'.
Richard M. Stallman <rms@gnu.org>
parents: 18584
diff changeset
56 ;; The variable `hippie-expand-dabbrev-skip-space' controls whether
e4acb217b4af (hippie-expand-dabbrev-skip-space): Renamed `he-dabbrev-skip-space'.
Richard M. Stallman <rms@gnu.org>
parents: 18584
diff changeset
57 ;; trailing spaces will be included in the abbreviation to search for,
e4acb217b4af (hippie-expand-dabbrev-skip-space): Renamed `he-dabbrev-skip-space'.
Richard M. Stallman <rms@gnu.org>
parents: 18584
diff changeset
58 ;; which then gives the same behavior as the original `dabbrev-expand'.
e4acb217b4af (hippie-expand-dabbrev-skip-space): Renamed `he-dabbrev-skip-space'.
Richard M. Stallman <rms@gnu.org>
parents: 18584
diff changeset
59 ;; The variable `hippie-expand-dabbrev-as-symbol' controls whether
e4acb217b4af (hippie-expand-dabbrev-skip-space): Renamed `he-dabbrev-skip-space'.
Richard M. Stallman <rms@gnu.org>
parents: 18584
diff changeset
60 ;; characters of syntax '_' is considered part of the words to expand
e4acb217b4af (hippie-expand-dabbrev-skip-space): Renamed `he-dabbrev-skip-space'.
Richard M. Stallman <rms@gnu.org>
parents: 18584
diff changeset
61 ;; dynamically.
1737
d7e9186edefa entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
62 ;; See also the macro `make-hippie-expand-function' below.
49549
99be3a1e2589 Cygwin support patch.
Juanma Barranquero <lekktu@gmail.com>
parents: 42205
diff changeset
63 ;;
1737
d7e9186edefa entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
64 ;; A short description of the current try-functions in this file:
d7e9186edefa entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
65 ;; `try-complete-file-name' : very convenient to have in any buffer,
d7e9186edefa entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
66 ;; and not just in the minibuffer or (some) shell-mode. It goes
d7e9186edefa entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
67 ;; through all possible completions instead of just completing as
d7e9186edefa entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
68 ;; much as is unique.
d7e9186edefa entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
69 ;; `try-complete-file-name-partially' : To insert in the list just
d7e9186edefa entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
70 ;; before `try-complete-file-name' for those who want first to get
d7e9186edefa entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
71 ;; a file name completed only as many characters as is unique.
d7e9186edefa entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
72 ;; `try-expand-all-abbrevs' : can be removed if you don't use abbrevs.
d7e9186edefa entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
73 ;; Otherwise it looks through all abbrev-tables, starting with
49549
99be3a1e2589 Cygwin support patch.
Juanma Barranquero <lekktu@gmail.com>
parents: 42205
diff changeset
74 ;; the local followed by the global.
99be3a1e2589 Cygwin support patch.
Juanma Barranquero <lekktu@gmail.com>
parents: 42205
diff changeset
75 ;; `try-expand-line' : Searches the buffer for an entire line that
99be3a1e2589 Cygwin support patch.
Juanma Barranquero <lekktu@gmail.com>
parents: 42205
diff changeset
76 ;; begins exactly as the current line. Convenient sometimes, for
1737
d7e9186edefa entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
77 ;; example as a substitute for (or complement to) the history
4130
e5aee6a3bb75 * hippie-exp.el: Renamed from hippie.el.
Jim Blandy <jimb@redhat.com>
parents: 2233
diff changeset
78 ;; list in shell-like buffers. At other times, only confusing.
1737
d7e9186edefa entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
79 ;; `try-expand-line-all-buffers' : Like `try-expand-line' but searches
d7e9186edefa entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
80 ;; in all buffers (except the current). (This may be a little
4130
e5aee6a3bb75 * hippie-exp.el: Renamed from hippie.el.
Jim Blandy <jimb@redhat.com>
parents: 2233
diff changeset
81 ;; slow, don't use it unless you are really fond of `hippie-expand'.)
e5aee6a3bb75 * hippie-exp.el: Renamed from hippie.el.
Jim Blandy <jimb@redhat.com>
parents: 2233
diff changeset
82 ;; `try-expand-list' : Tries to expand the text back to the nearest
106377
10ceddf3698e (try-expand-dabbrev-visible): Preserve point in the
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 105994
diff changeset
83 ;; open delimiter, to a whole list from the buffer. Convenient for
10ceddf3698e (try-expand-dabbrev-visible): Preserve point in the
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 105994
diff changeset
84 ;; example when writing Lisp or TeX.
49549
99be3a1e2589 Cygwin support patch.
Juanma Barranquero <lekktu@gmail.com>
parents: 42205
diff changeset
85 ;; `try-expand-list-all-buffers' : Like `try-expand-list' but searches
99be3a1e2589 Cygwin support patch.
Juanma Barranquero <lekktu@gmail.com>
parents: 42205
diff changeset
86 ;; in all buffers (except the current).
1737
d7e9186edefa entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
87 ;; `try-expand-dabbrev' : works exactly as dabbrev-expand (but of
d7e9186edefa entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
88 ;; course in a way compatible with the other try-functions).
d7e9186edefa entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
89 ;; `try-expand-dabbrev-all-buffers' : perhaps the most useful of them,
d7e9186edefa entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
90 ;; like `dabbrev-expand' but searches all Emacs buffers (except the
d7e9186edefa entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
91 ;; current) for matching words. (No, I don't find this one
49549
99be3a1e2589 Cygwin support patch.
Juanma Barranquero <lekktu@gmail.com>
parents: 42205
diff changeset
92 ;; particularly slow.)
13207
2b541cc4cd97 (hippie-expand): Removed bug - don't undo from another buffer.
Richard M. Stallman <rms@gnu.org>
parents: 7639
diff changeset
93 ;; `try-expand-dabbrev-visible': Searches the currently visible parts of
2b541cc4cd97 (hippie-expand): Removed bug - don't undo from another buffer.
Richard M. Stallman <rms@gnu.org>
parents: 7639
diff changeset
94 ;; all windows. Can be put before `try-expand-dabbrev-all-buffers' to
2b541cc4cd97 (hippie-expand): Removed bug - don't undo from another buffer.
Richard M. Stallman <rms@gnu.org>
parents: 7639
diff changeset
95 ;; first try the expansions you can see.
2b541cc4cd97 (hippie-expand): Removed bug - don't undo from another buffer.
Richard M. Stallman <rms@gnu.org>
parents: 7639
diff changeset
96 ;; `try-expand-dabbrev-from-kill': Searches the kill ring for a suitable
2b541cc4cd97 (hippie-expand): Removed bug - don't undo from another buffer.
Richard M. Stallman <rms@gnu.org>
parents: 7639
diff changeset
97 ;; completion of the word. Good to have, just in case the word was not
2b541cc4cd97 (hippie-expand): Removed bug - don't undo from another buffer.
Richard M. Stallman <rms@gnu.org>
parents: 7639
diff changeset
98 ;; found elsewhere.
2b541cc4cd97 (hippie-expand): Removed bug - don't undo from another buffer.
Richard M. Stallman <rms@gnu.org>
parents: 7639
diff changeset
99 ;; `try-expand-whole-kill' : Tries to complete text with a whole entry
2b541cc4cd97 (hippie-expand): Removed bug - don't undo from another buffer.
Richard M. Stallman <rms@gnu.org>
parents: 7639
diff changeset
100 ;; from the kill ring. May be good if you don't know how far up in
2b541cc4cd97 (hippie-expand): Removed bug - don't undo from another buffer.
Richard M. Stallman <rms@gnu.org>
parents: 7639
diff changeset
101 ;; the kill-ring the required entry is, and don't want to mess with
2b541cc4cd97 (hippie-expand): Removed bug - don't undo from another buffer.
Richard M. Stallman <rms@gnu.org>
parents: 7639
diff changeset
102 ;; "Choose Next Paste".
1737
d7e9186edefa entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
103 ;; `try-complete-lisp-symbol' : like `lisp-complete-symbol', but goes
d7e9186edefa entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
104 ;; through all possibilities instead of completing what is unique.
d7e9186edefa entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
105 ;; Might be tedious (usually a lot of possible completions) and
d7e9186edefa entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
106 ;; since its function is much like `lisp-complete-symbol', which
d7e9186edefa entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
107 ;; already has a key of its own, you might want to remove this.
d7e9186edefa entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
108 ;; `try-complete-lisp-symbol-partially' : To insert in the list just
d7e9186edefa entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
109 ;; before `try-complete-lisp-symbol' for those who first want to get
49549
99be3a1e2589 Cygwin support patch.
Juanma Barranquero <lekktu@gmail.com>
parents: 42205
diff changeset
110 ;; completion of what is unique in the name.
4130
e5aee6a3bb75 * hippie-exp.el: Renamed from hippie.el.
Jim Blandy <jimb@redhat.com>
parents: 2233
diff changeset
111 ;;
e5aee6a3bb75 * hippie-exp.el: Renamed from hippie.el.
Jim Blandy <jimb@redhat.com>
parents: 2233
diff changeset
112 ;; Not all of the above functions are by default in
e5aee6a3bb75 * hippie-exp.el: Renamed from hippie.el.
Jim Blandy <jimb@redhat.com>
parents: 2233
diff changeset
113 ;; `hippie-expand-try-functions-list'. This variable is better set
e5aee6a3bb75 * hippie-exp.el: Renamed from hippie.el.
Jim Blandy <jimb@redhat.com>
parents: 2233
diff changeset
114 ;; in ".emacs" to make `hippie-expand' behave maximally convenient
e5aee6a3bb75 * hippie-exp.el: Renamed from hippie.el.
Jim Blandy <jimb@redhat.com>
parents: 2233
diff changeset
115 ;; according to personal taste. Also, instead of loading the
e5aee6a3bb75 * hippie-exp.el: Renamed from hippie.el.
Jim Blandy <jimb@redhat.com>
parents: 2233
diff changeset
116 ;; variable with all kinds of try-functions above, it might be an
e5aee6a3bb75 * hippie-exp.el: Renamed from hippie.el.
Jim Blandy <jimb@redhat.com>
parents: 2233
diff changeset
117 ;; idea to use `make-hippie-expand-function' to construct different
e5aee6a3bb75 * hippie-exp.el: Renamed from hippie.el.
Jim Blandy <jimb@redhat.com>
parents: 2233
diff changeset
118 ;; `hippie-expand'-like functions, with different try-lists and bound
106377
10ceddf3698e (try-expand-dabbrev-visible): Preserve point in the
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 105994
diff changeset
119 ;; to different keys. It is also possible to make
4130
e5aee6a3bb75 * hippie-exp.el: Renamed from hippie.el.
Jim Blandy <jimb@redhat.com>
parents: 2233
diff changeset
120 ;; `hippie-expand-try-functions-list' a buffer local variable, and
e5aee6a3bb75 * hippie-exp.el: Renamed from hippie.el.
Jim Blandy <jimb@redhat.com>
parents: 2233
diff changeset
121 ;; let it depend on the mode (by setting it in the mode-hooks).
1737
d7e9186edefa entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
122 ;;
d7e9186edefa entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
123 ;; To write new try-functions, consider the following:
d7e9186edefa entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
124 ;; Each try-function takes one argument OLD which is nil the first
d7e9186edefa entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
125 ;; time the function is called and true in succeeding calls for the
d7e9186edefa entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
126 ;; same string to complete. The first time the function has to
d7e9186edefa entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
127 ;; extract the string before point to complete, and substitute the
d7e9186edefa entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
128 ;; first completion alternative for it. On following calls it has to
d7e9186edefa entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
129 ;; substitute the next possible completion for the last tried string.
d7e9186edefa entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
130 ;; The try-function is to return t as long as it finds new
d7e9186edefa entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
131 ;; possible completions. When there are no more alternatives it has
d7e9186edefa entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
132 ;; to restore the text before point to its original contents, and
d7e9186edefa entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
133 ;; return nil (don't beep or message or anything).
d7e9186edefa entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
134 ;; The try-function can (should) use the following functions:
d7e9186edefa entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
135 ;; `he-init-string' : Initializes the text to substitute to the
d7e9186edefa entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
136 ;; contents of the region BEGIN to END. Also sets the variable
d7e9186edefa entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
137 ;; `he-search-string' to the text to expand.
d7e9186edefa entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
138 ;; `he-substitute-string' : substitutes STR into the region
d7e9186edefa entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
139 ;; initialized with `he-init-string'. (An optional second argument
d7e9186edefa entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
140 ;; TRANS-CASE non-nil, means transfer of case from the abbreviation
d7e9186edefa entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
141 ;; to the expansion is ok if that is enabled in the buffer.)
d7e9186edefa entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
142 ;; `he-reset-string' : Resets the initialized region to its original
d7e9186edefa entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
143 ;; contents.
d7e9186edefa entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
144 ;; There is also a variable: `he-tried-table' which is meant to contain
49549
99be3a1e2589 Cygwin support patch.
Juanma Barranquero <lekktu@gmail.com>
parents: 42205
diff changeset
145 ;; all tried expansions so far. The try-function can check this
1737
d7e9186edefa entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
146 ;; variable to see whether an expansion has already been tried
13207
2b541cc4cd97 (hippie-expand): Removed bug - don't undo from another buffer.
Richard M. Stallman <rms@gnu.org>
parents: 7639
diff changeset
147 ;; (hint: `he-string-member').
1737
d7e9186edefa entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
148 ;;
4130
e5aee6a3bb75 * hippie-exp.el: Renamed from hippie.el.
Jim Blandy <jimb@redhat.com>
parents: 2233
diff changeset
149 ;; Known bugs
1737
d7e9186edefa entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
150 ;;
d7e9186edefa entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
151 ;; It may happen that some completion suggestion occurs twice, in
49549
99be3a1e2589 Cygwin support patch.
Juanma Barranquero <lekktu@gmail.com>
parents: 42205
diff changeset
152 ;; spite of the use of `he-tried-table' to prevent that. This is
1737
d7e9186edefa entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
153 ;; because different try-functions may try to complete different
d7e9186edefa entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
154 ;; lengths of text, and thus put different amounts of the
13207
2b541cc4cd97 (hippie-expand): Removed bug - don't undo from another buffer.
Richard M. Stallman <rms@gnu.org>
parents: 7639
diff changeset
155 ;; text in `he-tried-table'. Anyway this seems to occur seldom enough
2b541cc4cd97 (hippie-expand): Removed bug - don't undo from another buffer.
Richard M. Stallman <rms@gnu.org>
parents: 7639
diff changeset
156 ;; not to be too disturbing. Also it should NOT be possible for the
1737
d7e9186edefa entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
157 ;; opposite situation to occur, that `hippie-expand' misses some
d7e9186edefa entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
158 ;; suggestion because it thinks it has already tried it.
d7e9186edefa entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
159 ;;
4130
e5aee6a3bb75 * hippie-exp.el: Renamed from hippie.el.
Jim Blandy <jimb@redhat.com>
parents: 2233
diff changeset
160 ;; Acknowledgement
1737
d7e9186edefa entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
161 ;;
d7e9186edefa entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
162 ;; I want to thank Mikael Djurfeldt in discussions with whom the idea
d7e9186edefa entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
163 ;; of this function took form.
d7e9186edefa entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
164 ;; I am also grateful to all those who have given me suggestions on
13207
2b541cc4cd97 (hippie-expand): Removed bug - don't undo from another buffer.
Richard M. Stallman <rms@gnu.org>
parents: 7639
diff changeset
165 ;; how to improve it, and all those who helped to find and remove bugs.
1737
d7e9186edefa entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
166 ;;
d7e9186edefa entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
167
2233
fb0ed5a1d0f3 Add standard library headers.
Eric S. Raymond <esr@snark.thyrsus.com>
parents: 2230
diff changeset
168 ;;; Code:
1737
d7e9186edefa entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
169
100808
550d3029fe3b Require comint.
Chong Yidong <cyd@stupidchicken.com>
parents: 100171
diff changeset
170 (require 'comint)
26599
e10a1d0deb4b Require comint when compiling.
Dave Love <fx@gnu.org>
parents: 26449
diff changeset
171
17634
247c2a11843d Use defgroup and defcustom.
Richard M. Stallman <rms@gnu.org>
parents: 16590
diff changeset
172 (defgroup hippie-expand nil
247c2a11843d Use defgroup and defcustom.
Richard M. Stallman <rms@gnu.org>
parents: 16590
diff changeset
173 "Expand text trying various ways to find its expansion."
26599
e10a1d0deb4b Require comint when compiling.
Dave Love <fx@gnu.org>
parents: 26449
diff changeset
174 :link '(custom-manual "(autotype)Hippie Expand")
e10a1d0deb4b Require comint when compiling.
Dave Love <fx@gnu.org>
parents: 26449
diff changeset
175 :link '(emacs-commentary-link "hippie-exp")
22250
a77d473867b8 *** empty log message ***
Dan Nicolaescu <done@ece.arizona.edu>
parents: 21131
diff changeset
176 :group 'abbrev
a77d473867b8 *** empty log message ***
Dan Nicolaescu <done@ece.arizona.edu>
parents: 21131
diff changeset
177 :group 'convenience)
17634
247c2a11843d Use defgroup and defcustom.
Richard M. Stallman <rms@gnu.org>
parents: 16590
diff changeset
178
1737
d7e9186edefa entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
179 (defvar he-num -1)
d7e9186edefa entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
180
4130
e5aee6a3bb75 * hippie-exp.el: Renamed from hippie.el.
Jim Blandy <jimb@redhat.com>
parents: 2233
diff changeset
181 (defvar he-string-beg (make-marker))
1737
d7e9186edefa entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
182
4130
e5aee6a3bb75 * hippie-exp.el: Renamed from hippie.el.
Jim Blandy <jimb@redhat.com>
parents: 2233
diff changeset
183 (defvar he-string-end (make-marker))
1737
d7e9186edefa entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
184
d7e9186edefa entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
185 (defvar he-search-string ())
d7e9186edefa entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
186
d7e9186edefa entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
187 (defvar he-expand-list ())
d7e9186edefa entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
188
d7e9186edefa entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
189 (defvar he-tried-table ())
d7e9186edefa entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
190
4130
e5aee6a3bb75 * hippie-exp.el: Renamed from hippie.el.
Jim Blandy <jimb@redhat.com>
parents: 2233
diff changeset
191 (defvar he-search-loc (make-marker))
1737
d7e9186edefa entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
192
13207
2b541cc4cd97 (hippie-expand): Removed bug - don't undo from another buffer.
Richard M. Stallman <rms@gnu.org>
parents: 7639
diff changeset
193 (defvar he-search-loc2 ())
2b541cc4cd97 (hippie-expand): Removed bug - don't undo from another buffer.
Richard M. Stallman <rms@gnu.org>
parents: 7639
diff changeset
194
1737
d7e9186edefa entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
195 (defvar he-search-bw ())
d7e9186edefa entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
196
d7e9186edefa entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
197 (defvar he-search-bufs ())
d7e9186edefa entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
198
4130
e5aee6a3bb75 * hippie-exp.el: Renamed from hippie.el.
Jim Blandy <jimb@redhat.com>
parents: 2233
diff changeset
199 (defvar he-searched-n-bufs ())
e5aee6a3bb75 * hippie-exp.el: Renamed from hippie.el.
Jim Blandy <jimb@redhat.com>
parents: 2233
diff changeset
200
13207
2b541cc4cd97 (hippie-expand): Removed bug - don't undo from another buffer.
Richard M. Stallman <rms@gnu.org>
parents: 7639
diff changeset
201 (defvar he-search-window ())
2b541cc4cd97 (hippie-expand): Removed bug - don't undo from another buffer.
Richard M. Stallman <rms@gnu.org>
parents: 7639
diff changeset
202
4130
e5aee6a3bb75 * hippie-exp.el: Renamed from hippie.el.
Jim Blandy <jimb@redhat.com>
parents: 2233
diff changeset
203 ;;;###autoload
26599
e10a1d0deb4b Require comint when compiling.
Dave Love <fx@gnu.org>
parents: 26449
diff changeset
204 (defcustom hippie-expand-try-functions-list
e10a1d0deb4b Require comint when compiling.
Dave Love <fx@gnu.org>
parents: 26449
diff changeset
205 '(try-complete-file-name-partially
e10a1d0deb4b Require comint when compiling.
Dave Love <fx@gnu.org>
parents: 26449
diff changeset
206 try-complete-file-name
e10a1d0deb4b Require comint when compiling.
Dave Love <fx@gnu.org>
parents: 26449
diff changeset
207 try-expand-all-abbrevs
e10a1d0deb4b Require comint when compiling.
Dave Love <fx@gnu.org>
parents: 26449
diff changeset
208 try-expand-list
e10a1d0deb4b Require comint when compiling.
Dave Love <fx@gnu.org>
parents: 26449
diff changeset
209 try-expand-line
e10a1d0deb4b Require comint when compiling.
Dave Love <fx@gnu.org>
parents: 26449
diff changeset
210 try-expand-dabbrev
e10a1d0deb4b Require comint when compiling.
Dave Love <fx@gnu.org>
parents: 26449
diff changeset
211 try-expand-dabbrev-all-buffers
e10a1d0deb4b Require comint when compiling.
Dave Love <fx@gnu.org>
parents: 26449
diff changeset
212 try-expand-dabbrev-from-kill
e10a1d0deb4b Require comint when compiling.
Dave Love <fx@gnu.org>
parents: 26449
diff changeset
213 try-complete-lisp-symbol-partially
e10a1d0deb4b Require comint when compiling.
Dave Love <fx@gnu.org>
parents: 26449
diff changeset
214 try-complete-lisp-symbol)
1737
d7e9186edefa entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
215 "The list of expansion functions tried in order by `hippie-expand'.
d7e9186edefa entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
216 To change the behavior of `hippie-expand', remove, change the order of,
26599
e10a1d0deb4b Require comint when compiling.
Dave Love <fx@gnu.org>
parents: 26449
diff changeset
217 or insert functions in this list."
e10a1d0deb4b Require comint when compiling.
Dave Love <fx@gnu.org>
parents: 26449
diff changeset
218 :type '(repeat function)
e10a1d0deb4b Require comint when compiling.
Dave Love <fx@gnu.org>
parents: 26449
diff changeset
219 :group 'hippie-expand)
1737
d7e9186edefa entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
220
4130
e5aee6a3bb75 * hippie-exp.el: Renamed from hippie.el.
Jim Blandy <jimb@redhat.com>
parents: 2233
diff changeset
221 ;;;###autoload
17634
247c2a11843d Use defgroup and defcustom.
Richard M. Stallman <rms@gnu.org>
parents: 16590
diff changeset
222 (defcustom hippie-expand-verbose t
100171
d42aff5ca541 * align.el:
Lute Kamstra <lute@gnu.org>
parents: 97142
diff changeset
223 "Non-nil makes `hippie-expand' output which function it is trying."
17634
247c2a11843d Use defgroup and defcustom.
Richard M. Stallman <rms@gnu.org>
parents: 16590
diff changeset
224 :type 'boolean
247c2a11843d Use defgroup and defcustom.
Richard M. Stallman <rms@gnu.org>
parents: 16590
diff changeset
225 :group 'hippie-expand)
1737
d7e9186edefa entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
226
4130
e5aee6a3bb75 * hippie-exp.el: Renamed from hippie.el.
Jim Blandy <jimb@redhat.com>
parents: 2233
diff changeset
227 ;;;###autoload
21131
e4acb217b4af (hippie-expand-dabbrev-skip-space): Renamed `he-dabbrev-skip-space'.
Richard M. Stallman <rms@gnu.org>
parents: 18584
diff changeset
228 (defcustom hippie-expand-dabbrev-skip-space nil
100171
d42aff5ca541 * align.el:
Lute Kamstra <lute@gnu.org>
parents: 97142
diff changeset
229 "Non-nil means tolerate trailing spaces in the abbreviation to expand."
21131
e4acb217b4af (hippie-expand-dabbrev-skip-space): Renamed `he-dabbrev-skip-space'.
Richard M. Stallman <rms@gnu.org>
parents: 18584
diff changeset
230 :group 'hippie-expand
e4acb217b4af (hippie-expand-dabbrev-skip-space): Renamed `he-dabbrev-skip-space'.
Richard M. Stallman <rms@gnu.org>
parents: 18584
diff changeset
231 :type 'boolean)
e4acb217b4af (hippie-expand-dabbrev-skip-space): Renamed `he-dabbrev-skip-space'.
Richard M. Stallman <rms@gnu.org>
parents: 18584
diff changeset
232
e4acb217b4af (hippie-expand-dabbrev-skip-space): Renamed `he-dabbrev-skip-space'.
Richard M. Stallman <rms@gnu.org>
parents: 18584
diff changeset
233 ;;;###autoload
e4acb217b4af (hippie-expand-dabbrev-skip-space): Renamed `he-dabbrev-skip-space'.
Richard M. Stallman <rms@gnu.org>
parents: 18584
diff changeset
234 (defcustom hippie-expand-dabbrev-as-symbol t
100171
d42aff5ca541 * align.el:
Lute Kamstra <lute@gnu.org>
parents: 97142
diff changeset
235 "Non-nil means expand as symbols, i.e. syntax `_' is considered a letter."
21131
e4acb217b4af (hippie-expand-dabbrev-skip-space): Renamed `he-dabbrev-skip-space'.
Richard M. Stallman <rms@gnu.org>
parents: 18584
diff changeset
236 :group 'hippie-expand
e4acb217b4af (hippie-expand-dabbrev-skip-space): Renamed `he-dabbrev-skip-space'.
Richard M. Stallman <rms@gnu.org>
parents: 18584
diff changeset
237 :type 'boolean)
e4acb217b4af (hippie-expand-dabbrev-skip-space): Renamed `he-dabbrev-skip-space'.
Richard M. Stallman <rms@gnu.org>
parents: 18584
diff changeset
238
e4acb217b4af (hippie-expand-dabbrev-skip-space): Renamed `he-dabbrev-skip-space'.
Richard M. Stallman <rms@gnu.org>
parents: 18584
diff changeset
239 ;;;###autoload
e4acb217b4af (hippie-expand-dabbrev-skip-space): Renamed `he-dabbrev-skip-space'.
Richard M. Stallman <rms@gnu.org>
parents: 18584
diff changeset
240 (defcustom hippie-expand-no-restriction t
100171
d42aff5ca541 * align.el:
Lute Kamstra <lute@gnu.org>
parents: 97142
diff changeset
241 "Non-nil means that narrowed buffers are widened during search."
21131
e4acb217b4af (hippie-expand-dabbrev-skip-space): Renamed `he-dabbrev-skip-space'.
Richard M. Stallman <rms@gnu.org>
parents: 18584
diff changeset
242 :group 'hippie-expand
e4acb217b4af (hippie-expand-dabbrev-skip-space): Renamed `he-dabbrev-skip-space'.
Richard M. Stallman <rms@gnu.org>
parents: 18584
diff changeset
243 :type 'boolean)
e4acb217b4af (hippie-expand-dabbrev-skip-space): Renamed `he-dabbrev-skip-space'.
Richard M. Stallman <rms@gnu.org>
parents: 18584
diff changeset
244
e4acb217b4af (hippie-expand-dabbrev-skip-space): Renamed `he-dabbrev-skip-space'.
Richard M. Stallman <rms@gnu.org>
parents: 18584
diff changeset
245 ;;;###autoload
17634
247c2a11843d Use defgroup and defcustom.
Richard M. Stallman <rms@gnu.org>
parents: 16590
diff changeset
246 (defcustom hippie-expand-max-buffers ()
100171
d42aff5ca541 * align.el:
Lute Kamstra <lute@gnu.org>
parents: 97142
diff changeset
247 "The maximum number of buffers (apart from the current) searched.
17634
247c2a11843d Use defgroup and defcustom.
Richard M. Stallman <rms@gnu.org>
parents: 16590
diff changeset
248 If nil, all buffers are searched."
247c2a11843d Use defgroup and defcustom.
Richard M. Stallman <rms@gnu.org>
parents: 16590
diff changeset
249 :type '(choice (const :tag "All" nil)
247c2a11843d Use defgroup and defcustom.
Richard M. Stallman <rms@gnu.org>
parents: 16590
diff changeset
250 integer)
247c2a11843d Use defgroup and defcustom.
Richard M. Stallman <rms@gnu.org>
parents: 16590
diff changeset
251 :group 'hippie-expand)
4130
e5aee6a3bb75 * hippie-exp.el: Renamed from hippie.el.
Jim Blandy <jimb@redhat.com>
parents: 2233
diff changeset
252
e5aee6a3bb75 * hippie-exp.el: Renamed from hippie.el.
Jim Blandy <jimb@redhat.com>
parents: 2233
diff changeset
253 ;;;###autoload
105939
a0f778f4a995 * term/x-win.el (x-gtk-stock-map):
Dan Nicolaescu <dann@ics.uci.edu>
parents: 104552
diff changeset
254 (defcustom hippie-expand-ignore-buffers (list (purecopy "^ \\*.*\\*$") 'dired-mode)
100171
d42aff5ca541 * align.el:
Lute Kamstra <lute@gnu.org>
parents: 97142
diff changeset
255 "A list specifying which buffers not to search (if not current).
5296
81b21ef5290d (;; Keywords:): Changed to "abbrev".
Richard M. Stallman <rms@gnu.org>
parents: 4130
diff changeset
256 Can contain both regexps matching buffer names (as strings) and major modes
17634
247c2a11843d Use defgroup and defcustom.
Richard M. Stallman <rms@gnu.org>
parents: 16590
diff changeset
257 \(as atoms)"
247c2a11843d Use defgroup and defcustom.
Richard M. Stallman <rms@gnu.org>
parents: 16590
diff changeset
258 :type '(repeat (choice regexp (symbol :tag "Major Mode")))
247c2a11843d Use defgroup and defcustom.
Richard M. Stallman <rms@gnu.org>
parents: 16590
diff changeset
259 :group 'hippie-expand)
5296
81b21ef5290d (;; Keywords:): Changed to "abbrev".
Richard M. Stallman <rms@gnu.org>
parents: 4130
diff changeset
260
81b21ef5290d (;; Keywords:): Changed to "abbrev".
Richard M. Stallman <rms@gnu.org>
parents: 4130
diff changeset
261 ;;;###autoload
21131
e4acb217b4af (hippie-expand-dabbrev-skip-space): Renamed `he-dabbrev-skip-space'.
Richard M. Stallman <rms@gnu.org>
parents: 18584
diff changeset
262 (defcustom hippie-expand-only-buffers ()
100171
d42aff5ca541 * align.el:
Lute Kamstra <lute@gnu.org>
parents: 97142
diff changeset
263 "A list specifying the only buffers to search (in addition to current).
21131
e4acb217b4af (hippie-expand-dabbrev-skip-space): Renamed `he-dabbrev-skip-space'.
Richard M. Stallman <rms@gnu.org>
parents: 18584
diff changeset
264 Can contain both regexps matching buffer names (as strings) and major modes
42205
7308bbc423d5 Doc fixes.
Pavel Janík <Pavel@Janik.cz>
parents: 38436
diff changeset
265 \(as atoms). If non-nil, this variable overrides the variable
21131
e4acb217b4af (hippie-expand-dabbrev-skip-space): Renamed `he-dabbrev-skip-space'.
Richard M. Stallman <rms@gnu.org>
parents: 18584
diff changeset
266 `hippie-expand-ignore-buffers'."
e4acb217b4af (hippie-expand-dabbrev-skip-space): Renamed `he-dabbrev-skip-space'.
Richard M. Stallman <rms@gnu.org>
parents: 18584
diff changeset
267 :type '(repeat (choice regexp (symbol :tag "Major Mode")))
e4acb217b4af (hippie-expand-dabbrev-skip-space): Renamed `he-dabbrev-skip-space'.
Richard M. Stallman <rms@gnu.org>
parents: 18584
diff changeset
268 :group 'hippie-expand)
e4acb217b4af (hippie-expand-dabbrev-skip-space): Renamed `he-dabbrev-skip-space'.
Richard M. Stallman <rms@gnu.org>
parents: 18584
diff changeset
269
e4acb217b4af (hippie-expand-dabbrev-skip-space): Renamed `he-dabbrev-skip-space'.
Richard M. Stallman <rms@gnu.org>
parents: 18584
diff changeset
270 ;;;###autoload
1737
d7e9186edefa entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
271 (defun hippie-expand (arg)
d7e9186edefa entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
272 "Try to expand text before point, using multiple methods.
d7e9186edefa entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
273 The expansion functions in `hippie-expand-try-functions-list' are
d7e9186edefa entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
274 tried in order, until a possible expansion is found. Repeated
d7e9186edefa entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
275 application of `hippie-expand' inserts successively possible
49549
99be3a1e2589 Cygwin support patch.
Juanma Barranquero <lekktu@gmail.com>
parents: 42205
diff changeset
276 expansions.
1737
d7e9186edefa entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
277 With a positive numeric argument, jumps directly to the ARG next
49549
99be3a1e2589 Cygwin support patch.
Juanma Barranquero <lekktu@gmail.com>
parents: 42205
diff changeset
278 function in this list. With a negative argument or just \\[universal-argument],
99be3a1e2589 Cygwin support patch.
Juanma Barranquero <lekktu@gmail.com>
parents: 42205
diff changeset
279 undoes the expansion."
1737
d7e9186edefa entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
280 (interactive "P")
49549
99be3a1e2589 Cygwin support patch.
Juanma Barranquero <lekktu@gmail.com>
parents: 42205
diff changeset
281 (if (or (not arg)
1737
d7e9186edefa entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
282 (and (integerp arg) (> arg 0)))
d7e9186edefa entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
283 (let ((first (or (= he-num -1)
d7e9186edefa entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
284 (not (equal this-command last-command)))))
d7e9186edefa entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
285 (if first
d7e9186edefa entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
286 (progn
d7e9186edefa entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
287 (setq he-num -1)
d7e9186edefa entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
288 (setq he-tried-table nil)))
d7e9186edefa entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
289 (if arg
d7e9186edefa entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
290 (if (not first) (he-reset-string))
d7e9186edefa entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
291 (setq arg 0))
d7e9186edefa entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
292 (let ((i (max (+ he-num arg) 0)))
d7e9186edefa entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
293 (while (not (or (>= i (length hippie-expand-try-functions-list))
49549
99be3a1e2589 Cygwin support patch.
Juanma Barranquero <lekktu@gmail.com>
parents: 42205
diff changeset
294 (apply (nth i hippie-expand-try-functions-list)
1737
d7e9186edefa entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
295 (list (= he-num i)))))
d7e9186edefa entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
296 (setq i (1+ i)))
d7e9186edefa entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
297 (setq he-num i))
d7e9186edefa entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
298 (if (>= he-num (length hippie-expand-try-functions-list))
d7e9186edefa entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
299 (progn
d7e9186edefa entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
300 (setq he-num -1)
d7e9186edefa entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
301 (if first
d7e9186edefa entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
302 (message "No expansion found")
d7e9186edefa entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
303 (message "No further expansions found"))
d7e9186edefa entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
304 (ding))
4130
e5aee6a3bb75 * hippie-exp.el: Renamed from hippie.el.
Jim Blandy <jimb@redhat.com>
parents: 2233
diff changeset
305 (if (and hippie-expand-verbose
13207
2b541cc4cd97 (hippie-expand): Removed bug - don't undo from another buffer.
Richard M. Stallman <rms@gnu.org>
parents: 7639
diff changeset
306 (not (window-minibuffer-p (selected-window))))
14317
594c4676b8c6 (hippie-expand): Pass proper format string to message.
Karl Heuer <kwzh@gnu.org>
parents: 14169
diff changeset
307 (message "Using %s"
21131
e4acb217b4af (hippie-expand-dabbrev-skip-space): Renamed `he-dabbrev-skip-space'.
Richard M. Stallman <rms@gnu.org>
parents: 18584
diff changeset
308 (nth he-num hippie-expand-try-functions-list)))))
13207
2b541cc4cd97 (hippie-expand): Removed bug - don't undo from another buffer.
Richard M. Stallman <rms@gnu.org>
parents: 7639
diff changeset
309 (if (and (>= he-num 0)
2b541cc4cd97 (hippie-expand): Removed bug - don't undo from another buffer.
Richard M. Stallman <rms@gnu.org>
parents: 7639
diff changeset
310 (eq (marker-buffer he-string-beg) (current-buffer)))
1737
d7e9186edefa entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
311 (progn
d7e9186edefa entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
312 (setq he-num -1)
d7e9186edefa entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
313 (he-reset-string)
4130
e5aee6a3bb75 * hippie-exp.el: Renamed from hippie.el.
Jim Blandy <jimb@redhat.com>
parents: 2233
diff changeset
314 (if (and hippie-expand-verbose
13207
2b541cc4cd97 (hippie-expand): Removed bug - don't undo from another buffer.
Richard M. Stallman <rms@gnu.org>
parents: 7639
diff changeset
315 (not (window-minibuffer-p (selected-window))))
1737
d7e9186edefa entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
316 (message "Undoing expansions"))))))
4130
e5aee6a3bb75 * hippie-exp.el: Renamed from hippie.el.
Jim Blandy <jimb@redhat.com>
parents: 2233
diff changeset
317
1737
d7e9186edefa entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
318 ;; Initializes the region to expand (to between BEG and END).
d7e9186edefa entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
319 (defun he-init-string (beg end)
4130
e5aee6a3bb75 * hippie-exp.el: Renamed from hippie.el.
Jim Blandy <jimb@redhat.com>
parents: 2233
diff changeset
320 (set-marker he-string-beg beg)
e5aee6a3bb75 * hippie-exp.el: Renamed from hippie.el.
Jim Blandy <jimb@redhat.com>
parents: 2233
diff changeset
321 (set-marker he-string-end end)
21131
e4acb217b4af (hippie-expand-dabbrev-skip-space): Renamed `he-dabbrev-skip-space'.
Richard M. Stallman <rms@gnu.org>
parents: 18584
diff changeset
322 (setq he-search-string (buffer-substring-no-properties beg end)))
1737
d7e9186edefa entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
323
d7e9186edefa entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
324 ;; Resets the expanded region to its original contents.
d7e9186edefa entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
325 (defun he-reset-string ()
4130
e5aee6a3bb75 * hippie-exp.el: Renamed from hippie.el.
Jim Blandy <jimb@redhat.com>
parents: 2233
diff changeset
326 (let ((newpos (point-marker)))
e5aee6a3bb75 * hippie-exp.el: Renamed from hippie.el.
Jim Blandy <jimb@redhat.com>
parents: 2233
diff changeset
327 (goto-char he-string-beg)
e5aee6a3bb75 * hippie-exp.el: Renamed from hippie.el.
Jim Blandy <jimb@redhat.com>
parents: 2233
diff changeset
328 (insert he-search-string)
13207
2b541cc4cd97 (hippie-expand): Removed bug - don't undo from another buffer.
Richard M. Stallman <rms@gnu.org>
parents: 7639
diff changeset
329 (delete-region (point) he-string-end)
2b541cc4cd97 (hippie-expand): Removed bug - don't undo from another buffer.
Richard M. Stallman <rms@gnu.org>
parents: 7639
diff changeset
330 (goto-char newpos)))
1737
d7e9186edefa entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
331
d7e9186edefa entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
332 ;; Substitutes an expansion STR into the correct region (the region
49549
99be3a1e2589 Cygwin support patch.
Juanma Barranquero <lekktu@gmail.com>
parents: 42205
diff changeset
333 ;; initialized with `he-init-string').
1737
d7e9186edefa entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
334 ;; An optional argument TRANS-CASE means that it is ok to transfer case
d7e9186edefa entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
335 ;; from the abbreviation to the expansion if that is possible, and is
d7e9186edefa entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
336 ;; enabled in the buffer.
d7e9186edefa entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
337 (defun he-substitute-string (str &optional trans-case)
d7e9186edefa entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
338 (let ((trans-case (and trans-case
d7e9186edefa entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
339 case-replace
13207
2b541cc4cd97 (hippie-expand): Removed bug - don't undo from another buffer.
Richard M. Stallman <rms@gnu.org>
parents: 7639
diff changeset
340 case-fold-search))
2b541cc4cd97 (hippie-expand): Removed bug - don't undo from another buffer.
Richard M. Stallman <rms@gnu.org>
parents: 7639
diff changeset
341 (newpos (point-marker))
2b541cc4cd97 (hippie-expand): Removed bug - don't undo from another buffer.
Richard M. Stallman <rms@gnu.org>
parents: 7639
diff changeset
342 (subst ()))
1737
d7e9186edefa entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
343 (goto-char he-string-beg)
13207
2b541cc4cd97 (hippie-expand): Removed bug - don't undo from another buffer.
Richard M. Stallman <rms@gnu.org>
parents: 7639
diff changeset
344 (setq subst (if trans-case (he-transfer-case he-search-string str) str))
2b541cc4cd97 (hippie-expand): Removed bug - don't undo from another buffer.
Richard M. Stallman <rms@gnu.org>
parents: 7639
diff changeset
345 (setq he-tried-table (cons subst he-tried-table))
2b541cc4cd97 (hippie-expand): Removed bug - don't undo from another buffer.
Richard M. Stallman <rms@gnu.org>
parents: 7639
diff changeset
346 (insert subst)
2b541cc4cd97 (hippie-expand): Removed bug - don't undo from another buffer.
Richard M. Stallman <rms@gnu.org>
parents: 7639
diff changeset
347 (delete-region (point) he-string-end)
2b541cc4cd97 (hippie-expand): Removed bug - don't undo from another buffer.
Richard M. Stallman <rms@gnu.org>
parents: 7639
diff changeset
348 (goto-char newpos)))
2b541cc4cd97 (hippie-expand): Removed bug - don't undo from another buffer.
Richard M. Stallman <rms@gnu.org>
parents: 7639
diff changeset
349
2b541cc4cd97 (hippie-expand): Removed bug - don't undo from another buffer.
Richard M. Stallman <rms@gnu.org>
parents: 7639
diff changeset
350 (defun he-capitalize-first (str)
2b541cc4cd97 (hippie-expand): Removed bug - don't undo from another buffer.
Richard M. Stallman <rms@gnu.org>
parents: 7639
diff changeset
351 (save-match-data
2b541cc4cd97 (hippie-expand): Removed bug - don't undo from another buffer.
Richard M. Stallman <rms@gnu.org>
parents: 7639
diff changeset
352 (if (string-match "\\Sw*\\(\\sw\\).*" str)
2b541cc4cd97 (hippie-expand): Removed bug - don't undo from another buffer.
Richard M. Stallman <rms@gnu.org>
parents: 7639
diff changeset
353 (let ((res (downcase str))
2b541cc4cd97 (hippie-expand): Removed bug - don't undo from another buffer.
Richard M. Stallman <rms@gnu.org>
parents: 7639
diff changeset
354 (no (match-beginning 1)))
2b541cc4cd97 (hippie-expand): Removed bug - don't undo from another buffer.
Richard M. Stallman <rms@gnu.org>
parents: 7639
diff changeset
355 (aset res no (upcase (aref str no)))
2b541cc4cd97 (hippie-expand): Removed bug - don't undo from another buffer.
Richard M. Stallman <rms@gnu.org>
parents: 7639
diff changeset
356 res)
2b541cc4cd97 (hippie-expand): Removed bug - don't undo from another buffer.
Richard M. Stallman <rms@gnu.org>
parents: 7639
diff changeset
357 str)))
1737
d7e9186edefa entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
358
d7e9186edefa entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
359 (defun he-ordinary-case-p (str)
d7e9186edefa entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
360 (or (string= str (downcase str))
d7e9186edefa entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
361 (string= str (upcase str))
13207
2b541cc4cd97 (hippie-expand): Removed bug - don't undo from another buffer.
Richard M. Stallman <rms@gnu.org>
parents: 7639
diff changeset
362 (string= str (capitalize str))
2b541cc4cd97 (hippie-expand): Removed bug - don't undo from another buffer.
Richard M. Stallman <rms@gnu.org>
parents: 7639
diff changeset
363 (string= str (he-capitalize-first str))))
1737
d7e9186edefa entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
364
13207
2b541cc4cd97 (hippie-expand): Removed bug - don't undo from another buffer.
Richard M. Stallman <rms@gnu.org>
parents: 7639
diff changeset
365 (defun he-transfer-case (from-str to-str)
2b541cc4cd97 (hippie-expand): Removed bug - don't undo from another buffer.
Richard M. Stallman <rms@gnu.org>
parents: 7639
diff changeset
366 (cond ((string= from-str (substring to-str 0 (min (length from-str)
2b541cc4cd97 (hippie-expand): Removed bug - don't undo from another buffer.
Richard M. Stallman <rms@gnu.org>
parents: 7639
diff changeset
367 (length to-str))))
2b541cc4cd97 (hippie-expand): Removed bug - don't undo from another buffer.
Richard M. Stallman <rms@gnu.org>
parents: 7639
diff changeset
368 to-str)
2b541cc4cd97 (hippie-expand): Removed bug - don't undo from another buffer.
Richard M. Stallman <rms@gnu.org>
parents: 7639
diff changeset
369 ((not (he-ordinary-case-p to-str))
13225
76ce98050470 (he-transfer-case): Fix typo in prev change.
Richard M. Stallman <rms@gnu.org>
parents: 13207
diff changeset
370 to-str)
13207
2b541cc4cd97 (hippie-expand): Removed bug - don't undo from another buffer.
Richard M. Stallman <rms@gnu.org>
parents: 7639
diff changeset
371 ((string= from-str (downcase from-str))
2b541cc4cd97 (hippie-expand): Removed bug - don't undo from another buffer.
Richard M. Stallman <rms@gnu.org>
parents: 7639
diff changeset
372 (downcase to-str))
2b541cc4cd97 (hippie-expand): Removed bug - don't undo from another buffer.
Richard M. Stallman <rms@gnu.org>
parents: 7639
diff changeset
373 ((string= from-str (upcase from-str))
2b541cc4cd97 (hippie-expand): Removed bug - don't undo from another buffer.
Richard M. Stallman <rms@gnu.org>
parents: 7639
diff changeset
374 (upcase to-str))
2b541cc4cd97 (hippie-expand): Removed bug - don't undo from another buffer.
Richard M. Stallman <rms@gnu.org>
parents: 7639
diff changeset
375 ((string= from-str (he-capitalize-first from-str))
2b541cc4cd97 (hippie-expand): Removed bug - don't undo from another buffer.
Richard M. Stallman <rms@gnu.org>
parents: 7639
diff changeset
376 (he-capitalize-first to-str))
2b541cc4cd97 (hippie-expand): Removed bug - don't undo from another buffer.
Richard M. Stallman <rms@gnu.org>
parents: 7639
diff changeset
377 ((string= from-str (capitalize from-str))
2b541cc4cd97 (hippie-expand): Removed bug - don't undo from another buffer.
Richard M. Stallman <rms@gnu.org>
parents: 7639
diff changeset
378 (capitalize to-str))
2b541cc4cd97 (hippie-expand): Removed bug - don't undo from another buffer.
Richard M. Stallman <rms@gnu.org>
parents: 7639
diff changeset
379 (t
2b541cc4cd97 (hippie-expand): Removed bug - don't undo from another buffer.
Richard M. Stallman <rms@gnu.org>
parents: 7639
diff changeset
380 to-str)))
2b541cc4cd97 (hippie-expand): Removed bug - don't undo from another buffer.
Richard M. Stallman <rms@gnu.org>
parents: 7639
diff changeset
381
1737
d7e9186edefa entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
382
d7e9186edefa entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
383 ;; Check if STR is a member of LST.
42205
7308bbc423d5 Doc fixes.
Pavel Janík <Pavel@Janik.cz>
parents: 38436
diff changeset
384 ;; Transform to the final case if optional TRANS-CASE is non-nil.
13207
2b541cc4cd97 (hippie-expand): Removed bug - don't undo from another buffer.
Richard M. Stallman <rms@gnu.org>
parents: 7639
diff changeset
385 (defun he-string-member (str lst &optional trans-case)
2b541cc4cd97 (hippie-expand): Removed bug - don't undo from another buffer.
Richard M. Stallman <rms@gnu.org>
parents: 7639
diff changeset
386 (if str
2b541cc4cd97 (hippie-expand): Removed bug - don't undo from another buffer.
Richard M. Stallman <rms@gnu.org>
parents: 7639
diff changeset
387 (member (if (and trans-case
2b541cc4cd97 (hippie-expand): Removed bug - don't undo from another buffer.
Richard M. Stallman <rms@gnu.org>
parents: 7639
diff changeset
388 case-replace
2b541cc4cd97 (hippie-expand): Removed bug - don't undo from another buffer.
Richard M. Stallman <rms@gnu.org>
parents: 7639
diff changeset
389 case-fold-search)
2b541cc4cd97 (hippie-expand): Removed bug - don't undo from another buffer.
Richard M. Stallman <rms@gnu.org>
parents: 7639
diff changeset
390 (he-transfer-case he-search-string str)
2b541cc4cd97 (hippie-expand): Removed bug - don't undo from another buffer.
Richard M. Stallman <rms@gnu.org>
parents: 7639
diff changeset
391 str)
2b541cc4cd97 (hippie-expand): Removed bug - don't undo from another buffer.
Richard M. Stallman <rms@gnu.org>
parents: 7639
diff changeset
392 lst)))
1737
d7e9186edefa entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
393
21131
e4acb217b4af (hippie-expand-dabbrev-skip-space): Renamed `he-dabbrev-skip-space'.
Richard M. Stallman <rms@gnu.org>
parents: 18584
diff changeset
394 ;; Check if current buffer matches any atom or regexp in LST.
e4acb217b4af (hippie-expand-dabbrev-skip-space): Renamed `he-dabbrev-skip-space'.
Richard M. Stallman <rms@gnu.org>
parents: 18584
diff changeset
395 ;; Atoms are interpreted as major modes, strings as regexps mathing the name.
e4acb217b4af (hippie-expand-dabbrev-skip-space): Renamed `he-dabbrev-skip-space'.
Richard M. Stallman <rms@gnu.org>
parents: 18584
diff changeset
396 (defun he-buffer-member (lst)
e4acb217b4af (hippie-expand-dabbrev-skip-space): Renamed `he-dabbrev-skip-space'.
Richard M. Stallman <rms@gnu.org>
parents: 18584
diff changeset
397 (or (memq major-mode lst)
e4acb217b4af (hippie-expand-dabbrev-skip-space): Renamed `he-dabbrev-skip-space'.
Richard M. Stallman <rms@gnu.org>
parents: 18584
diff changeset
398 (progn
e4acb217b4af (hippie-expand-dabbrev-skip-space): Renamed `he-dabbrev-skip-space'.
Richard M. Stallman <rms@gnu.org>
parents: 18584
diff changeset
399 (while (and lst
e4acb217b4af (hippie-expand-dabbrev-skip-space): Renamed `he-dabbrev-skip-space'.
Richard M. Stallman <rms@gnu.org>
parents: 18584
diff changeset
400 (or (not (stringp (car lst)))
e4acb217b4af (hippie-expand-dabbrev-skip-space): Renamed `he-dabbrev-skip-space'.
Richard M. Stallman <rms@gnu.org>
parents: 18584
diff changeset
401 (not (string-match (car lst) (buffer-name)))))
e4acb217b4af (hippie-expand-dabbrev-skip-space): Renamed `he-dabbrev-skip-space'.
Richard M. Stallman <rms@gnu.org>
parents: 18584
diff changeset
402 (setq lst (cdr lst)))
e4acb217b4af (hippie-expand-dabbrev-skip-space): Renamed `he-dabbrev-skip-space'.
Richard M. Stallman <rms@gnu.org>
parents: 18584
diff changeset
403 lst)))
5296
81b21ef5290d (;; Keywords:): Changed to "abbrev".
Richard M. Stallman <rms@gnu.org>
parents: 4130
diff changeset
404
1737
d7e9186edefa entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
405 ;; For the real hippie-expand enthusiast: A macro that makes it
d7e9186edefa entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
406 ;; possible to use many functions like hippie-expand, but with
d7e9186edefa entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
407 ;; different try-functions-lists.
d7e9186edefa entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
408 ;; Usage is for example:
d7e9186edefa entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
409 ;; (fset 'my-complete-file (make-hippie-expand-function
d7e9186edefa entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
410 ;; '(try-complete-file-name-partially
d7e9186edefa entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
411 ;; try-complete-file-name)))
d7e9186edefa entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
412 ;; (fset 'my-complete-line (make-hippie-expand-function
d7e9186edefa entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
413 ;; '(try-expand-line
d7e9186edefa entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
414 ;; try-expand-line-all-buffers)))
49549
99be3a1e2589 Cygwin support patch.
Juanma Barranquero <lekktu@gmail.com>
parents: 42205
diff changeset
415 ;;
4130
e5aee6a3bb75 * hippie-exp.el: Renamed from hippie.el.
Jim Blandy <jimb@redhat.com>
parents: 2233
diff changeset
416 ;;;###autoload
1737
d7e9186edefa entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
417 (defmacro make-hippie-expand-function (try-list &optional verbose)
d7e9186edefa entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
418 "Construct a function similar to `hippie-expand'.
d7e9186edefa entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
419 Make it use the expansion functions in TRY-LIST. An optional second
d7e9186edefa entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
420 argument VERBOSE non-nil makes the function verbose."
26449
725d46ec6403 Use new backquote syntax.
Gerd Moellmann <gerd@gnu.org>
parents: 22250
diff changeset
421 `(function (lambda (arg)
49549
99be3a1e2589 Cygwin support patch.
Juanma Barranquero <lekktu@gmail.com>
parents: 42205
diff changeset
422 ,(concat
26449
725d46ec6403 Use new backquote syntax.
Gerd Moellmann <gerd@gnu.org>
parents: 22250
diff changeset
423 "Try to expand text before point, using the following functions: \n"
725d46ec6403 Use new backquote syntax.
Gerd Moellmann <gerd@gnu.org>
parents: 22250
diff changeset
424 (mapconcat 'prin1-to-string (eval try-list) ", "))
725d46ec6403 Use new backquote syntax.
Gerd Moellmann <gerd@gnu.org>
parents: 22250
diff changeset
425 (interactive "P")
725d46ec6403 Use new backquote syntax.
Gerd Moellmann <gerd@gnu.org>
parents: 22250
diff changeset
426 (let ((hippie-expand-try-functions-list ,try-list)
725d46ec6403 Use new backquote syntax.
Gerd Moellmann <gerd@gnu.org>
parents: 22250
diff changeset
427 (hippie-expand-verbose ,verbose))
725d46ec6403 Use new backquote syntax.
Gerd Moellmann <gerd@gnu.org>
parents: 22250
diff changeset
428 (hippie-expand arg)))))
1737
d7e9186edefa entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
429
d7e9186edefa entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
430
d7e9186edefa entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
431 ;;; Here follows the try-functions and their requisites:
d7e9186edefa entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
432
13207
2b541cc4cd97 (hippie-expand): Removed bug - don't undo from another buffer.
Richard M. Stallman <rms@gnu.org>
parents: 7639
diff changeset
433
1737
d7e9186edefa entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
434 (defun try-complete-file-name (old)
d7e9186edefa entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
435 "Try to complete text as a file name.
d7e9186edefa entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
436 The argument OLD has to be nil the first call of this function, and t
d7e9186edefa entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
437 for subsequent calls (for further possible completions of the same
d7e9186edefa entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
438 string). It returns t if a new completion is found, nil otherwise."
d7e9186edefa entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
439 (if (not old)
49549
99be3a1e2589 Cygwin support patch.
Juanma Barranquero <lekktu@gmail.com>
parents: 42205
diff changeset
440 (progn
1737
d7e9186edefa entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
441 (he-init-string (he-file-name-beg) (point))
97142
c3512b2085a0 * bitmaps/README:
Dan Nicolaescu <dann@ics.uci.edu>
parents: 94678
diff changeset
442 (let ((name-part (file-name-nondirectory he-search-string))
c3512b2085a0 * bitmaps/README:
Dan Nicolaescu <dann@ics.uci.edu>
parents: 94678
diff changeset
443 (dir-part (expand-file-name (or (file-name-directory
1737
d7e9186edefa entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
444 he-search-string) ""))))
d7e9186edefa entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
445 (if (not (he-string-member name-part he-tried-table))
d7e9186edefa entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
446 (setq he-tried-table (cons name-part he-tried-table)))
d7e9186edefa entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
447 (if (and (not (equal he-search-string ""))
97142
c3512b2085a0 * bitmaps/README:
Dan Nicolaescu <dann@ics.uci.edu>
parents: 94678
diff changeset
448 (file-directory-p dir-part))
49549
99be3a1e2589 Cygwin support patch.
Juanma Barranquero <lekktu@gmail.com>
parents: 42205
diff changeset
449 (setq he-expand-list (sort (file-name-all-completions
1737
d7e9186edefa entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
450 name-part
d7e9186edefa entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
451 dir-part)
d7e9186edefa entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
452 'string-lessp))
d7e9186edefa entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
453 (setq he-expand-list ())))))
d7e9186edefa entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
454
d7e9186edefa entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
455 (while (and he-expand-list
d7e9186edefa entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
456 (he-string-member (car he-expand-list) he-tried-table))
d7e9186edefa entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
457 (setq he-expand-list (cdr he-expand-list)))
d7e9186edefa entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
458 (if (null he-expand-list)
d7e9186edefa entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
459 (progn
13207
2b541cc4cd97 (hippie-expand): Removed bug - don't undo from another buffer.
Richard M. Stallman <rms@gnu.org>
parents: 7639
diff changeset
460 (if old (he-reset-string))
1737
d7e9186edefa entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
461 ())
13207
2b541cc4cd97 (hippie-expand): Removed bug - don't undo from another buffer.
Richard M. Stallman <rms@gnu.org>
parents: 7639
diff changeset
462 (let ((filename (he-concat-directory-file-name
97142
c3512b2085a0 * bitmaps/README:
Dan Nicolaescu <dann@ics.uci.edu>
parents: 94678
diff changeset
463 (file-name-directory he-search-string)
13207
2b541cc4cd97 (hippie-expand): Removed bug - don't undo from another buffer.
Richard M. Stallman <rms@gnu.org>
parents: 7639
diff changeset
464 (car he-expand-list))))
1737
d7e9186edefa entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
465 (he-substitute-string filename)
13207
2b541cc4cd97 (hippie-expand): Removed bug - don't undo from another buffer.
Richard M. Stallman <rms@gnu.org>
parents: 7639
diff changeset
466 (setq he-tried-table (cons (car he-expand-list) (cdr he-tried-table)))
1737
d7e9186edefa entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
467 (setq he-expand-list (cdr he-expand-list))
d7e9186edefa entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
468 t)))
d7e9186edefa entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
469
d7e9186edefa entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
470 (defun try-complete-file-name-partially (old)
d7e9186edefa entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
471 "Try to complete text as a file name, as many characters as unique.
d7e9186edefa entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
472 The argument OLD has to be nil the first call of this function. It
49549
99be3a1e2589 Cygwin support patch.
Juanma Barranquero <lekktu@gmail.com>
parents: 42205
diff changeset
473 returns t if a unique, possibly partial, completion is found, nil
1737
d7e9186edefa entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
474 otherwise."
d7e9186edefa entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
475 (let ((expansion ()))
d7e9186edefa entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
476 (if (not old)
49549
99be3a1e2589 Cygwin support patch.
Juanma Barranquero <lekktu@gmail.com>
parents: 42205
diff changeset
477 (progn
1737
d7e9186edefa entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
478 (he-init-string (he-file-name-beg) (point))
97142
c3512b2085a0 * bitmaps/README:
Dan Nicolaescu <dann@ics.uci.edu>
parents: 94678
diff changeset
479 (let ((name-part (file-name-nondirectory he-search-string))
c3512b2085a0 * bitmaps/README:
Dan Nicolaescu <dann@ics.uci.edu>
parents: 94678
diff changeset
480 (dir-part (expand-file-name (or (file-name-directory
1737
d7e9186edefa entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
481 he-search-string) ""))))
d7e9186edefa entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
482 (if (and (not (equal he-search-string ""))
97142
c3512b2085a0 * bitmaps/README:
Dan Nicolaescu <dann@ics.uci.edu>
parents: 94678
diff changeset
483 (file-directory-p dir-part))
1737
d7e9186edefa entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
484 (setq expansion (file-name-completion name-part
d7e9186edefa entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
485 dir-part)))
d7e9186edefa entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
486 (if (or (eq expansion t)
13207
2b541cc4cd97 (hippie-expand): Removed bug - don't undo from another buffer.
Richard M. Stallman <rms@gnu.org>
parents: 7639
diff changeset
487 (string= expansion name-part)
2b541cc4cd97 (hippie-expand): Removed bug - don't undo from another buffer.
Richard M. Stallman <rms@gnu.org>
parents: 7639
diff changeset
488 (he-string-member expansion he-tried-table))
1737
d7e9186edefa entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
489 (setq expansion ())))))
d7e9186edefa entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
490
d7e9186edefa entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
491 (if (not expansion)
d7e9186edefa entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
492 (progn
13207
2b541cc4cd97 (hippie-expand): Removed bug - don't undo from another buffer.
Richard M. Stallman <rms@gnu.org>
parents: 7639
diff changeset
493 (if old (he-reset-string))
1737
d7e9186edefa entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
494 ())
13207
2b541cc4cd97 (hippie-expand): Removed bug - don't undo from another buffer.
Richard M. Stallman <rms@gnu.org>
parents: 7639
diff changeset
495 (let ((filename (he-concat-directory-file-name
97142
c3512b2085a0 * bitmaps/README:
Dan Nicolaescu <dann@ics.uci.edu>
parents: 94678
diff changeset
496 (file-name-directory he-search-string)
13207
2b541cc4cd97 (hippie-expand): Removed bug - don't undo from another buffer.
Richard M. Stallman <rms@gnu.org>
parents: 7639
diff changeset
497 expansion)))
1737
d7e9186edefa entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
498 (he-substitute-string filename)
13207
2b541cc4cd97 (hippie-expand): Removed bug - don't undo from another buffer.
Richard M. Stallman <rms@gnu.org>
parents: 7639
diff changeset
499 (setq he-tried-table (cons expansion (cdr he-tried-table)))
1737
d7e9186edefa entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
500 t))))
d7e9186edefa entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
501
13207
2b541cc4cd97 (hippie-expand): Removed bug - don't undo from another buffer.
Richard M. Stallman <rms@gnu.org>
parents: 7639
diff changeset
502 (defvar he-file-name-chars
97142
c3512b2085a0 * bitmaps/README:
Dan Nicolaescu <dann@ics.uci.edu>
parents: 94678
diff changeset
503 (cond ((memq system-type '(ms-dos windows-nt cygwin))
13207
2b541cc4cd97 (hippie-expand): Removed bug - don't undo from another buffer.
Richard M. Stallman <rms@gnu.org>
parents: 7639
diff changeset
504 "-a-zA-Z0-9_/.,~^#$+=:\\\\")
2b541cc4cd97 (hippie-expand): Removed bug - don't undo from another buffer.
Richard M. Stallman <rms@gnu.org>
parents: 7639
diff changeset
505 (t ;; More strange file formats ?
2b541cc4cd97 (hippie-expand): Removed bug - don't undo from another buffer.
Richard M. Stallman <rms@gnu.org>
parents: 7639
diff changeset
506 "-a-zA-Z0-9_/.,~^#$+="))
2b541cc4cd97 (hippie-expand): Removed bug - don't undo from another buffer.
Richard M. Stallman <rms@gnu.org>
parents: 7639
diff changeset
507 "Characters that are considered part of the file name to expand.")
2b541cc4cd97 (hippie-expand): Removed bug - don't undo from another buffer.
Richard M. Stallman <rms@gnu.org>
parents: 7639
diff changeset
508
1737
d7e9186edefa entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
509 (defun he-file-name-beg ()
18030
d3cc9cf799f8 (he-file-name-beg): Don't trigger on parts of
Karl Heuer <kwzh@gnu.org>
parents: 17634
diff changeset
510 (let ((op (point)))
d3cc9cf799f8 (he-file-name-beg): Don't trigger on parts of
Karl Heuer <kwzh@gnu.org>
parents: 17634
diff changeset
511 (save-excursion
d3cc9cf799f8 (he-file-name-beg): Don't trigger on parts of
Karl Heuer <kwzh@gnu.org>
parents: 17634
diff changeset
512 (skip-chars-backward he-file-name-chars)
d3cc9cf799f8 (he-file-name-beg): Don't trigger on parts of
Karl Heuer <kwzh@gnu.org>
parents: 17634
diff changeset
513 (if (> (skip-syntax-backward "w") 0) ;; No words with non-file chars
21131
e4acb217b4af (hippie-expand-dabbrev-skip-space): Renamed `he-dabbrev-skip-space'.
Richard M. Stallman <rms@gnu.org>
parents: 18584
diff changeset
514 op
e4acb217b4af (hippie-expand-dabbrev-skip-space): Renamed `he-dabbrev-skip-space'.
Richard M. Stallman <rms@gnu.org>
parents: 18584
diff changeset
515 (point)))))
13207
2b541cc4cd97 (hippie-expand): Removed bug - don't undo from another buffer.
Richard M. Stallman <rms@gnu.org>
parents: 7639
diff changeset
516
97142
c3512b2085a0 * bitmaps/README:
Dan Nicolaescu <dann@ics.uci.edu>
parents: 94678
diff changeset
517 ;; Thanks go to David Hughes <ukchugd@ukpmr.cs.philips.nl> who
13207
2b541cc4cd97 (hippie-expand): Removed bug - don't undo from another buffer.
Richard M. Stallman <rms@gnu.org>
parents: 7639
diff changeset
518 ;; helped to make it work on PC.
2b541cc4cd97 (hippie-expand): Removed bug - don't undo from another buffer.
Richard M. Stallman <rms@gnu.org>
parents: 7639
diff changeset
519 (defun he-concat-directory-file-name (dir-part name-part)
2b541cc4cd97 (hippie-expand): Removed bug - don't undo from another buffer.
Richard M. Stallman <rms@gnu.org>
parents: 7639
diff changeset
520 "Try to slam together two parts of a file specification, system dependently."
15447
41bce2c4b1b8 (he-concat-directory-file-name): Directory part may be nil.
Richard M. Stallman <rms@gnu.org>
parents: 15330
diff changeset
521 (cond ((null dir-part) name-part)
104552
10c38084881d Remove code for defunct system-types emx, macos, mswindows,
Glenn Morris <rgm@gnu.org>
parents: 100908
diff changeset
522 ((eq system-type 'ms-dos)
13207
2b541cc4cd97 (hippie-expand): Removed bug - don't undo from another buffer.
Richard M. Stallman <rms@gnu.org>
parents: 7639
diff changeset
523 (if (and (string-match "\\\\" dir-part)
2b541cc4cd97 (hippie-expand): Removed bug - don't undo from another buffer.
Richard M. Stallman <rms@gnu.org>
parents: 7639
diff changeset
524 (not (string-match "/" dir-part))
2b541cc4cd97 (hippie-expand): Removed bug - don't undo from another buffer.
Richard M. Stallman <rms@gnu.org>
parents: 7639
diff changeset
525 (= (aref name-part (1- (length name-part))) ?/))
2b541cc4cd97 (hippie-expand): Removed bug - don't undo from another buffer.
Richard M. Stallman <rms@gnu.org>
parents: 7639
diff changeset
526 (aset name-part (1- (length name-part)) ?\\))
2b541cc4cd97 (hippie-expand): Removed bug - don't undo from another buffer.
Richard M. Stallman <rms@gnu.org>
parents: 7639
diff changeset
527 (concat dir-part name-part))
49549
99be3a1e2589 Cygwin support patch.
Juanma Barranquero <lekktu@gmail.com>
parents: 42205
diff changeset
528 (t
13207
2b541cc4cd97 (hippie-expand): Removed bug - don't undo from another buffer.
Richard M. Stallman <rms@gnu.org>
parents: 7639
diff changeset
529 (concat dir-part name-part))))
49549
99be3a1e2589 Cygwin support patch.
Juanma Barranquero <lekktu@gmail.com>
parents: 42205
diff changeset
530
1737
d7e9186edefa entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
531 (defun try-complete-lisp-symbol (old)
d7e9186edefa entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
532 "Try to complete word as an Emacs Lisp symbol.
d7e9186edefa entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
533 The argument OLD has to be nil the first call of this function, and t
d7e9186edefa entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
534 for subsequent calls (for further possible completions of the same
d7e9186edefa entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
535 string). It returns t if a new completion is found, nil otherwise."
d7e9186edefa entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
536 (if (not old)
49549
99be3a1e2589 Cygwin support patch.
Juanma Barranquero <lekktu@gmail.com>
parents: 42205
diff changeset
537 (progn
1737
d7e9186edefa entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
538 (he-init-string (he-lisp-symbol-beg) (point))
d7e9186edefa entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
539 (if (not (he-string-member he-search-string he-tried-table))
d7e9186edefa entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
540 (setq he-tried-table (cons he-search-string he-tried-table)))
49549
99be3a1e2589 Cygwin support patch.
Juanma Barranquero <lekktu@gmail.com>
parents: 42205
diff changeset
541 (setq he-expand-list
1737
d7e9186edefa entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
542 (and (not (equal he-search-string ""))
d7e9186edefa entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
543 (sort (all-completions he-search-string obarray
d7e9186edefa entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
544 (function (lambda (sym)
d7e9186edefa entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
545 (or (boundp sym)
d7e9186edefa entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
546 (fboundp sym)
d7e9186edefa entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
547 (symbol-plist sym)))))
d7e9186edefa entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
548 'string-lessp)))))
d7e9186edefa entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
549 (while (and he-expand-list
d7e9186edefa entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
550 (he-string-member (car he-expand-list) he-tried-table))
d7e9186edefa entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
551 (setq he-expand-list (cdr he-expand-list)))
d7e9186edefa entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
552 (if (null he-expand-list)
d7e9186edefa entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
553 (progn
13207
2b541cc4cd97 (hippie-expand): Removed bug - don't undo from another buffer.
Richard M. Stallman <rms@gnu.org>
parents: 7639
diff changeset
554 (if old (he-reset-string))
1737
d7e9186edefa entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
555 ())
d7e9186edefa entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
556 (progn
d7e9186edefa entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
557 (he-substitute-string (car he-expand-list))
d7e9186edefa entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
558 (setq he-expand-list (cdr he-expand-list))
d7e9186edefa entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
559 t)))
d7e9186edefa entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
560
d7e9186edefa entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
561 (defun try-complete-lisp-symbol-partially (old)
d7e9186edefa entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
562 "Try to complete as an Emacs Lisp symbol, as many characters as unique.
d7e9186edefa entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
563 The argument OLD has to be nil the first call of this function. It
49549
99be3a1e2589 Cygwin support patch.
Juanma Barranquero <lekktu@gmail.com>
parents: 42205
diff changeset
564 returns t if a unique, possibly partial, completion is found, nil
1737
d7e9186edefa entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
565 otherwise."
d7e9186edefa entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
566 (let ((expansion ()))
d7e9186edefa entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
567 (if (not old)
49549
99be3a1e2589 Cygwin support patch.
Juanma Barranquero <lekktu@gmail.com>
parents: 42205
diff changeset
568 (progn
1737
d7e9186edefa entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
569 (he-init-string (he-lisp-symbol-beg) (point))
d7e9186edefa entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
570 (if (not (string= he-search-string ""))
49549
99be3a1e2589 Cygwin support patch.
Juanma Barranquero <lekktu@gmail.com>
parents: 42205
diff changeset
571 (setq expansion
1737
d7e9186edefa entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
572 (try-completion he-search-string obarray
d7e9186edefa entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
573 (function (lambda (sym)
d7e9186edefa entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
574 (or (boundp sym)
d7e9186edefa entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
575 (fboundp sym)
d7e9186edefa entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
576 (symbol-plist sym)))))))
d7e9186edefa entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
577 (if (or (eq expansion t)
13207
2b541cc4cd97 (hippie-expand): Removed bug - don't undo from another buffer.
Richard M. Stallman <rms@gnu.org>
parents: 7639
diff changeset
578 (string= expansion he-search-string)
2b541cc4cd97 (hippie-expand): Removed bug - don't undo from another buffer.
Richard M. Stallman <rms@gnu.org>
parents: 7639
diff changeset
579 (he-string-member expansion he-tried-table))
1737
d7e9186edefa entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
580 (setq expansion ()))))
d7e9186edefa entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
581
d7e9186edefa entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
582 (if (not expansion)
d7e9186edefa entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
583 (progn
13207
2b541cc4cd97 (hippie-expand): Removed bug - don't undo from another buffer.
Richard M. Stallman <rms@gnu.org>
parents: 7639
diff changeset
584 (if old (he-reset-string))
1737
d7e9186edefa entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
585 ())
d7e9186edefa entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
586 (progn
d7e9186edefa entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
587 (he-substitute-string expansion)
d7e9186edefa entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
588 t))))
d7e9186edefa entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
589
d7e9186edefa entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
590 (defun he-lisp-symbol-beg ()
18030
d3cc9cf799f8 (he-file-name-beg): Don't trigger on parts of
Karl Heuer <kwzh@gnu.org>
parents: 17634
diff changeset
591 (save-excursion
d3cc9cf799f8 (he-file-name-beg): Don't trigger on parts of
Karl Heuer <kwzh@gnu.org>
parents: 17634
diff changeset
592 (skip-syntax-backward "w_")
d3cc9cf799f8 (he-file-name-beg): Don't trigger on parts of
Karl Heuer <kwzh@gnu.org>
parents: 17634
diff changeset
593 (point)))
1737
d7e9186edefa entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
594
d7e9186edefa entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
595 (defun try-expand-line (old)
d7e9186edefa entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
596 "Try to complete the current line to an entire line in the buffer.
d7e9186edefa entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
597 The argument OLD has to be nil the first call of this function, and t
d7e9186edefa entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
598 for subsequent calls (for further possible completions of the same
d7e9186edefa entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
599 string). It returns t if a new completion is found, nil otherwise."
d7e9186edefa entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
600 (let ((expansion ())
d7e9186edefa entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
601 (strip-prompt (and (get-buffer-process (current-buffer))
61874
863e75f2063d (try-expand-line, try-expand-line-all-buffers):
Luc Teirlinck <teirllm@auburn.edu>
parents: 52401
diff changeset
602 comint-use-prompt-regexp
4130
e5aee6a3bb75 * hippie-exp.el: Renamed from hippie.el.
Jim Blandy <jimb@redhat.com>
parents: 2233
diff changeset
603 comint-prompt-regexp)))
1737
d7e9186edefa entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
604 (if (not old)
d7e9186edefa entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
605 (progn
d7e9186edefa entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
606 (he-init-string (he-line-beg strip-prompt) (point))
4130
e5aee6a3bb75 * hippie-exp.el: Renamed from hippie.el.
Jim Blandy <jimb@redhat.com>
parents: 2233
diff changeset
607 (set-marker he-search-loc he-string-beg)
1737
d7e9186edefa entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
608 (setq he-search-bw t)))
d7e9186edefa entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
609
d7e9186edefa entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
610 (if (not (equal he-search-string ""))
d7e9186edefa entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
611 (save-excursion
21131
e4acb217b4af (hippie-expand-dabbrev-skip-space): Renamed `he-dabbrev-skip-space'.
Richard M. Stallman <rms@gnu.org>
parents: 18584
diff changeset
612 (save-restriction
e4acb217b4af (hippie-expand-dabbrev-skip-space): Renamed `he-dabbrev-skip-space'.
Richard M. Stallman <rms@gnu.org>
parents: 18584
diff changeset
613 (if hippie-expand-no-restriction
e4acb217b4af (hippie-expand-dabbrev-skip-space): Renamed `he-dabbrev-skip-space'.
Richard M. Stallman <rms@gnu.org>
parents: 18584
diff changeset
614 (widen))
e4acb217b4af (hippie-expand-dabbrev-skip-space): Renamed `he-dabbrev-skip-space'.
Richard M. Stallman <rms@gnu.org>
parents: 18584
diff changeset
615 ;; Try looking backward unless inhibited.
e4acb217b4af (hippie-expand-dabbrev-skip-space): Renamed `he-dabbrev-skip-space'.
Richard M. Stallman <rms@gnu.org>
parents: 18584
diff changeset
616 (if he-search-bw
49549
99be3a1e2589 Cygwin support patch.
Juanma Barranquero <lekktu@gmail.com>
parents: 42205
diff changeset
617 (progn
21131
e4acb217b4af (hippie-expand-dabbrev-skip-space): Renamed `he-dabbrev-skip-space'.
Richard M. Stallman <rms@gnu.org>
parents: 18584
diff changeset
618 (goto-char he-search-loc)
e4acb217b4af (hippie-expand-dabbrev-skip-space): Renamed `he-dabbrev-skip-space'.
Richard M. Stallman <rms@gnu.org>
parents: 18584
diff changeset
619 (setq expansion (he-line-search he-search-string
e4acb217b4af (hippie-expand-dabbrev-skip-space): Renamed `he-dabbrev-skip-space'.
Richard M. Stallman <rms@gnu.org>
parents: 18584
diff changeset
620 strip-prompt t))
e4acb217b4af (hippie-expand-dabbrev-skip-space): Renamed `he-dabbrev-skip-space'.
Richard M. Stallman <rms@gnu.org>
parents: 18584
diff changeset
621 (set-marker he-search-loc (point))
e4acb217b4af (hippie-expand-dabbrev-skip-space): Renamed `he-dabbrev-skip-space'.
Richard M. Stallman <rms@gnu.org>
parents: 18584
diff changeset
622 (if (not expansion)
e4acb217b4af (hippie-expand-dabbrev-skip-space): Renamed `he-dabbrev-skip-space'.
Richard M. Stallman <rms@gnu.org>
parents: 18584
diff changeset
623 (progn
e4acb217b4af (hippie-expand-dabbrev-skip-space): Renamed `he-dabbrev-skip-space'.
Richard M. Stallman <rms@gnu.org>
parents: 18584
diff changeset
624 (set-marker he-search-loc he-string-end)
e4acb217b4af (hippie-expand-dabbrev-skip-space): Renamed `he-dabbrev-skip-space'.
Richard M. Stallman <rms@gnu.org>
parents: 18584
diff changeset
625 (setq he-search-bw ())))))
e4acb217b4af (hippie-expand-dabbrev-skip-space): Renamed `he-dabbrev-skip-space'.
Richard M. Stallman <rms@gnu.org>
parents: 18584
diff changeset
626
e4acb217b4af (hippie-expand-dabbrev-skip-space): Renamed `he-dabbrev-skip-space'.
Richard M. Stallman <rms@gnu.org>
parents: 18584
diff changeset
627 (if (not expansion) ; Then look forward.
49549
99be3a1e2589 Cygwin support patch.
Juanma Barranquero <lekktu@gmail.com>
parents: 42205
diff changeset
628 (progn
21131
e4acb217b4af (hippie-expand-dabbrev-skip-space): Renamed `he-dabbrev-skip-space'.
Richard M. Stallman <rms@gnu.org>
parents: 18584
diff changeset
629 (goto-char he-search-loc)
49549
99be3a1e2589 Cygwin support patch.
Juanma Barranquero <lekktu@gmail.com>
parents: 42205
diff changeset
630 (setq expansion (he-line-search he-search-string
21131
e4acb217b4af (hippie-expand-dabbrev-skip-space): Renamed `he-dabbrev-skip-space'.
Richard M. Stallman <rms@gnu.org>
parents: 18584
diff changeset
631 strip-prompt nil))
e4acb217b4af (hippie-expand-dabbrev-skip-space): Renamed `he-dabbrev-skip-space'.
Richard M. Stallman <rms@gnu.org>
parents: 18584
diff changeset
632 (set-marker he-search-loc (point)))))))
1737
d7e9186edefa entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
633
d7e9186edefa entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
634 (if (not expansion)
d7e9186edefa entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
635 (progn
13207
2b541cc4cd97 (hippie-expand): Removed bug - don't undo from another buffer.
Richard M. Stallman <rms@gnu.org>
parents: 7639
diff changeset
636 (if old (he-reset-string))
1737
d7e9186edefa entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
637 ())
d7e9186edefa entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
638 (progn
d7e9186edefa entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
639 (he-substitute-string expansion t)
d7e9186edefa entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
640 t))))
d7e9186edefa entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
641
d7e9186edefa entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
642 (defun try-expand-line-all-buffers (old)
d7e9186edefa entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
643 "Try to complete the current line, searching all other buffers.
d7e9186edefa entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
644 The argument OLD has to be nil the first call of this function, and t
d7e9186edefa entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
645 for subsequent calls (for further possible completions of the same
d7e9186edefa entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
646 string). It returns t if a new completion is found, nil otherwise."
d7e9186edefa entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
647 (let ((expansion ())
d7e9186edefa entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
648 (strip-prompt (and (get-buffer-process (current-buffer))
61874
863e75f2063d (try-expand-line, try-expand-line-all-buffers):
Luc Teirlinck <teirllm@auburn.edu>
parents: 52401
diff changeset
649 comint-use-prompt-regexp
4130
e5aee6a3bb75 * hippie-exp.el: Renamed from hippie.el.
Jim Blandy <jimb@redhat.com>
parents: 2233
diff changeset
650 comint-prompt-regexp))
13207
2b541cc4cd97 (hippie-expand): Removed bug - don't undo from another buffer.
Richard M. Stallman <rms@gnu.org>
parents: 7639
diff changeset
651 (buf (current-buffer))
2b541cc4cd97 (hippie-expand): Removed bug - don't undo from another buffer.
Richard M. Stallman <rms@gnu.org>
parents: 7639
diff changeset
652 (orig-case-fold-search case-fold-search))
1737
d7e9186edefa entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
653 (if (not old)
d7e9186edefa entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
654 (progn
d7e9186edefa entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
655 (he-init-string (he-line-beg strip-prompt) (point))
4130
e5aee6a3bb75 * hippie-exp.el: Renamed from hippie.el.
Jim Blandy <jimb@redhat.com>
parents: 2233
diff changeset
656 (setq he-search-bufs (buffer-list))
13207
2b541cc4cd97 (hippie-expand): Removed bug - don't undo from another buffer.
Richard M. Stallman <rms@gnu.org>
parents: 7639
diff changeset
657 (setq he-searched-n-bufs 0)
4130
e5aee6a3bb75 * hippie-exp.el: Renamed from hippie.el.
Jim Blandy <jimb@redhat.com>
parents: 2233
diff changeset
658 (set-marker he-search-loc 1 (car he-search-bufs))))
1737
d7e9186edefa entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
659
d7e9186edefa entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
660 (if (not (equal he-search-string ""))
49549
99be3a1e2589 Cygwin support patch.
Juanma Barranquero <lekktu@gmail.com>
parents: 42205
diff changeset
661 (while (and he-search-bufs
13207
2b541cc4cd97 (hippie-expand): Removed bug - don't undo from another buffer.
Richard M. Stallman <rms@gnu.org>
parents: 7639
diff changeset
662 (not expansion)
2b541cc4cd97 (hippie-expand): Removed bug - don't undo from another buffer.
Richard M. Stallman <rms@gnu.org>
parents: 7639
diff changeset
663 (or (not hippie-expand-max-buffers)
2b541cc4cd97 (hippie-expand): Removed bug - don't undo from another buffer.
Richard M. Stallman <rms@gnu.org>
parents: 7639
diff changeset
664 (< he-searched-n-bufs hippie-expand-max-buffers)))
1737
d7e9186edefa entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
665 (set-buffer (car he-search-bufs))
d7e9186edefa entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
666 (if (and (not (eq (current-buffer) buf))
21131
e4acb217b4af (hippie-expand-dabbrev-skip-space): Renamed `he-dabbrev-skip-space'.
Richard M. Stallman <rms@gnu.org>
parents: 18584
diff changeset
667 (if hippie-expand-only-buffers
e4acb217b4af (hippie-expand-dabbrev-skip-space): Renamed `he-dabbrev-skip-space'.
Richard M. Stallman <rms@gnu.org>
parents: 18584
diff changeset
668 (he-buffer-member hippie-expand-only-buffers)
e4acb217b4af (hippie-expand-dabbrev-skip-space): Renamed `he-dabbrev-skip-space'.
Richard M. Stallman <rms@gnu.org>
parents: 18584
diff changeset
669 (not (he-buffer-member hippie-expand-ignore-buffers))))
1737
d7e9186edefa entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
670 (save-excursion
21131
e4acb217b4af (hippie-expand-dabbrev-skip-space): Renamed `he-dabbrev-skip-space'.
Richard M. Stallman <rms@gnu.org>
parents: 18584
diff changeset
671 (save-restriction
e4acb217b4af (hippie-expand-dabbrev-skip-space): Renamed `he-dabbrev-skip-space'.
Richard M. Stallman <rms@gnu.org>
parents: 18584
diff changeset
672 (if hippie-expand-no-restriction
e4acb217b4af (hippie-expand-dabbrev-skip-space): Renamed `he-dabbrev-skip-space'.
Richard M. Stallman <rms@gnu.org>
parents: 18584
diff changeset
673 (widen))
e4acb217b4af (hippie-expand-dabbrev-skip-space): Renamed `he-dabbrev-skip-space'.
Richard M. Stallman <rms@gnu.org>
parents: 18584
diff changeset
674 (goto-char he-search-loc)
e4acb217b4af (hippie-expand-dabbrev-skip-space): Renamed `he-dabbrev-skip-space'.
Richard M. Stallman <rms@gnu.org>
parents: 18584
diff changeset
675 (setq strip-prompt (and (get-buffer-process (current-buffer))
61874
863e75f2063d (try-expand-line, try-expand-line-all-buffers):
Luc Teirlinck <teirllm@auburn.edu>
parents: 52401
diff changeset
676 comint-use-prompt-regexp
21131
e4acb217b4af (hippie-expand-dabbrev-skip-space): Renamed `he-dabbrev-skip-space'.
Richard M. Stallman <rms@gnu.org>
parents: 18584
diff changeset
677 comint-prompt-regexp))
49549
99be3a1e2589 Cygwin support patch.
Juanma Barranquero <lekktu@gmail.com>
parents: 42205
diff changeset
678 (setq expansion
21131
e4acb217b4af (hippie-expand-dabbrev-skip-space): Renamed `he-dabbrev-skip-space'.
Richard M. Stallman <rms@gnu.org>
parents: 18584
diff changeset
679 (let ((case-fold-search orig-case-fold-search))
e4acb217b4af (hippie-expand-dabbrev-skip-space): Renamed `he-dabbrev-skip-space'.
Richard M. Stallman <rms@gnu.org>
parents: 18584
diff changeset
680 (he-line-search he-search-string
e4acb217b4af (hippie-expand-dabbrev-skip-space): Renamed `he-dabbrev-skip-space'.
Richard M. Stallman <rms@gnu.org>
parents: 18584
diff changeset
681 strip-prompt nil)))
e4acb217b4af (hippie-expand-dabbrev-skip-space): Renamed `he-dabbrev-skip-space'.
Richard M. Stallman <rms@gnu.org>
parents: 18584
diff changeset
682 (set-marker he-search-loc (point))
e4acb217b4af (hippie-expand-dabbrev-skip-space): Renamed `he-dabbrev-skip-space'.
Richard M. Stallman <rms@gnu.org>
parents: 18584
diff changeset
683 (if (not expansion)
e4acb217b4af (hippie-expand-dabbrev-skip-space): Renamed `he-dabbrev-skip-space'.
Richard M. Stallman <rms@gnu.org>
parents: 18584
diff changeset
684 (progn
e4acb217b4af (hippie-expand-dabbrev-skip-space): Renamed `he-dabbrev-skip-space'.
Richard M. Stallman <rms@gnu.org>
parents: 18584
diff changeset
685 (setq he-search-bufs (cdr he-search-bufs))
e4acb217b4af (hippie-expand-dabbrev-skip-space): Renamed `he-dabbrev-skip-space'.
Richard M. Stallman <rms@gnu.org>
parents: 18584
diff changeset
686 (setq he-searched-n-bufs (1+ he-searched-n-bufs))
e4acb217b4af (hippie-expand-dabbrev-skip-space): Renamed `he-dabbrev-skip-space'.
Richard M. Stallman <rms@gnu.org>
parents: 18584
diff changeset
687 (set-marker he-search-loc 1 (car he-search-bufs))))))
13207
2b541cc4cd97 (hippie-expand): Removed bug - don't undo from another buffer.
Richard M. Stallman <rms@gnu.org>
parents: 7639
diff changeset
688 (setq he-search-bufs (cdr he-search-bufs))
2b541cc4cd97 (hippie-expand): Removed bug - don't undo from another buffer.
Richard M. Stallman <rms@gnu.org>
parents: 7639
diff changeset
689 (set-marker he-search-loc 1 (car he-search-bufs)))))
1737
d7e9186edefa entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
690
d7e9186edefa entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
691 (set-buffer buf)
d7e9186edefa entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
692 (if (not expansion)
d7e9186edefa entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
693 (progn
13207
2b541cc4cd97 (hippie-expand): Removed bug - don't undo from another buffer.
Richard M. Stallman <rms@gnu.org>
parents: 7639
diff changeset
694 (if old (he-reset-string))
1737
d7e9186edefa entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
695 ())
d7e9186edefa entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
696 (progn
d7e9186edefa entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
697 (he-substitute-string expansion t)
d7e9186edefa entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
698 t))))
d7e9186edefa entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
699
49549
99be3a1e2589 Cygwin support patch.
Juanma Barranquero <lekktu@gmail.com>
parents: 42205
diff changeset
700 (defun he-line-search (str strip-prompt reverse)
1737
d7e9186edefa entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
701 (let ((result ()))
d7e9186edefa entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
702 (while (and (not result)
d7e9186edefa entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
703 (if reverse
49549
99be3a1e2589 Cygwin support patch.
Juanma Barranquero <lekktu@gmail.com>
parents: 42205
diff changeset
704 (re-search-backward
1737
d7e9186edefa entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
705 (he-line-search-regexp str strip-prompt)
d7e9186edefa entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
706 nil t)
d7e9186edefa entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
707 (re-search-forward
d7e9186edefa entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
708 (he-line-search-regexp str strip-prompt)
d7e9186edefa entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
709 nil t)))
26449
725d46ec6403 Use new backquote syntax.
Gerd Moellmann <gerd@gnu.org>
parents: 22250
diff changeset
710 (setq result (buffer-substring-no-properties (match-end 1)
725d46ec6403 Use new backquote syntax.
Gerd Moellmann <gerd@gnu.org>
parents: 22250
diff changeset
711 (match-end 0)))
13207
2b541cc4cd97 (hippie-expand): Removed bug - don't undo from another buffer.
Richard M. Stallman <rms@gnu.org>
parents: 7639
diff changeset
712 (if (he-string-member result he-tried-table t)
2b541cc4cd97 (hippie-expand): Removed bug - don't undo from another buffer.
Richard M. Stallman <rms@gnu.org>
parents: 7639
diff changeset
713 (setq result nil))) ; if already in table, ignore
1737
d7e9186edefa entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
714 result))
d7e9186edefa entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
715
d7e9186edefa entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
716 (defun he-line-beg (strip-prompt)
d7e9186edefa entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
717 (save-excursion
49549
99be3a1e2589 Cygwin support patch.
Juanma Barranquero <lekktu@gmail.com>
parents: 42205
diff changeset
718 (if (re-search-backward (he-line-search-regexp "" strip-prompt)
1737
d7e9186edefa entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
719 (save-excursion (beginning-of-line)
d7e9186edefa entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
720 (point)) t)
d7e9186edefa entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
721 (match-beginning 2)
d7e9186edefa entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
722 (point))))
d7e9186edefa entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
723
d7e9186edefa entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
724 (defun he-line-search-regexp (pat strip-prompt)
d7e9186edefa entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
725 (if strip-prompt
4130
e5aee6a3bb75 * hippie-exp.el: Renamed from hippie.el.
Jim Blandy <jimb@redhat.com>
parents: 2233
diff changeset
726 (concat "\\(" comint-prompt-regexp "\\|^\\s-*\\)\\("
1737
d7e9186edefa entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
727 (regexp-quote pat)
d7e9186edefa entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
728 "[^\n]*[^ \t\n]\\)")
49549
99be3a1e2589 Cygwin support patch.
Juanma Barranquero <lekktu@gmail.com>
parents: 42205
diff changeset
729 (concat "^\\(\\s-*\\)\\("
1737
d7e9186edefa entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
730 (regexp-quote pat)
d7e9186edefa entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
731 "[^\n]*[^ \t\n]\\)")))
d7e9186edefa entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
732
4130
e5aee6a3bb75 * hippie-exp.el: Renamed from hippie.el.
Jim Blandy <jimb@redhat.com>
parents: 2233
diff changeset
733 (defun try-expand-list (old)
e5aee6a3bb75 * hippie-exp.el: Renamed from hippie.el.
Jim Blandy <jimb@redhat.com>
parents: 2233
diff changeset
734 "Try to complete the current beginning of a list.
e5aee6a3bb75 * hippie-exp.el: Renamed from hippie.el.
Jim Blandy <jimb@redhat.com>
parents: 2233
diff changeset
735 The argument OLD has to be nil the first call of this function, and t
e5aee6a3bb75 * hippie-exp.el: Renamed from hippie.el.
Jim Blandy <jimb@redhat.com>
parents: 2233
diff changeset
736 for subsequent calls (for further possible completions of the same
e5aee6a3bb75 * hippie-exp.el: Renamed from hippie.el.
Jim Blandy <jimb@redhat.com>
parents: 2233
diff changeset
737 string). It returns t if a new completion is found, nil otherwise."
e5aee6a3bb75 * hippie-exp.el: Renamed from hippie.el.
Jim Blandy <jimb@redhat.com>
parents: 2233
diff changeset
738 (let ((expansion ()))
e5aee6a3bb75 * hippie-exp.el: Renamed from hippie.el.
Jim Blandy <jimb@redhat.com>
parents: 2233
diff changeset
739 (if (not old)
e5aee6a3bb75 * hippie-exp.el: Renamed from hippie.el.
Jim Blandy <jimb@redhat.com>
parents: 2233
diff changeset
740 (progn
e5aee6a3bb75 * hippie-exp.el: Renamed from hippie.el.
Jim Blandy <jimb@redhat.com>
parents: 2233
diff changeset
741 (he-init-string (he-list-beg) (point))
e5aee6a3bb75 * hippie-exp.el: Renamed from hippie.el.
Jim Blandy <jimb@redhat.com>
parents: 2233
diff changeset
742 (set-marker he-search-loc he-string-beg)
e5aee6a3bb75 * hippie-exp.el: Renamed from hippie.el.
Jim Blandy <jimb@redhat.com>
parents: 2233
diff changeset
743 (setq he-search-bw t)))
e5aee6a3bb75 * hippie-exp.el: Renamed from hippie.el.
Jim Blandy <jimb@redhat.com>
parents: 2233
diff changeset
744
e5aee6a3bb75 * hippie-exp.el: Renamed from hippie.el.
Jim Blandy <jimb@redhat.com>
parents: 2233
diff changeset
745 (if (not (equal he-search-string ""))
e5aee6a3bb75 * hippie-exp.el: Renamed from hippie.el.
Jim Blandy <jimb@redhat.com>
parents: 2233
diff changeset
746 (save-excursion
21131
e4acb217b4af (hippie-expand-dabbrev-skip-space): Renamed `he-dabbrev-skip-space'.
Richard M. Stallman <rms@gnu.org>
parents: 18584
diff changeset
747 (save-restriction
e4acb217b4af (hippie-expand-dabbrev-skip-space): Renamed `he-dabbrev-skip-space'.
Richard M. Stallman <rms@gnu.org>
parents: 18584
diff changeset
748 (if hippie-expand-no-restriction
e4acb217b4af (hippie-expand-dabbrev-skip-space): Renamed `he-dabbrev-skip-space'.
Richard M. Stallman <rms@gnu.org>
parents: 18584
diff changeset
749 (widen))
e4acb217b4af (hippie-expand-dabbrev-skip-space): Renamed `he-dabbrev-skip-space'.
Richard M. Stallman <rms@gnu.org>
parents: 18584
diff changeset
750 ;; Try looking backward unless inhibited.
e4acb217b4af (hippie-expand-dabbrev-skip-space): Renamed `he-dabbrev-skip-space'.
Richard M. Stallman <rms@gnu.org>
parents: 18584
diff changeset
751 (if he-search-bw
49549
99be3a1e2589 Cygwin support patch.
Juanma Barranquero <lekktu@gmail.com>
parents: 42205
diff changeset
752 (progn
21131
e4acb217b4af (hippie-expand-dabbrev-skip-space): Renamed `he-dabbrev-skip-space'.
Richard M. Stallman <rms@gnu.org>
parents: 18584
diff changeset
753 (goto-char he-search-loc)
e4acb217b4af (hippie-expand-dabbrev-skip-space): Renamed `he-dabbrev-skip-space'.
Richard M. Stallman <rms@gnu.org>
parents: 18584
diff changeset
754 (setq expansion (he-list-search he-search-string t))
e4acb217b4af (hippie-expand-dabbrev-skip-space): Renamed `he-dabbrev-skip-space'.
Richard M. Stallman <rms@gnu.org>
parents: 18584
diff changeset
755 (set-marker he-search-loc (point))
e4acb217b4af (hippie-expand-dabbrev-skip-space): Renamed `he-dabbrev-skip-space'.
Richard M. Stallman <rms@gnu.org>
parents: 18584
diff changeset
756 (if (not expansion)
e4acb217b4af (hippie-expand-dabbrev-skip-space): Renamed `he-dabbrev-skip-space'.
Richard M. Stallman <rms@gnu.org>
parents: 18584
diff changeset
757 (progn
e4acb217b4af (hippie-expand-dabbrev-skip-space): Renamed `he-dabbrev-skip-space'.
Richard M. Stallman <rms@gnu.org>
parents: 18584
diff changeset
758 (set-marker he-search-loc he-string-end)
e4acb217b4af (hippie-expand-dabbrev-skip-space): Renamed `he-dabbrev-skip-space'.
Richard M. Stallman <rms@gnu.org>
parents: 18584
diff changeset
759 (setq he-search-bw ())))))
e4acb217b4af (hippie-expand-dabbrev-skip-space): Renamed `he-dabbrev-skip-space'.
Richard M. Stallman <rms@gnu.org>
parents: 18584
diff changeset
760
e4acb217b4af (hippie-expand-dabbrev-skip-space): Renamed `he-dabbrev-skip-space'.
Richard M. Stallman <rms@gnu.org>
parents: 18584
diff changeset
761 (if (not expansion) ; Then look forward.
49549
99be3a1e2589 Cygwin support patch.
Juanma Barranquero <lekktu@gmail.com>
parents: 42205
diff changeset
762 (progn
21131
e4acb217b4af (hippie-expand-dabbrev-skip-space): Renamed `he-dabbrev-skip-space'.
Richard M. Stallman <rms@gnu.org>
parents: 18584
diff changeset
763 (goto-char he-search-loc)
e4acb217b4af (hippie-expand-dabbrev-skip-space): Renamed `he-dabbrev-skip-space'.
Richard M. Stallman <rms@gnu.org>
parents: 18584
diff changeset
764 (setq expansion (he-list-search he-search-string nil))
e4acb217b4af (hippie-expand-dabbrev-skip-space): Renamed `he-dabbrev-skip-space'.
Richard M. Stallman <rms@gnu.org>
parents: 18584
diff changeset
765 (set-marker he-search-loc (point)))))))
4130
e5aee6a3bb75 * hippie-exp.el: Renamed from hippie.el.
Jim Blandy <jimb@redhat.com>
parents: 2233
diff changeset
766
e5aee6a3bb75 * hippie-exp.el: Renamed from hippie.el.
Jim Blandy <jimb@redhat.com>
parents: 2233
diff changeset
767 (if (not expansion)
e5aee6a3bb75 * hippie-exp.el: Renamed from hippie.el.
Jim Blandy <jimb@redhat.com>
parents: 2233
diff changeset
768 (progn
e5aee6a3bb75 * hippie-exp.el: Renamed from hippie.el.
Jim Blandy <jimb@redhat.com>
parents: 2233
diff changeset
769 (if old (he-reset-string))
e5aee6a3bb75 * hippie-exp.el: Renamed from hippie.el.
Jim Blandy <jimb@redhat.com>
parents: 2233
diff changeset
770 ())
e5aee6a3bb75 * hippie-exp.el: Renamed from hippie.el.
Jim Blandy <jimb@redhat.com>
parents: 2233
diff changeset
771 (progn
e5aee6a3bb75 * hippie-exp.el: Renamed from hippie.el.
Jim Blandy <jimb@redhat.com>
parents: 2233
diff changeset
772 (he-substitute-string expansion t)
e5aee6a3bb75 * hippie-exp.el: Renamed from hippie.el.
Jim Blandy <jimb@redhat.com>
parents: 2233
diff changeset
773 t))))
e5aee6a3bb75 * hippie-exp.el: Renamed from hippie.el.
Jim Blandy <jimb@redhat.com>
parents: 2233
diff changeset
774
e5aee6a3bb75 * hippie-exp.el: Renamed from hippie.el.
Jim Blandy <jimb@redhat.com>
parents: 2233
diff changeset
775 (defun try-expand-list-all-buffers (old)
e5aee6a3bb75 * hippie-exp.el: Renamed from hippie.el.
Jim Blandy <jimb@redhat.com>
parents: 2233
diff changeset
776 "Try to complete the current list, searching all other buffers.
e5aee6a3bb75 * hippie-exp.el: Renamed from hippie.el.
Jim Blandy <jimb@redhat.com>
parents: 2233
diff changeset
777 The argument OLD has to be nil the first call of this function, and t
e5aee6a3bb75 * hippie-exp.el: Renamed from hippie.el.
Jim Blandy <jimb@redhat.com>
parents: 2233
diff changeset
778 for subsequent calls (for further possible completions of the same
e5aee6a3bb75 * hippie-exp.el: Renamed from hippie.el.
Jim Blandy <jimb@redhat.com>
parents: 2233
diff changeset
779 string). It returns t if a new completion is found, nil otherwise."
e5aee6a3bb75 * hippie-exp.el: Renamed from hippie.el.
Jim Blandy <jimb@redhat.com>
parents: 2233
diff changeset
780 (let ((expansion ())
13207
2b541cc4cd97 (hippie-expand): Removed bug - don't undo from another buffer.
Richard M. Stallman <rms@gnu.org>
parents: 7639
diff changeset
781 (buf (current-buffer))
2b541cc4cd97 (hippie-expand): Removed bug - don't undo from another buffer.
Richard M. Stallman <rms@gnu.org>
parents: 7639
diff changeset
782 (orig-case-fold-search case-fold-search))
4130
e5aee6a3bb75 * hippie-exp.el: Renamed from hippie.el.
Jim Blandy <jimb@redhat.com>
parents: 2233
diff changeset
783 (if (not old)
e5aee6a3bb75 * hippie-exp.el: Renamed from hippie.el.
Jim Blandy <jimb@redhat.com>
parents: 2233
diff changeset
784 (progn
e5aee6a3bb75 * hippie-exp.el: Renamed from hippie.el.
Jim Blandy <jimb@redhat.com>
parents: 2233
diff changeset
785 (he-init-string (he-list-beg) (point))
e5aee6a3bb75 * hippie-exp.el: Renamed from hippie.el.
Jim Blandy <jimb@redhat.com>
parents: 2233
diff changeset
786 (setq he-search-bufs (buffer-list))
13207
2b541cc4cd97 (hippie-expand): Removed bug - don't undo from another buffer.
Richard M. Stallman <rms@gnu.org>
parents: 7639
diff changeset
787 (setq he-searched-n-bufs 0)
4130
e5aee6a3bb75 * hippie-exp.el: Renamed from hippie.el.
Jim Blandy <jimb@redhat.com>
parents: 2233
diff changeset
788 (set-marker he-search-loc 1 (car he-search-bufs))))
e5aee6a3bb75 * hippie-exp.el: Renamed from hippie.el.
Jim Blandy <jimb@redhat.com>
parents: 2233
diff changeset
789
e5aee6a3bb75 * hippie-exp.el: Renamed from hippie.el.
Jim Blandy <jimb@redhat.com>
parents: 2233
diff changeset
790 (if (not (equal he-search-string ""))
49549
99be3a1e2589 Cygwin support patch.
Juanma Barranquero <lekktu@gmail.com>
parents: 42205
diff changeset
791 (while (and he-search-bufs
13207
2b541cc4cd97 (hippie-expand): Removed bug - don't undo from another buffer.
Richard M. Stallman <rms@gnu.org>
parents: 7639
diff changeset
792 (not expansion)
2b541cc4cd97 (hippie-expand): Removed bug - don't undo from another buffer.
Richard M. Stallman <rms@gnu.org>
parents: 7639
diff changeset
793 (or (not hippie-expand-max-buffers)
2b541cc4cd97 (hippie-expand): Removed bug - don't undo from another buffer.
Richard M. Stallman <rms@gnu.org>
parents: 7639
diff changeset
794 (< he-searched-n-bufs hippie-expand-max-buffers)))
4130
e5aee6a3bb75 * hippie-exp.el: Renamed from hippie.el.
Jim Blandy <jimb@redhat.com>
parents: 2233
diff changeset
795 (set-buffer (car he-search-bufs))
e5aee6a3bb75 * hippie-exp.el: Renamed from hippie.el.
Jim Blandy <jimb@redhat.com>
parents: 2233
diff changeset
796 (if (and (not (eq (current-buffer) buf))
21131
e4acb217b4af (hippie-expand-dabbrev-skip-space): Renamed `he-dabbrev-skip-space'.
Richard M. Stallman <rms@gnu.org>
parents: 18584
diff changeset
797 (if hippie-expand-only-buffers
e4acb217b4af (hippie-expand-dabbrev-skip-space): Renamed `he-dabbrev-skip-space'.
Richard M. Stallman <rms@gnu.org>
parents: 18584
diff changeset
798 (he-buffer-member hippie-expand-only-buffers)
e4acb217b4af (hippie-expand-dabbrev-skip-space): Renamed `he-dabbrev-skip-space'.
Richard M. Stallman <rms@gnu.org>
parents: 18584
diff changeset
799 (not (he-buffer-member hippie-expand-ignore-buffers))))
4130
e5aee6a3bb75 * hippie-exp.el: Renamed from hippie.el.
Jim Blandy <jimb@redhat.com>
parents: 2233
diff changeset
800 (save-excursion
21131
e4acb217b4af (hippie-expand-dabbrev-skip-space): Renamed `he-dabbrev-skip-space'.
Richard M. Stallman <rms@gnu.org>
parents: 18584
diff changeset
801 (save-restriction
e4acb217b4af (hippie-expand-dabbrev-skip-space): Renamed `he-dabbrev-skip-space'.
Richard M. Stallman <rms@gnu.org>
parents: 18584
diff changeset
802 (if hippie-expand-no-restriction
e4acb217b4af (hippie-expand-dabbrev-skip-space): Renamed `he-dabbrev-skip-space'.
Richard M. Stallman <rms@gnu.org>
parents: 18584
diff changeset
803 (widen))
e4acb217b4af (hippie-expand-dabbrev-skip-space): Renamed `he-dabbrev-skip-space'.
Richard M. Stallman <rms@gnu.org>
parents: 18584
diff changeset
804 (goto-char he-search-loc)
49549
99be3a1e2589 Cygwin support patch.
Juanma Barranquero <lekktu@gmail.com>
parents: 42205
diff changeset
805 (setq expansion
21131
e4acb217b4af (hippie-expand-dabbrev-skip-space): Renamed `he-dabbrev-skip-space'.
Richard M. Stallman <rms@gnu.org>
parents: 18584
diff changeset
806 (let ((case-fold-search orig-case-fold-search))
e4acb217b4af (hippie-expand-dabbrev-skip-space): Renamed `he-dabbrev-skip-space'.
Richard M. Stallman <rms@gnu.org>
parents: 18584
diff changeset
807 (he-list-search he-search-string nil)))
e4acb217b4af (hippie-expand-dabbrev-skip-space): Renamed `he-dabbrev-skip-space'.
Richard M. Stallman <rms@gnu.org>
parents: 18584
diff changeset
808 (set-marker he-search-loc (point))
e4acb217b4af (hippie-expand-dabbrev-skip-space): Renamed `he-dabbrev-skip-space'.
Richard M. Stallman <rms@gnu.org>
parents: 18584
diff changeset
809 (if (not expansion)
e4acb217b4af (hippie-expand-dabbrev-skip-space): Renamed `he-dabbrev-skip-space'.
Richard M. Stallman <rms@gnu.org>
parents: 18584
diff changeset
810 (progn
e4acb217b4af (hippie-expand-dabbrev-skip-space): Renamed `he-dabbrev-skip-space'.
Richard M. Stallman <rms@gnu.org>
parents: 18584
diff changeset
811 (setq he-search-bufs (cdr he-search-bufs))
e4acb217b4af (hippie-expand-dabbrev-skip-space): Renamed `he-dabbrev-skip-space'.
Richard M. Stallman <rms@gnu.org>
parents: 18584
diff changeset
812 (setq he-searched-n-bufs (1+ he-searched-n-bufs))
e4acb217b4af (hippie-expand-dabbrev-skip-space): Renamed `he-dabbrev-skip-space'.
Richard M. Stallman <rms@gnu.org>
parents: 18584
diff changeset
813 (set-marker he-search-loc 1 (car he-search-bufs))))))
13207
2b541cc4cd97 (hippie-expand): Removed bug - don't undo from another buffer.
Richard M. Stallman <rms@gnu.org>
parents: 7639
diff changeset
814 (setq he-search-bufs (cdr he-search-bufs))
2b541cc4cd97 (hippie-expand): Removed bug - don't undo from another buffer.
Richard M. Stallman <rms@gnu.org>
parents: 7639
diff changeset
815 (set-marker he-search-loc 1 (car he-search-bufs)))))
4130
e5aee6a3bb75 * hippie-exp.el: Renamed from hippie.el.
Jim Blandy <jimb@redhat.com>
parents: 2233
diff changeset
816
e5aee6a3bb75 * hippie-exp.el: Renamed from hippie.el.
Jim Blandy <jimb@redhat.com>
parents: 2233
diff changeset
817 (set-buffer buf)
e5aee6a3bb75 * hippie-exp.el: Renamed from hippie.el.
Jim Blandy <jimb@redhat.com>
parents: 2233
diff changeset
818 (if (not expansion)
e5aee6a3bb75 * hippie-exp.el: Renamed from hippie.el.
Jim Blandy <jimb@redhat.com>
parents: 2233
diff changeset
819 (progn
13207
2b541cc4cd97 (hippie-expand): Removed bug - don't undo from another buffer.
Richard M. Stallman <rms@gnu.org>
parents: 7639
diff changeset
820 (if old (he-reset-string))
4130
e5aee6a3bb75 * hippie-exp.el: Renamed from hippie.el.
Jim Blandy <jimb@redhat.com>
parents: 2233
diff changeset
821 ())
e5aee6a3bb75 * hippie-exp.el: Renamed from hippie.el.
Jim Blandy <jimb@redhat.com>
parents: 2233
diff changeset
822 (progn
e5aee6a3bb75 * hippie-exp.el: Renamed from hippie.el.
Jim Blandy <jimb@redhat.com>
parents: 2233
diff changeset
823 (he-substitute-string expansion t)
e5aee6a3bb75 * hippie-exp.el: Renamed from hippie.el.
Jim Blandy <jimb@redhat.com>
parents: 2233
diff changeset
824 t))))
e5aee6a3bb75 * hippie-exp.el: Renamed from hippie.el.
Jim Blandy <jimb@redhat.com>
parents: 2233
diff changeset
825
49549
99be3a1e2589 Cygwin support patch.
Juanma Barranquero <lekktu@gmail.com>
parents: 42205
diff changeset
826 (defun he-list-search (str reverse)
4130
e5aee6a3bb75 * hippie-exp.el: Renamed from hippie.el.
Jim Blandy <jimb@redhat.com>
parents: 2233
diff changeset
827 (let ((result ())
13207
2b541cc4cd97 (hippie-expand): Removed bug - don't undo from another buffer.
Richard M. Stallman <rms@gnu.org>
parents: 7639
diff changeset
828 beg pos err)
4130
e5aee6a3bb75 * hippie-exp.el: Renamed from hippie.el.
Jim Blandy <jimb@redhat.com>
parents: 2233
diff changeset
829 (while (and (not result)
e5aee6a3bb75 * hippie-exp.el: Renamed from hippie.el.
Jim Blandy <jimb@redhat.com>
parents: 2233
diff changeset
830 (if reverse
e5aee6a3bb75 * hippie-exp.el: Renamed from hippie.el.
Jim Blandy <jimb@redhat.com>
parents: 2233
diff changeset
831 (search-backward str nil t)
e5aee6a3bb75 * hippie-exp.el: Renamed from hippie.el.
Jim Blandy <jimb@redhat.com>
parents: 2233
diff changeset
832 (search-forward str nil t)))
e5aee6a3bb75 * hippie-exp.el: Renamed from hippie.el.
Jim Blandy <jimb@redhat.com>
parents: 2233
diff changeset
833 (setq pos (point))
e5aee6a3bb75 * hippie-exp.el: Renamed from hippie.el.
Jim Blandy <jimb@redhat.com>
parents: 2233
diff changeset
834 (setq beg (match-beginning 0))
e5aee6a3bb75 * hippie-exp.el: Renamed from hippie.el.
Jim Blandy <jimb@redhat.com>
parents: 2233
diff changeset
835 (goto-char beg)
e5aee6a3bb75 * hippie-exp.el: Renamed from hippie.el.
Jim Blandy <jimb@redhat.com>
parents: 2233
diff changeset
836 (setq err ())
e5aee6a3bb75 * hippie-exp.el: Renamed from hippie.el.
Jim Blandy <jimb@redhat.com>
parents: 2233
diff changeset
837 (condition-case ()
13207
2b541cc4cd97 (hippie-expand): Removed bug - don't undo from another buffer.
Richard M. Stallman <rms@gnu.org>
parents: 7639
diff changeset
838 (forward-list 1)
2b541cc4cd97 (hippie-expand): Removed bug - don't undo from another buffer.
Richard M. Stallman <rms@gnu.org>
parents: 7639
diff changeset
839 (error (setq err t)))
49549
99be3a1e2589 Cygwin support patch.
Juanma Barranquero <lekktu@gmail.com>
parents: 42205
diff changeset
840 (if (and reverse
13207
2b541cc4cd97 (hippie-expand): Removed bug - don't undo from another buffer.
Richard M. Stallman <rms@gnu.org>
parents: 7639
diff changeset
841 (> (point) he-string-beg))
2b541cc4cd97 (hippie-expand): Removed bug - don't undo from another buffer.
Richard M. Stallman <rms@gnu.org>
parents: 7639
diff changeset
842 (setq err t))
4130
e5aee6a3bb75 * hippie-exp.el: Renamed from hippie.el.
Jim Blandy <jimb@redhat.com>
parents: 2233
diff changeset
843 (if (not err)
13207
2b541cc4cd97 (hippie-expand): Removed bug - don't undo from another buffer.
Richard M. Stallman <rms@gnu.org>
parents: 7639
diff changeset
844 (progn
21131
e4acb217b4af (hippie-expand-dabbrev-skip-space): Renamed `he-dabbrev-skip-space'.
Richard M. Stallman <rms@gnu.org>
parents: 18584
diff changeset
845 (setq result (buffer-substring-no-properties beg (point)))
13207
2b541cc4cd97 (hippie-expand): Removed bug - don't undo from another buffer.
Richard M. Stallman <rms@gnu.org>
parents: 7639
diff changeset
846 (if (he-string-member result he-tried-table t)
2b541cc4cd97 (hippie-expand): Removed bug - don't undo from another buffer.
Richard M. Stallman <rms@gnu.org>
parents: 7639
diff changeset
847 (setq result nil)))) ; if already in table, ignore
4130
e5aee6a3bb75 * hippie-exp.el: Renamed from hippie.el.
Jim Blandy <jimb@redhat.com>
parents: 2233
diff changeset
848 (goto-char pos))
e5aee6a3bb75 * hippie-exp.el: Renamed from hippie.el.
Jim Blandy <jimb@redhat.com>
parents: 2233
diff changeset
849 result))
e5aee6a3bb75 * hippie-exp.el: Renamed from hippie.el.
Jim Blandy <jimb@redhat.com>
parents: 2233
diff changeset
850
e5aee6a3bb75 * hippie-exp.el: Renamed from hippie.el.
Jim Blandy <jimb@redhat.com>
parents: 2233
diff changeset
851 (defun he-list-beg ()
e5aee6a3bb75 * hippie-exp.el: Renamed from hippie.el.
Jim Blandy <jimb@redhat.com>
parents: 2233
diff changeset
852 (save-excursion
e5aee6a3bb75 * hippie-exp.el: Renamed from hippie.el.
Jim Blandy <jimb@redhat.com>
parents: 2233
diff changeset
853 (condition-case ()
13207
2b541cc4cd97 (hippie-expand): Removed bug - don't undo from another buffer.
Richard M. Stallman <rms@gnu.org>
parents: 7639
diff changeset
854 (backward-up-list 1)
4130
e5aee6a3bb75 * hippie-exp.el: Renamed from hippie.el.
Jim Blandy <jimb@redhat.com>
parents: 2233
diff changeset
855 (error ()))
e5aee6a3bb75 * hippie-exp.el: Renamed from hippie.el.
Jim Blandy <jimb@redhat.com>
parents: 2233
diff changeset
856 (point)))
e5aee6a3bb75 * hippie-exp.el: Renamed from hippie.el.
Jim Blandy <jimb@redhat.com>
parents: 2233
diff changeset
857
1737
d7e9186edefa entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
858 (defun try-expand-all-abbrevs (old)
d7e9186edefa entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
859 "Try to expand word before point according to all abbrev tables.
d7e9186edefa entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
860 The argument OLD has to be nil the first call of this function, and t
d7e9186edefa entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
861 for subsequent calls (for further possible expansions of the same
d7e9186edefa entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
862 string). It returns t if a new expansion is found, nil otherwise."
d7e9186edefa entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
863 (if (not old)
d7e9186edefa entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
864 (progn
d7e9186edefa entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
865 (he-init-string (he-dabbrev-beg) (point))
49549
99be3a1e2589 Cygwin support patch.
Juanma Barranquero <lekktu@gmail.com>
parents: 42205
diff changeset
866 (setq he-expand-list
1737
d7e9186edefa entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
867 (and (not (equal he-search-string ""))
d7e9186edefa entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
868 (mapcar (function (lambda (sym)
13207
2b541cc4cd97 (hippie-expand): Removed bug - don't undo from another buffer.
Richard M. Stallman <rms@gnu.org>
parents: 7639
diff changeset
869 (if (and (boundp sym) (vectorp (eval sym)))
2b541cc4cd97 (hippie-expand): Removed bug - don't undo from another buffer.
Richard M. Stallman <rms@gnu.org>
parents: 7639
diff changeset
870 (abbrev-expansion (downcase he-search-string)
2b541cc4cd97 (hippie-expand): Removed bug - don't undo from another buffer.
Richard M. Stallman <rms@gnu.org>
parents: 7639
diff changeset
871 (eval sym)))))
49549
99be3a1e2589 Cygwin support patch.
Juanma Barranquero <lekktu@gmail.com>
parents: 42205
diff changeset
872 (append '(local-abbrev-table
1737
d7e9186edefa entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
873 global-abbrev-table)
d7e9186edefa entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
874 abbrev-table-name-list))))))
d7e9186edefa entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
875 (while (and he-expand-list
d7e9186edefa entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
876 (or (not (car he-expand-list))
13207
2b541cc4cd97 (hippie-expand): Removed bug - don't undo from another buffer.
Richard M. Stallman <rms@gnu.org>
parents: 7639
diff changeset
877 (he-string-member (car he-expand-list) he-tried-table t)))
1737
d7e9186edefa entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
878 (setq he-expand-list (cdr he-expand-list)))
d7e9186edefa entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
879 (if (null he-expand-list)
d7e9186edefa entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
880 (progn
13207
2b541cc4cd97 (hippie-expand): Removed bug - don't undo from another buffer.
Richard M. Stallman <rms@gnu.org>
parents: 7639
diff changeset
881 (if old (he-reset-string))
1737
d7e9186edefa entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
882 ())
d7e9186edefa entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
883 (progn
4130
e5aee6a3bb75 * hippie-exp.el: Renamed from hippie.el.
Jim Blandy <jimb@redhat.com>
parents: 2233
diff changeset
884 (he-substitute-string (car he-expand-list) t)
1737
d7e9186edefa entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
885 (setq he-expand-list (cdr he-expand-list))
d7e9186edefa entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
886 t)))
d7e9186edefa entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
887
d7e9186edefa entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
888 (defun try-expand-dabbrev (old)
d7e9186edefa entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
889 "Try to expand word \"dynamically\", searching the current buffer.
d7e9186edefa entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
890 The argument OLD has to be nil the first call of this function, and t
d7e9186edefa entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
891 for subsequent calls (for further possible expansions of the same
d7e9186edefa entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
892 string). It returns t if a new expansion is found, nil otherwise."
d7e9186edefa entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
893 (let ((expansion ()))
d7e9186edefa entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
894 (if (not old)
d7e9186edefa entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
895 (progn
d7e9186edefa entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
896 (he-init-string (he-dabbrev-beg) (point))
4130
e5aee6a3bb75 * hippie-exp.el: Renamed from hippie.el.
Jim Blandy <jimb@redhat.com>
parents: 2233
diff changeset
897 (set-marker he-search-loc he-string-beg)
1737
d7e9186edefa entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
898 (setq he-search-bw t)))
d7e9186edefa entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
899
d7e9186edefa entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
900 (if (not (equal he-search-string ""))
d7e9186edefa entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
901 (save-excursion
21131
e4acb217b4af (hippie-expand-dabbrev-skip-space): Renamed `he-dabbrev-skip-space'.
Richard M. Stallman <rms@gnu.org>
parents: 18584
diff changeset
902 (save-restriction
e4acb217b4af (hippie-expand-dabbrev-skip-space): Renamed `he-dabbrev-skip-space'.
Richard M. Stallman <rms@gnu.org>
parents: 18584
diff changeset
903 (if hippie-expand-no-restriction
e4acb217b4af (hippie-expand-dabbrev-skip-space): Renamed `he-dabbrev-skip-space'.
Richard M. Stallman <rms@gnu.org>
parents: 18584
diff changeset
904 (widen))
e4acb217b4af (hippie-expand-dabbrev-skip-space): Renamed `he-dabbrev-skip-space'.
Richard M. Stallman <rms@gnu.org>
parents: 18584
diff changeset
905 ;; Try looking backward unless inhibited.
e4acb217b4af (hippie-expand-dabbrev-skip-space): Renamed `he-dabbrev-skip-space'.
Richard M. Stallman <rms@gnu.org>
parents: 18584
diff changeset
906 (if he-search-bw
49549
99be3a1e2589 Cygwin support patch.
Juanma Barranquero <lekktu@gmail.com>
parents: 42205
diff changeset
907 (progn
21131
e4acb217b4af (hippie-expand-dabbrev-skip-space): Renamed `he-dabbrev-skip-space'.
Richard M. Stallman <rms@gnu.org>
parents: 18584
diff changeset
908 (goto-char he-search-loc)
e4acb217b4af (hippie-expand-dabbrev-skip-space): Renamed `he-dabbrev-skip-space'.
Richard M. Stallman <rms@gnu.org>
parents: 18584
diff changeset
909 (setq expansion (he-dabbrev-search he-search-string t))
e4acb217b4af (hippie-expand-dabbrev-skip-space): Renamed `he-dabbrev-skip-space'.
Richard M. Stallman <rms@gnu.org>
parents: 18584
diff changeset
910 (set-marker he-search-loc (point))
e4acb217b4af (hippie-expand-dabbrev-skip-space): Renamed `he-dabbrev-skip-space'.
Richard M. Stallman <rms@gnu.org>
parents: 18584
diff changeset
911 (if (not expansion)
e4acb217b4af (hippie-expand-dabbrev-skip-space): Renamed `he-dabbrev-skip-space'.
Richard M. Stallman <rms@gnu.org>
parents: 18584
diff changeset
912 (progn
e4acb217b4af (hippie-expand-dabbrev-skip-space): Renamed `he-dabbrev-skip-space'.
Richard M. Stallman <rms@gnu.org>
parents: 18584
diff changeset
913 (set-marker he-search-loc he-string-end)
e4acb217b4af (hippie-expand-dabbrev-skip-space): Renamed `he-dabbrev-skip-space'.
Richard M. Stallman <rms@gnu.org>
parents: 18584
diff changeset
914 (setq he-search-bw ())))))
e4acb217b4af (hippie-expand-dabbrev-skip-space): Renamed `he-dabbrev-skip-space'.
Richard M. Stallman <rms@gnu.org>
parents: 18584
diff changeset
915
e4acb217b4af (hippie-expand-dabbrev-skip-space): Renamed `he-dabbrev-skip-space'.
Richard M. Stallman <rms@gnu.org>
parents: 18584
diff changeset
916 (if (not expansion) ; Then look forward.
49549
99be3a1e2589 Cygwin support patch.
Juanma Barranquero <lekktu@gmail.com>
parents: 42205
diff changeset
917 (progn
21131
e4acb217b4af (hippie-expand-dabbrev-skip-space): Renamed `he-dabbrev-skip-space'.
Richard M. Stallman <rms@gnu.org>
parents: 18584
diff changeset
918 (goto-char he-search-loc)
e4acb217b4af (hippie-expand-dabbrev-skip-space): Renamed `he-dabbrev-skip-space'.
Richard M. Stallman <rms@gnu.org>
parents: 18584
diff changeset
919 (setq expansion (he-dabbrev-search he-search-string nil))
e4acb217b4af (hippie-expand-dabbrev-skip-space): Renamed `he-dabbrev-skip-space'.
Richard M. Stallman <rms@gnu.org>
parents: 18584
diff changeset
920 (set-marker he-search-loc (point)))))))
49549
99be3a1e2589 Cygwin support patch.
Juanma Barranquero <lekktu@gmail.com>
parents: 42205
diff changeset
921
1737
d7e9186edefa entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
922 (if (not expansion)
d7e9186edefa entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
923 (progn
13207
2b541cc4cd97 (hippie-expand): Removed bug - don't undo from another buffer.
Richard M. Stallman <rms@gnu.org>
parents: 7639
diff changeset
924 (if old (he-reset-string))
1737
d7e9186edefa entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
925 ())
d7e9186edefa entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
926 (progn
d7e9186edefa entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
927 (he-substitute-string expansion t)
d7e9186edefa entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
928 t))))
d7e9186edefa entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
929
d7e9186edefa entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
930 (defun try-expand-dabbrev-all-buffers (old)
106377
10ceddf3698e (try-expand-dabbrev-visible): Preserve point in the
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 105994
diff changeset
931 "Try to expand word \"dynamically\", searching all other buffers.
1737
d7e9186edefa entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
932 The argument OLD has to be nil the first call of this function, and t
d7e9186edefa entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
933 for subsequent calls (for further possible expansions of the same
d7e9186edefa entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
934 string). It returns t if a new expansion is found, nil otherwise."
d7e9186edefa entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
935 (let ((expansion ())
13207
2b541cc4cd97 (hippie-expand): Removed bug - don't undo from another buffer.
Richard M. Stallman <rms@gnu.org>
parents: 7639
diff changeset
936 (buf (current-buffer))
2b541cc4cd97 (hippie-expand): Removed bug - don't undo from another buffer.
Richard M. Stallman <rms@gnu.org>
parents: 7639
diff changeset
937 (orig-case-fold-search case-fold-search))
1737
d7e9186edefa entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
938 (if (not old)
d7e9186edefa entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
939 (progn
d7e9186edefa entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
940 (he-init-string (he-dabbrev-beg) (point))
4130
e5aee6a3bb75 * hippie-exp.el: Renamed from hippie.el.
Jim Blandy <jimb@redhat.com>
parents: 2233
diff changeset
941 (setq he-search-bufs (buffer-list))
13207
2b541cc4cd97 (hippie-expand): Removed bug - don't undo from another buffer.
Richard M. Stallman <rms@gnu.org>
parents: 7639
diff changeset
942 (setq he-searched-n-bufs 0)
4130
e5aee6a3bb75 * hippie-exp.el: Renamed from hippie.el.
Jim Blandy <jimb@redhat.com>
parents: 2233
diff changeset
943 (set-marker he-search-loc 1 (car he-search-bufs))))
1737
d7e9186edefa entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
944
d7e9186edefa entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
945 (if (not (equal he-search-string ""))
49549
99be3a1e2589 Cygwin support patch.
Juanma Barranquero <lekktu@gmail.com>
parents: 42205
diff changeset
946 (while (and he-search-bufs
13207
2b541cc4cd97 (hippie-expand): Removed bug - don't undo from another buffer.
Richard M. Stallman <rms@gnu.org>
parents: 7639
diff changeset
947 (not expansion)
2b541cc4cd97 (hippie-expand): Removed bug - don't undo from another buffer.
Richard M. Stallman <rms@gnu.org>
parents: 7639
diff changeset
948 (or (not hippie-expand-max-buffers)
2b541cc4cd97 (hippie-expand): Removed bug - don't undo from another buffer.
Richard M. Stallman <rms@gnu.org>
parents: 7639
diff changeset
949 (< he-searched-n-bufs hippie-expand-max-buffers)))
1737
d7e9186edefa entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
950 (set-buffer (car he-search-bufs))
d7e9186edefa entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
951 (if (and (not (eq (current-buffer) buf))
21131
e4acb217b4af (hippie-expand-dabbrev-skip-space): Renamed `he-dabbrev-skip-space'.
Richard M. Stallman <rms@gnu.org>
parents: 18584
diff changeset
952 (if hippie-expand-only-buffers
e4acb217b4af (hippie-expand-dabbrev-skip-space): Renamed `he-dabbrev-skip-space'.
Richard M. Stallman <rms@gnu.org>
parents: 18584
diff changeset
953 (he-buffer-member hippie-expand-only-buffers)
e4acb217b4af (hippie-expand-dabbrev-skip-space): Renamed `he-dabbrev-skip-space'.
Richard M. Stallman <rms@gnu.org>
parents: 18584
diff changeset
954 (not (he-buffer-member hippie-expand-ignore-buffers))))
1737
d7e9186edefa entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
955 (save-excursion
21131
e4acb217b4af (hippie-expand-dabbrev-skip-space): Renamed `he-dabbrev-skip-space'.
Richard M. Stallman <rms@gnu.org>
parents: 18584
diff changeset
956 (save-restriction
e4acb217b4af (hippie-expand-dabbrev-skip-space): Renamed `he-dabbrev-skip-space'.
Richard M. Stallman <rms@gnu.org>
parents: 18584
diff changeset
957 (if hippie-expand-no-restriction
e4acb217b4af (hippie-expand-dabbrev-skip-space): Renamed `he-dabbrev-skip-space'.
Richard M. Stallman <rms@gnu.org>
parents: 18584
diff changeset
958 (widen))
e4acb217b4af (hippie-expand-dabbrev-skip-space): Renamed `he-dabbrev-skip-space'.
Richard M. Stallman <rms@gnu.org>
parents: 18584
diff changeset
959 (goto-char he-search-loc)
e4acb217b4af (hippie-expand-dabbrev-skip-space): Renamed `he-dabbrev-skip-space'.
Richard M. Stallman <rms@gnu.org>
parents: 18584
diff changeset
960 (setq expansion
e4acb217b4af (hippie-expand-dabbrev-skip-space): Renamed `he-dabbrev-skip-space'.
Richard M. Stallman <rms@gnu.org>
parents: 18584
diff changeset
961 (let ((case-fold-search orig-case-fold-search))
e4acb217b4af (hippie-expand-dabbrev-skip-space): Renamed `he-dabbrev-skip-space'.
Richard M. Stallman <rms@gnu.org>
parents: 18584
diff changeset
962 (he-dabbrev-search he-search-string nil)))
e4acb217b4af (hippie-expand-dabbrev-skip-space): Renamed `he-dabbrev-skip-space'.
Richard M. Stallman <rms@gnu.org>
parents: 18584
diff changeset
963 (set-marker he-search-loc (point))
e4acb217b4af (hippie-expand-dabbrev-skip-space): Renamed `he-dabbrev-skip-space'.
Richard M. Stallman <rms@gnu.org>
parents: 18584
diff changeset
964 (if (not expansion)
e4acb217b4af (hippie-expand-dabbrev-skip-space): Renamed `he-dabbrev-skip-space'.
Richard M. Stallman <rms@gnu.org>
parents: 18584
diff changeset
965 (progn
e4acb217b4af (hippie-expand-dabbrev-skip-space): Renamed `he-dabbrev-skip-space'.
Richard M. Stallman <rms@gnu.org>
parents: 18584
diff changeset
966 (setq he-search-bufs (cdr he-search-bufs))
e4acb217b4af (hippie-expand-dabbrev-skip-space): Renamed `he-dabbrev-skip-space'.
Richard M. Stallman <rms@gnu.org>
parents: 18584
diff changeset
967 (setq he-searched-n-bufs (1+ he-searched-n-bufs))
e4acb217b4af (hippie-expand-dabbrev-skip-space): Renamed `he-dabbrev-skip-space'.
Richard M. Stallman <rms@gnu.org>
parents: 18584
diff changeset
968 (set-marker he-search-loc 1 (car he-search-bufs))))))
13207
2b541cc4cd97 (hippie-expand): Removed bug - don't undo from another buffer.
Richard M. Stallman <rms@gnu.org>
parents: 7639
diff changeset
969 (setq he-search-bufs (cdr he-search-bufs))
2b541cc4cd97 (hippie-expand): Removed bug - don't undo from another buffer.
Richard M. Stallman <rms@gnu.org>
parents: 7639
diff changeset
970 (set-marker he-search-loc 1 (car he-search-bufs)))))
1737
d7e9186edefa entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
971
d7e9186edefa entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
972 (set-buffer buf)
d7e9186edefa entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
973 (if (not expansion)
d7e9186edefa entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
974 (progn
13207
2b541cc4cd97 (hippie-expand): Removed bug - don't undo from another buffer.
Richard M. Stallman <rms@gnu.org>
parents: 7639
diff changeset
975 (if old (he-reset-string))
2b541cc4cd97 (hippie-expand): Removed bug - don't undo from another buffer.
Richard M. Stallman <rms@gnu.org>
parents: 7639
diff changeset
976 ())
2b541cc4cd97 (hippie-expand): Removed bug - don't undo from another buffer.
Richard M. Stallman <rms@gnu.org>
parents: 7639
diff changeset
977 (progn
2b541cc4cd97 (hippie-expand): Removed bug - don't undo from another buffer.
Richard M. Stallman <rms@gnu.org>
parents: 7639
diff changeset
978 (he-substitute-string expansion t)
2b541cc4cd97 (hippie-expand): Removed bug - don't undo from another buffer.
Richard M. Stallman <rms@gnu.org>
parents: 7639
diff changeset
979 t))))
2b541cc4cd97 (hippie-expand): Removed bug - don't undo from another buffer.
Richard M. Stallman <rms@gnu.org>
parents: 7639
diff changeset
980
2b541cc4cd97 (hippie-expand): Removed bug - don't undo from another buffer.
Richard M. Stallman <rms@gnu.org>
parents: 7639
diff changeset
981 ;; Thanks go to Jeff Dairiki <dairiki@faraday.apl.washington.edu> who
2b541cc4cd97 (hippie-expand): Removed bug - don't undo from another buffer.
Richard M. Stallman <rms@gnu.org>
parents: 7639
diff changeset
982 ;; suggested this one.
2b541cc4cd97 (hippie-expand): Removed bug - don't undo from another buffer.
Richard M. Stallman <rms@gnu.org>
parents: 7639
diff changeset
983 (defun try-expand-dabbrev-visible (old)
2b541cc4cd97 (hippie-expand): Removed bug - don't undo from another buffer.
Richard M. Stallman <rms@gnu.org>
parents: 7639
diff changeset
984 "Try to expand word \"dynamically\", searching visible window parts.
2b541cc4cd97 (hippie-expand): Removed bug - don't undo from another buffer.
Richard M. Stallman <rms@gnu.org>
parents: 7639
diff changeset
985 The argument OLD has to be nil the first call of this function, and t
2b541cc4cd97 (hippie-expand): Removed bug - don't undo from another buffer.
Richard M. Stallman <rms@gnu.org>
parents: 7639
diff changeset
986 for subsequent calls (for further possible expansions of the same
2b541cc4cd97 (hippie-expand): Removed bug - don't undo from another buffer.
Richard M. Stallman <rms@gnu.org>
parents: 7639
diff changeset
987 string). It returns t if a new expansion is found, nil otherwise."
2b541cc4cd97 (hippie-expand): Removed bug - don't undo from another buffer.
Richard M. Stallman <rms@gnu.org>
parents: 7639
diff changeset
988 (let ((expansion ())
2b541cc4cd97 (hippie-expand): Removed bug - don't undo from another buffer.
Richard M. Stallman <rms@gnu.org>
parents: 7639
diff changeset
989 (flag (if (frame-visible-p (window-frame (selected-window)))
2b541cc4cd97 (hippie-expand): Removed bug - don't undo from another buffer.
Richard M. Stallman <rms@gnu.org>
parents: 7639
diff changeset
990 'visible t)))
106377
10ceddf3698e (try-expand-dabbrev-visible): Preserve point in the
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 105994
diff changeset
991 (unless old
10ceddf3698e (try-expand-dabbrev-visible): Preserve point in the
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 105994
diff changeset
992 (he-init-string (he-dabbrev-beg) (point))
10ceddf3698e (try-expand-dabbrev-visible): Preserve point in the
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 105994
diff changeset
993 (setq he-search-window (selected-window))
10ceddf3698e (try-expand-dabbrev-visible): Preserve point in the
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 105994
diff changeset
994 (set-marker he-search-loc
10ceddf3698e (try-expand-dabbrev-visible): Preserve point in the
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 105994
diff changeset
995 (window-start he-search-window)
10ceddf3698e (try-expand-dabbrev-visible): Preserve point in the
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 105994
diff changeset
996 (window-buffer he-search-window)))
13207
2b541cc4cd97 (hippie-expand): Removed bug - don't undo from another buffer.
Richard M. Stallman <rms@gnu.org>
parents: 7639
diff changeset
997
2b541cc4cd97 (hippie-expand): Removed bug - don't undo from another buffer.
Richard M. Stallman <rms@gnu.org>
parents: 7639
diff changeset
998 (while (and (not (equal he-search-string ""))
106377
10ceddf3698e (try-expand-dabbrev-visible): Preserve point in the
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 105994
diff changeset
999 (marker-position he-search-loc)
10ceddf3698e (try-expand-dabbrev-visible): Preserve point in the
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 105994
diff changeset
1000 (not expansion))
105994
009383a57ce8 * x-dnd.el (x-dnd-maybe-call-test-function):
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 105939
diff changeset
1001 (with-current-buffer (marker-buffer he-search-loc)
106377
10ceddf3698e (try-expand-dabbrev-visible): Preserve point in the
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 105994
diff changeset
1002 (save-excursion
10ceddf3698e (try-expand-dabbrev-visible): Preserve point in the
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 105994
diff changeset
1003 (goto-char he-search-loc)
10ceddf3698e (try-expand-dabbrev-visible): Preserve point in the
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 105994
diff changeset
1004 (setq expansion (he-dabbrev-search he-search-string ()
10ceddf3698e (try-expand-dabbrev-visible): Preserve point in the
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 105994
diff changeset
1005 (window-end he-search-window)))
10ceddf3698e (try-expand-dabbrev-visible): Preserve point in the
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 105994
diff changeset
1006 (if (and expansion
10ceddf3698e (try-expand-dabbrev-visible): Preserve point in the
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 105994
diff changeset
1007 (eq (marker-buffer he-string-beg) (current-buffer))
10ceddf3698e (try-expand-dabbrev-visible): Preserve point in the
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 105994
diff changeset
1008 (eq (marker-position he-string-beg) (match-beginning 0)))
10ceddf3698e (try-expand-dabbrev-visible): Preserve point in the
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 105994
diff changeset
1009 (setq expansion
10ceddf3698e (try-expand-dabbrev-visible): Preserve point in the
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 105994
diff changeset
1010 (he-dabbrev-search he-search-string ()
10ceddf3698e (try-expand-dabbrev-visible): Preserve point in the
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 105994
diff changeset
1011 (window-end he-search-window))))
10ceddf3698e (try-expand-dabbrev-visible): Preserve point in the
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 105994
diff changeset
1012 (set-marker he-search-loc (point) (current-buffer))))
10ceddf3698e (try-expand-dabbrev-visible): Preserve point in the
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 105994
diff changeset
1013 (unless expansion
10ceddf3698e (try-expand-dabbrev-visible): Preserve point in the
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 105994
diff changeset
1014 (setq he-search-window (next-window he-search-window nil flag))
10ceddf3698e (try-expand-dabbrev-visible): Preserve point in the
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 105994
diff changeset
1015 (if (eq he-search-window (selected-window))
10ceddf3698e (try-expand-dabbrev-visible): Preserve point in the
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 105994
diff changeset
1016 (set-marker he-search-loc nil)
10ceddf3698e (try-expand-dabbrev-visible): Preserve point in the
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 105994
diff changeset
1017 (set-marker he-search-loc (window-start he-search-window)
10ceddf3698e (try-expand-dabbrev-visible): Preserve point in the
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 105994
diff changeset
1018 (window-buffer he-search-window)))))
49549
99be3a1e2589 Cygwin support patch.
Juanma Barranquero <lekktu@gmail.com>
parents: 42205
diff changeset
1019
13207
2b541cc4cd97 (hippie-expand): Removed bug - don't undo from another buffer.
Richard M. Stallman <rms@gnu.org>
parents: 7639
diff changeset
1020 (if (not expansion)
2b541cc4cd97 (hippie-expand): Removed bug - don't undo from another buffer.
Richard M. Stallman <rms@gnu.org>
parents: 7639
diff changeset
1021 (progn
2b541cc4cd97 (hippie-expand): Removed bug - don't undo from another buffer.
Richard M. Stallman <rms@gnu.org>
parents: 7639
diff changeset
1022 (if old (he-reset-string))
1737
d7e9186edefa entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1023 ())
d7e9186edefa entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1024 (progn
d7e9186edefa entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1025 (he-substitute-string expansion t)
d7e9186edefa entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1026 t))))
d7e9186edefa entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1027
13207
2b541cc4cd97 (hippie-expand): Removed bug - don't undo from another buffer.
Richard M. Stallman <rms@gnu.org>
parents: 7639
diff changeset
1028 (defun he-dabbrev-search (pattern &optional reverse limit)
2b541cc4cd97 (hippie-expand): Removed bug - don't undo from another buffer.
Richard M. Stallman <rms@gnu.org>
parents: 7639
diff changeset
1029 (let ((result ())
21131
e4acb217b4af (hippie-expand-dabbrev-skip-space): Renamed `he-dabbrev-skip-space'.
Richard M. Stallman <rms@gnu.org>
parents: 18584
diff changeset
1030 (regpat (cond ((not hippie-expand-dabbrev-as-symbol)
e4acb217b4af (hippie-expand-dabbrev-skip-space): Renamed `he-dabbrev-skip-space'.
Richard M. Stallman <rms@gnu.org>
parents: 18584
diff changeset
1031 (concat "\\<" (regexp-quote pattern) "\\sw+"))
e4acb217b4af (hippie-expand-dabbrev-skip-space): Renamed `he-dabbrev-skip-space'.
Richard M. Stallman <rms@gnu.org>
parents: 18584
diff changeset
1032 ((eq (char-syntax (aref pattern 0)) ?_)
e4acb217b4af (hippie-expand-dabbrev-skip-space): Renamed `he-dabbrev-skip-space'.
Richard M. Stallman <rms@gnu.org>
parents: 18584
diff changeset
1033 (concat (regexp-quote pattern) "\\(\\sw\\|\\s_\\)+"))
e4acb217b4af (hippie-expand-dabbrev-skip-space): Renamed `he-dabbrev-skip-space'.
Richard M. Stallman <rms@gnu.org>
parents: 18584
diff changeset
1034 (t
e4acb217b4af (hippie-expand-dabbrev-skip-space): Renamed `he-dabbrev-skip-space'.
Richard M. Stallman <rms@gnu.org>
parents: 18584
diff changeset
1035 (concat "\\<" (regexp-quote pattern)
e4acb217b4af (hippie-expand-dabbrev-skip-space): Renamed `he-dabbrev-skip-space'.
Richard M. Stallman <rms@gnu.org>
parents: 18584
diff changeset
1036 "\\(\\sw\\|\\s_\\)+")))))
49549
99be3a1e2589 Cygwin support patch.
Juanma Barranquero <lekktu@gmail.com>
parents: 42205
diff changeset
1037 (while (and (not result)
1737
d7e9186edefa entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1038 (if reverse
13207
2b541cc4cd97 (hippie-expand): Removed bug - don't undo from another buffer.
Richard M. Stallman <rms@gnu.org>
parents: 7639
diff changeset
1039 (re-search-backward regpat limit t)
2b541cc4cd97 (hippie-expand): Removed bug - don't undo from another buffer.
Richard M. Stallman <rms@gnu.org>
parents: 7639
diff changeset
1040 (re-search-forward regpat limit t)))
21131
e4acb217b4af (hippie-expand-dabbrev-skip-space): Renamed `he-dabbrev-skip-space'.
Richard M. Stallman <rms@gnu.org>
parents: 18584
diff changeset
1041 (setq result (buffer-substring-no-properties (match-beginning 0)
e4acb217b4af (hippie-expand-dabbrev-skip-space): Renamed `he-dabbrev-skip-space'.
Richard M. Stallman <rms@gnu.org>
parents: 18584
diff changeset
1042 (match-end 0)))
e4acb217b4af (hippie-expand-dabbrev-skip-space): Renamed `he-dabbrev-skip-space'.
Richard M. Stallman <rms@gnu.org>
parents: 18584
diff changeset
1043 (if (or (and hippie-expand-dabbrev-as-symbol
e4acb217b4af (hippie-expand-dabbrev-skip-space): Renamed `he-dabbrev-skip-space'.
Richard M. Stallman <rms@gnu.org>
parents: 18584
diff changeset
1044 (> (match-beginning 0) (point-min))
13207
2b541cc4cd97 (hippie-expand): Removed bug - don't undo from another buffer.
Richard M. Stallman <rms@gnu.org>
parents: 7639
diff changeset
1045 (memq (char-syntax (char-after (1- (match-beginning 0))))
2b541cc4cd97 (hippie-expand): Removed bug - don't undo from another buffer.
Richard M. Stallman <rms@gnu.org>
parents: 7639
diff changeset
1046 '(?_ ?w)))
2b541cc4cd97 (hippie-expand): Removed bug - don't undo from another buffer.
Richard M. Stallman <rms@gnu.org>
parents: 7639
diff changeset
1047 (he-string-member result he-tried-table t))
2b541cc4cd97 (hippie-expand): Removed bug - don't undo from another buffer.
Richard M. Stallman <rms@gnu.org>
parents: 7639
diff changeset
1048 (setq result nil))) ; ignore if bad prefix or already in table
1737
d7e9186edefa entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1049 result))
d7e9186edefa entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1050
d7e9186edefa entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1051 (defun he-dabbrev-beg ()
13207
2b541cc4cd97 (hippie-expand): Removed bug - don't undo from another buffer.
Richard M. Stallman <rms@gnu.org>
parents: 7639
diff changeset
1052 (let ((op (point)))
2b541cc4cd97 (hippie-expand): Removed bug - don't undo from another buffer.
Richard M. Stallman <rms@gnu.org>
parents: 7639
diff changeset
1053 (save-excursion
21131
e4acb217b4af (hippie-expand-dabbrev-skip-space): Renamed `he-dabbrev-skip-space'.
Richard M. Stallman <rms@gnu.org>
parents: 18584
diff changeset
1054 (if hippie-expand-dabbrev-skip-space
13207
2b541cc4cd97 (hippie-expand): Removed bug - don't undo from another buffer.
Richard M. Stallman <rms@gnu.org>
parents: 7639
diff changeset
1055 (skip-syntax-backward ". "))
21131
e4acb217b4af (hippie-expand-dabbrev-skip-space): Renamed `he-dabbrev-skip-space'.
Richard M. Stallman <rms@gnu.org>
parents: 18584
diff changeset
1056 (if (= (skip-syntax-backward (if hippie-expand-dabbrev-as-symbol
e4acb217b4af (hippie-expand-dabbrev-skip-space): Renamed `he-dabbrev-skip-space'.
Richard M. Stallman <rms@gnu.org>
parents: 18584
diff changeset
1057 "w_" "w"))
e4acb217b4af (hippie-expand-dabbrev-skip-space): Renamed `he-dabbrev-skip-space'.
Richard M. Stallman <rms@gnu.org>
parents: 18584
diff changeset
1058 0)
13207
2b541cc4cd97 (hippie-expand): Removed bug - don't undo from another buffer.
Richard M. Stallman <rms@gnu.org>
parents: 7639
diff changeset
1059 op
2b541cc4cd97 (hippie-expand): Removed bug - don't undo from another buffer.
Richard M. Stallman <rms@gnu.org>
parents: 7639
diff changeset
1060 (point)))))
2b541cc4cd97 (hippie-expand): Removed bug - don't undo from another buffer.
Richard M. Stallman <rms@gnu.org>
parents: 7639
diff changeset
1061
2b541cc4cd97 (hippie-expand): Removed bug - don't undo from another buffer.
Richard M. Stallman <rms@gnu.org>
parents: 7639
diff changeset
1062 (defun try-expand-dabbrev-from-kill (old)
2b541cc4cd97 (hippie-expand): Removed bug - don't undo from another buffer.
Richard M. Stallman <rms@gnu.org>
parents: 7639
diff changeset
1063 "Try to expand word \"dynamically\", searching the kill ring.
2b541cc4cd97 (hippie-expand): Removed bug - don't undo from another buffer.
Richard M. Stallman <rms@gnu.org>
parents: 7639
diff changeset
1064 The argument OLD has to be nil the first call of this function, and t
2b541cc4cd97 (hippie-expand): Removed bug - don't undo from another buffer.
Richard M. Stallman <rms@gnu.org>
parents: 7639
diff changeset
1065 for subsequent calls (for further possible completions of the same
2b541cc4cd97 (hippie-expand): Removed bug - don't undo from another buffer.
Richard M. Stallman <rms@gnu.org>
parents: 7639
diff changeset
1066 string). It returns t if a new completion is found, nil otherwise."
2b541cc4cd97 (hippie-expand): Removed bug - don't undo from another buffer.
Richard M. Stallman <rms@gnu.org>
parents: 7639
diff changeset
1067 (let ((expansion ()))
2b541cc4cd97 (hippie-expand): Removed bug - don't undo from another buffer.
Richard M. Stallman <rms@gnu.org>
parents: 7639
diff changeset
1068 (if (not old)
49549
99be3a1e2589 Cygwin support patch.
Juanma Barranquero <lekktu@gmail.com>
parents: 42205
diff changeset
1069 (progn
13207
2b541cc4cd97 (hippie-expand): Removed bug - don't undo from another buffer.
Richard M. Stallman <rms@gnu.org>
parents: 7639
diff changeset
1070 (he-init-string (he-dabbrev-beg) (point))
2b541cc4cd97 (hippie-expand): Removed bug - don't undo from another buffer.
Richard M. Stallman <rms@gnu.org>
parents: 7639
diff changeset
1071 (setq he-expand-list
2b541cc4cd97 (hippie-expand): Removed bug - don't undo from another buffer.
Richard M. Stallman <rms@gnu.org>
parents: 7639
diff changeset
1072 (if (not (equal he-search-string ""))
2b541cc4cd97 (hippie-expand): Removed bug - don't undo from another buffer.
Richard M. Stallman <rms@gnu.org>
parents: 7639
diff changeset
1073 kill-ring))
2b541cc4cd97 (hippie-expand): Removed bug - don't undo from another buffer.
Richard M. Stallman <rms@gnu.org>
parents: 7639
diff changeset
1074 (setq he-search-loc2 0)))
2b541cc4cd97 (hippie-expand): Removed bug - don't undo from another buffer.
Richard M. Stallman <rms@gnu.org>
parents: 7639
diff changeset
1075 (if (not (equal he-search-string ""))
2b541cc4cd97 (hippie-expand): Removed bug - don't undo from another buffer.
Richard M. Stallman <rms@gnu.org>
parents: 7639
diff changeset
1076 (setq expansion (he-dabbrev-kill-search he-search-string)))
2b541cc4cd97 (hippie-expand): Removed bug - don't undo from another buffer.
Richard M. Stallman <rms@gnu.org>
parents: 7639
diff changeset
1077 (if (not expansion)
2b541cc4cd97 (hippie-expand): Removed bug - don't undo from another buffer.
Richard M. Stallman <rms@gnu.org>
parents: 7639
diff changeset
1078 (progn
2b541cc4cd97 (hippie-expand): Removed bug - don't undo from another buffer.
Richard M. Stallman <rms@gnu.org>
parents: 7639
diff changeset
1079 (if old (he-reset-string))
2b541cc4cd97 (hippie-expand): Removed bug - don't undo from another buffer.
Richard M. Stallman <rms@gnu.org>
parents: 7639
diff changeset
1080 ())
2b541cc4cd97 (hippie-expand): Removed bug - don't undo from another buffer.
Richard M. Stallman <rms@gnu.org>
parents: 7639
diff changeset
1081 (progn
2b541cc4cd97 (hippie-expand): Removed bug - don't undo from another buffer.
Richard M. Stallman <rms@gnu.org>
parents: 7639
diff changeset
1082 (he-substitute-string expansion t)
2b541cc4cd97 (hippie-expand): Removed bug - don't undo from another buffer.
Richard M. Stallman <rms@gnu.org>
parents: 7639
diff changeset
1083 t))))
2b541cc4cd97 (hippie-expand): Removed bug - don't undo from another buffer.
Richard M. Stallman <rms@gnu.org>
parents: 7639
diff changeset
1084
2b541cc4cd97 (hippie-expand): Removed bug - don't undo from another buffer.
Richard M. Stallman <rms@gnu.org>
parents: 7639
diff changeset
1085 (defun he-dabbrev-kill-search (pattern)
2b541cc4cd97 (hippie-expand): Removed bug - don't undo from another buffer.
Richard M. Stallman <rms@gnu.org>
parents: 7639
diff changeset
1086 (let ((result ())
21131
e4acb217b4af (hippie-expand-dabbrev-skip-space): Renamed `he-dabbrev-skip-space'.
Richard M. Stallman <rms@gnu.org>
parents: 18584
diff changeset
1087 (regpat (cond ((not hippie-expand-dabbrev-as-symbol)
e4acb217b4af (hippie-expand-dabbrev-skip-space): Renamed `he-dabbrev-skip-space'.
Richard M. Stallman <rms@gnu.org>
parents: 18584
diff changeset
1088 (concat "\\<" (regexp-quote pattern) "\\sw+"))
e4acb217b4af (hippie-expand-dabbrev-skip-space): Renamed `he-dabbrev-skip-space'.
Richard M. Stallman <rms@gnu.org>
parents: 18584
diff changeset
1089 ((eq (char-syntax (aref pattern 0)) ?_)
e4acb217b4af (hippie-expand-dabbrev-skip-space): Renamed `he-dabbrev-skip-space'.
Richard M. Stallman <rms@gnu.org>
parents: 18584
diff changeset
1090 (concat (regexp-quote pattern) "\\(\\sw\\|\\s_\\)+"))
e4acb217b4af (hippie-expand-dabbrev-skip-space): Renamed `he-dabbrev-skip-space'.
Richard M. Stallman <rms@gnu.org>
parents: 18584
diff changeset
1091 (t
e4acb217b4af (hippie-expand-dabbrev-skip-space): Renamed `he-dabbrev-skip-space'.
Richard M. Stallman <rms@gnu.org>
parents: 18584
diff changeset
1092 (concat "\\<" (regexp-quote pattern)
e4acb217b4af (hippie-expand-dabbrev-skip-space): Renamed `he-dabbrev-skip-space'.
Richard M. Stallman <rms@gnu.org>
parents: 18584
diff changeset
1093 "\\(\\sw\\|\\s_\\)+"))))
13207
2b541cc4cd97 (hippie-expand): Removed bug - don't undo from another buffer.
Richard M. Stallman <rms@gnu.org>
parents: 7639
diff changeset
1094 (killstr (car he-expand-list)))
49549
99be3a1e2589 Cygwin support patch.
Juanma Barranquero <lekktu@gmail.com>
parents: 42205
diff changeset
1095 (while (and (not result)
13207
2b541cc4cd97 (hippie-expand): Removed bug - don't undo from another buffer.
Richard M. Stallman <rms@gnu.org>
parents: 7639
diff changeset
1096 he-expand-list)
2b541cc4cd97 (hippie-expand): Removed bug - don't undo from another buffer.
Richard M. Stallman <rms@gnu.org>
parents: 7639
diff changeset
1097 (while (and (not result)
2b541cc4cd97 (hippie-expand): Removed bug - don't undo from another buffer.
Richard M. Stallman <rms@gnu.org>
parents: 7639
diff changeset
1098 (string-match regpat killstr he-search-loc2))
2b541cc4cd97 (hippie-expand): Removed bug - don't undo from another buffer.
Richard M. Stallman <rms@gnu.org>
parents: 7639
diff changeset
1099 (setq result (substring killstr (match-beginning 0) (match-end 0)))
21131
e4acb217b4af (hippie-expand-dabbrev-skip-space): Renamed `he-dabbrev-skip-space'.
Richard M. Stallman <rms@gnu.org>
parents: 18584
diff changeset
1100 (set-text-properties 0 (length result) () result)
13207
2b541cc4cd97 (hippie-expand): Removed bug - don't undo from another buffer.
Richard M. Stallman <rms@gnu.org>
parents: 7639
diff changeset
1101 (setq he-search-loc2 (1+ (match-beginning 0)))
21131
e4acb217b4af (hippie-expand-dabbrev-skip-space): Renamed `he-dabbrev-skip-space'.
Richard M. Stallman <rms@gnu.org>
parents: 18584
diff changeset
1102 (if (or (and hippie-expand-dabbrev-as-symbol
e4acb217b4af (hippie-expand-dabbrev-skip-space): Renamed `he-dabbrev-skip-space'.
Richard M. Stallman <rms@gnu.org>
parents: 18584
diff changeset
1103 (> (match-beginning 0) 0)
13207
2b541cc4cd97 (hippie-expand): Removed bug - don't undo from another buffer.
Richard M. Stallman <rms@gnu.org>
parents: 7639
diff changeset
1104 (memq (char-syntax (aref killstr (1- (match-beginning 0))))
2b541cc4cd97 (hippie-expand): Removed bug - don't undo from another buffer.
Richard M. Stallman <rms@gnu.org>
parents: 7639
diff changeset
1105 '(?_ ?w)))
2b541cc4cd97 (hippie-expand): Removed bug - don't undo from another buffer.
Richard M. Stallman <rms@gnu.org>
parents: 7639
diff changeset
1106 (he-string-member result he-tried-table t))
2b541cc4cd97 (hippie-expand): Removed bug - don't undo from another buffer.
Richard M. Stallman <rms@gnu.org>
parents: 7639
diff changeset
1107 (setq result nil))) ; ignore if bad prefix or already in table
49549
99be3a1e2589 Cygwin support patch.
Juanma Barranquero <lekktu@gmail.com>
parents: 42205
diff changeset
1108 (if (and (not result)
13207
2b541cc4cd97 (hippie-expand): Removed bug - don't undo from another buffer.
Richard M. Stallman <rms@gnu.org>
parents: 7639
diff changeset
1109 he-expand-list)
2b541cc4cd97 (hippie-expand): Removed bug - don't undo from another buffer.
Richard M. Stallman <rms@gnu.org>
parents: 7639
diff changeset
1110 (progn
49549
99be3a1e2589 Cygwin support patch.
Juanma Barranquero <lekktu@gmail.com>
parents: 42205
diff changeset
1111 (setq he-expand-list (cdr he-expand-list))
13207
2b541cc4cd97 (hippie-expand): Removed bug - don't undo from another buffer.
Richard M. Stallman <rms@gnu.org>
parents: 7639
diff changeset
1112 (setq killstr (car he-expand-list))
2b541cc4cd97 (hippie-expand): Removed bug - don't undo from another buffer.
Richard M. Stallman <rms@gnu.org>
parents: 7639
diff changeset
1113 (setq he-search-loc2 0))))
2b541cc4cd97 (hippie-expand): Removed bug - don't undo from another buffer.
Richard M. Stallman <rms@gnu.org>
parents: 7639
diff changeset
1114 result))
2b541cc4cd97 (hippie-expand): Removed bug - don't undo from another buffer.
Richard M. Stallman <rms@gnu.org>
parents: 7639
diff changeset
1115
2b541cc4cd97 (hippie-expand): Removed bug - don't undo from another buffer.
Richard M. Stallman <rms@gnu.org>
parents: 7639
diff changeset
1116 (defun try-expand-whole-kill (old)
2b541cc4cd97 (hippie-expand): Removed bug - don't undo from another buffer.
Richard M. Stallman <rms@gnu.org>
parents: 7639
diff changeset
1117 "Try to complete text with something from the kill ring.
2b541cc4cd97 (hippie-expand): Removed bug - don't undo from another buffer.
Richard M. Stallman <rms@gnu.org>
parents: 7639
diff changeset
1118 The argument OLD has to be nil the first call of this function, and t
2b541cc4cd97 (hippie-expand): Removed bug - don't undo from another buffer.
Richard M. Stallman <rms@gnu.org>
parents: 7639
diff changeset
1119 for subsequent calls (for further possible completions of the same
2b541cc4cd97 (hippie-expand): Removed bug - don't undo from another buffer.
Richard M. Stallman <rms@gnu.org>
parents: 7639
diff changeset
1120 string). It returns t if a new completion is found, nil otherwise."
2b541cc4cd97 (hippie-expand): Removed bug - don't undo from another buffer.
Richard M. Stallman <rms@gnu.org>
parents: 7639
diff changeset
1121 (let ((expansion ()))
2b541cc4cd97 (hippie-expand): Removed bug - don't undo from another buffer.
Richard M. Stallman <rms@gnu.org>
parents: 7639
diff changeset
1122 (if (not old)
49549
99be3a1e2589 Cygwin support patch.
Juanma Barranquero <lekktu@gmail.com>
parents: 42205
diff changeset
1123 (progn
13207
2b541cc4cd97 (hippie-expand): Removed bug - don't undo from another buffer.
Richard M. Stallman <rms@gnu.org>
parents: 7639
diff changeset
1124 (he-init-string (he-kill-beg) (point))
2b541cc4cd97 (hippie-expand): Removed bug - don't undo from another buffer.
Richard M. Stallman <rms@gnu.org>
parents: 7639
diff changeset
1125 (if (not (he-string-member he-search-string he-tried-table))
2b541cc4cd97 (hippie-expand): Removed bug - don't undo from another buffer.
Richard M. Stallman <rms@gnu.org>
parents: 7639
diff changeset
1126 (setq he-tried-table (cons he-search-string he-tried-table)))
49549
99be3a1e2589 Cygwin support patch.
Juanma Barranquero <lekktu@gmail.com>
parents: 42205
diff changeset
1127 (setq he-expand-list
13207
2b541cc4cd97 (hippie-expand): Removed bug - don't undo from another buffer.
Richard M. Stallman <rms@gnu.org>
parents: 7639
diff changeset
1128 (if (not (equal he-search-string ""))
2b541cc4cd97 (hippie-expand): Removed bug - don't undo from another buffer.
Richard M. Stallman <rms@gnu.org>
parents: 7639
diff changeset
1129 kill-ring))
2b541cc4cd97 (hippie-expand): Removed bug - don't undo from another buffer.
Richard M. Stallman <rms@gnu.org>
parents: 7639
diff changeset
1130 (setq he-search-loc2 ())))
2b541cc4cd97 (hippie-expand): Removed bug - don't undo from another buffer.
Richard M. Stallman <rms@gnu.org>
parents: 7639
diff changeset
1131 (if (not (equal he-search-string ""))
2b541cc4cd97 (hippie-expand): Removed bug - don't undo from another buffer.
Richard M. Stallman <rms@gnu.org>
parents: 7639
diff changeset
1132 (setq expansion (he-whole-kill-search he-search-string)))
2b541cc4cd97 (hippie-expand): Removed bug - don't undo from another buffer.
Richard M. Stallman <rms@gnu.org>
parents: 7639
diff changeset
1133 (if (not expansion)
2b541cc4cd97 (hippie-expand): Removed bug - don't undo from another buffer.
Richard M. Stallman <rms@gnu.org>
parents: 7639
diff changeset
1134 (progn
2b541cc4cd97 (hippie-expand): Removed bug - don't undo from another buffer.
Richard M. Stallman <rms@gnu.org>
parents: 7639
diff changeset
1135 (if old (he-reset-string))
2b541cc4cd97 (hippie-expand): Removed bug - don't undo from another buffer.
Richard M. Stallman <rms@gnu.org>
parents: 7639
diff changeset
1136 ())
2b541cc4cd97 (hippie-expand): Removed bug - don't undo from another buffer.
Richard M. Stallman <rms@gnu.org>
parents: 7639
diff changeset
1137 (progn
2b541cc4cd97 (hippie-expand): Removed bug - don't undo from another buffer.
Richard M. Stallman <rms@gnu.org>
parents: 7639
diff changeset
1138 (he-substitute-string expansion)
2b541cc4cd97 (hippie-expand): Removed bug - don't undo from another buffer.
Richard M. Stallman <rms@gnu.org>
parents: 7639
diff changeset
1139 t))))
2b541cc4cd97 (hippie-expand): Removed bug - don't undo from another buffer.
Richard M. Stallman <rms@gnu.org>
parents: 7639
diff changeset
1140
2b541cc4cd97 (hippie-expand): Removed bug - don't undo from another buffer.
Richard M. Stallman <rms@gnu.org>
parents: 7639
diff changeset
1141 (defun he-whole-kill-search (str)
2b541cc4cd97 (hippie-expand): Removed bug - don't undo from another buffer.
Richard M. Stallman <rms@gnu.org>
parents: 7639
diff changeset
1142 (let ((case-fold-search ())
2b541cc4cd97 (hippie-expand): Removed bug - don't undo from another buffer.
Richard M. Stallman <rms@gnu.org>
parents: 7639
diff changeset
1143 (result ())
2b541cc4cd97 (hippie-expand): Removed bug - don't undo from another buffer.
Richard M. Stallman <rms@gnu.org>
parents: 7639
diff changeset
1144 (str (regexp-quote str))
2b541cc4cd97 (hippie-expand): Removed bug - don't undo from another buffer.
Richard M. Stallman <rms@gnu.org>
parents: 7639
diff changeset
1145 (killstr (car he-expand-list))
2b541cc4cd97 (hippie-expand): Removed bug - don't undo from another buffer.
Richard M. Stallman <rms@gnu.org>
parents: 7639
diff changeset
1146 (pos -1))
2b541cc4cd97 (hippie-expand): Removed bug - don't undo from another buffer.
Richard M. Stallman <rms@gnu.org>
parents: 7639
diff changeset
1147 (while (and (not result)
2b541cc4cd97 (hippie-expand): Removed bug - don't undo from another buffer.
Richard M. Stallman <rms@gnu.org>
parents: 7639
diff changeset
1148 he-expand-list)
2b541cc4cd97 (hippie-expand): Removed bug - don't undo from another buffer.
Richard M. Stallman <rms@gnu.org>
parents: 7639
diff changeset
1149 (if (not he-search-loc2)
2b541cc4cd97 (hippie-expand): Removed bug - don't undo from another buffer.
Richard M. Stallman <rms@gnu.org>
parents: 7639
diff changeset
1150 (while (setq pos (string-match str killstr (1+ pos)))
2b541cc4cd97 (hippie-expand): Removed bug - don't undo from another buffer.
Richard M. Stallman <rms@gnu.org>
parents: 7639
diff changeset
1151 (setq he-search-loc2 (cons pos he-search-loc2))))
2b541cc4cd97 (hippie-expand): Removed bug - don't undo from another buffer.
Richard M. Stallman <rms@gnu.org>
parents: 7639
diff changeset
1152 (while (and (not result)
2b541cc4cd97 (hippie-expand): Removed bug - don't undo from another buffer.
Richard M. Stallman <rms@gnu.org>
parents: 7639
diff changeset
1153 he-search-loc2)
2b541cc4cd97 (hippie-expand): Removed bug - don't undo from another buffer.
Richard M. Stallman <rms@gnu.org>
parents: 7639
diff changeset
1154 (setq pos (car he-search-loc2))
2b541cc4cd97 (hippie-expand): Removed bug - don't undo from another buffer.
Richard M. Stallman <rms@gnu.org>
parents: 7639
diff changeset
1155 (setq he-search-loc2 (cdr he-search-loc2))
2b541cc4cd97 (hippie-expand): Removed bug - don't undo from another buffer.
Richard M. Stallman <rms@gnu.org>
parents: 7639
diff changeset
1156 (save-excursion
2b541cc4cd97 (hippie-expand): Removed bug - don't undo from another buffer.
Richard M. Stallman <rms@gnu.org>
parents: 7639
diff changeset
1157 (goto-char he-string-beg)
2b541cc4cd97 (hippie-expand): Removed bug - don't undo from another buffer.
Richard M. Stallman <rms@gnu.org>
parents: 7639
diff changeset
1158 (if (and (>= (- (point) pos) (point-min)) ; avoid some string GC
2b541cc4cd97 (hippie-expand): Removed bug - don't undo from another buffer.
Richard M. Stallman <rms@gnu.org>
parents: 7639
diff changeset
1159 (eq (char-after (- (point) pos)) (aref killstr 0))
2b541cc4cd97 (hippie-expand): Removed bug - don't undo from another buffer.
Richard M. Stallman <rms@gnu.org>
parents: 7639
diff changeset
1160 (search-backward (substring killstr 0 pos)
2b541cc4cd97 (hippie-expand): Removed bug - don't undo from another buffer.
Richard M. Stallman <rms@gnu.org>
parents: 7639
diff changeset
1161 (- (point) pos) t))
21131
e4acb217b4af (hippie-expand-dabbrev-skip-space): Renamed `he-dabbrev-skip-space'.
Richard M. Stallman <rms@gnu.org>
parents: 18584
diff changeset
1162 (progn
e4acb217b4af (hippie-expand-dabbrev-skip-space): Renamed `he-dabbrev-skip-space'.
Richard M. Stallman <rms@gnu.org>
parents: 18584
diff changeset
1163 (setq result (substring killstr pos))
e4acb217b4af (hippie-expand-dabbrev-skip-space): Renamed `he-dabbrev-skip-space'.
Richard M. Stallman <rms@gnu.org>
parents: 18584
diff changeset
1164 (set-text-properties 0 (length result) () result))))
13207
2b541cc4cd97 (hippie-expand): Removed bug - don't undo from another buffer.
Richard M. Stallman <rms@gnu.org>
parents: 7639
diff changeset
1165 (if (and result
2b541cc4cd97 (hippie-expand): Removed bug - don't undo from another buffer.
Richard M. Stallman <rms@gnu.org>
parents: 7639
diff changeset
1166 (he-string-member result he-tried-table))
2b541cc4cd97 (hippie-expand): Removed bug - don't undo from another buffer.
Richard M. Stallman <rms@gnu.org>
parents: 7639
diff changeset
1167 (setq result nil))) ; ignore if already in table
2b541cc4cd97 (hippie-expand): Removed bug - don't undo from another buffer.
Richard M. Stallman <rms@gnu.org>
parents: 7639
diff changeset
1168 (if (and (not result)
2b541cc4cd97 (hippie-expand): Removed bug - don't undo from another buffer.
Richard M. Stallman <rms@gnu.org>
parents: 7639
diff changeset
1169 he-expand-list)
2b541cc4cd97 (hippie-expand): Removed bug - don't undo from another buffer.
Richard M. Stallman <rms@gnu.org>
parents: 7639
diff changeset
1170 (progn
49549
99be3a1e2589 Cygwin support patch.
Juanma Barranquero <lekktu@gmail.com>
parents: 42205
diff changeset
1171 (setq he-expand-list (cdr he-expand-list))
13207
2b541cc4cd97 (hippie-expand): Removed bug - don't undo from another buffer.
Richard M. Stallman <rms@gnu.org>
parents: 7639
diff changeset
1172 (setq killstr (car he-expand-list))
2b541cc4cd97 (hippie-expand): Removed bug - don't undo from another buffer.
Richard M. Stallman <rms@gnu.org>
parents: 7639
diff changeset
1173 (setq pos -1))))
2b541cc4cd97 (hippie-expand): Removed bug - don't undo from another buffer.
Richard M. Stallman <rms@gnu.org>
parents: 7639
diff changeset
1174 result))
2b541cc4cd97 (hippie-expand): Removed bug - don't undo from another buffer.
Richard M. Stallman <rms@gnu.org>
parents: 7639
diff changeset
1175
2b541cc4cd97 (hippie-expand): Removed bug - don't undo from another buffer.
Richard M. Stallman <rms@gnu.org>
parents: 7639
diff changeset
1176 (defun he-kill-beg ()
2b541cc4cd97 (hippie-expand): Removed bug - don't undo from another buffer.
Richard M. Stallman <rms@gnu.org>
parents: 7639
diff changeset
1177 (let ((op (point)))
2b541cc4cd97 (hippie-expand): Removed bug - don't undo from another buffer.
Richard M. Stallman <rms@gnu.org>
parents: 7639
diff changeset
1178 (save-excursion
2b541cc4cd97 (hippie-expand): Removed bug - don't undo from another buffer.
Richard M. Stallman <rms@gnu.org>
parents: 7639
diff changeset
1179 (skip-syntax-backward "^w_")
2b541cc4cd97 (hippie-expand): Removed bug - don't undo from another buffer.
Richard M. Stallman <rms@gnu.org>
parents: 7639
diff changeset
1180 (if (= (skip-syntax-backward "w_") 0)
2b541cc4cd97 (hippie-expand): Removed bug - don't undo from another buffer.
Richard M. Stallman <rms@gnu.org>
parents: 7639
diff changeset
1181 op
2b541cc4cd97 (hippie-expand): Removed bug - don't undo from another buffer.
Richard M. Stallman <rms@gnu.org>
parents: 7639
diff changeset
1182 (point)))))
2b541cc4cd97 (hippie-expand): Removed bug - don't undo from another buffer.
Richard M. Stallman <rms@gnu.org>
parents: 7639
diff changeset
1183
1737
d7e9186edefa entered into RCS
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1184
4130
e5aee6a3bb75 * hippie-exp.el: Renamed from hippie.el.
Jim Blandy <jimb@redhat.com>
parents: 2233
diff changeset
1185 (provide 'hippie-exp)
e5aee6a3bb75 * hippie-exp.el: Renamed from hippie.el.
Jim Blandy <jimb@redhat.com>
parents: 2233
diff changeset
1186
93975
1e3a407766b9 Fix up comment convention on the arch-tag lines.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 79721
diff changeset
1187 ;; arch-tag: 5e6e00bf-b061-4a7a-9b46-de0ae105ab99
4130
e5aee6a3bb75 * hippie-exp.el: Renamed from hippie.el.
Jim Blandy <jimb@redhat.com>
parents: 2233
diff changeset
1188 ;;; hippie-exp.el ends here