* hippie-expand, a patch
@ 2014-01-28 7:35 Emilio C. Lopes
2014-01-31 7:58 ` Glenn Morris
2014-06-12 13:47 ` Stefan Monnier
0 siblings, 2 replies; 3+ messages in thread
From: Emilio C. Lopes @ 2014-01-28 7:35 UTC (permalink / raw)
To: emacs-devel
[ It has been quite a long time since I've submited a patch to GNU Emacs.
Please let me know if I should be doing it differently. ]
`hippie-expand' use several methods to expand text in the current buffer.
Some of those methods search for possible expansions in multiple Emacs
buffers, controlled by the variables `hippie-expand-ignore-buffers' and
`hippie-expand-only-buffers'.
It would be useful to be able to set these two variables locally in a
Buffer (using `make-local-variable'). This would allow for example to
set up `hippie-expand' in Lisp buffers to only search for possible
expansions in other Lisp buffers.
As it is now (Emacs 24.3) the functions in `hippie-expand' using those
variables do so in the context of the buffers where potential completions
are searched for. The patch bellow causes the lookup to occur in the
buffer where `hippie-expand' was invoked.
Regards
Emílio
2014-01-27 Emilio C. Lopes <eclig@gmx.net>
* hippie-exp.el (try-expand-line-all-buffers)
(try-expand-list-all-buffers, try-expand-dabbrev-all-buffers):
Use the value of `hippie-expand-only-buffers' and
`hippie-expand-ignore-buffers' from the buffer where
`hippie-expand' was invoked allowing these variables to be
buffer-local.
diff --unified lisp/hippie-exp.el.\~1\~ lisp/hippie-exp.el
--- lisp/hippie-exp.el.~1~ 2013-03-17 20:52:38.000000000 +0100
+++ lisp/hippie-exp.el 2014-01-27 20:29:12.000000000 +0100
@@ -642,6 +642,8 @@
comint-use-prompt-regexp
comint-prompt-regexp))
(buf (current-buffer))
+ (only-buffers hippie-expand-only-buffers)
+ (ignore-buffers hippie-expand-ignore-buffers)
(orig-case-fold-search case-fold-search))
(if (not old)
(progn
@@ -657,9 +659,9 @@
(< he-searched-n-bufs hippie-expand-max-buffers)))
(set-buffer (car he-search-bufs))
(if (and (not (eq (current-buffer) buf))
- (if hippie-expand-only-buffers
- (he-buffer-member hippie-expand-only-buffers)
- (not (he-buffer-member hippie-expand-ignore-buffers))))
+ (if only-buffers
+ (he-buffer-member only-buffers)
+ (not (he-buffer-member ignore-buffers))))
(save-excursion
(save-restriction
(if hippie-expand-no-restriction
@@ -771,6 +773,8 @@
string). It returns t if a new completion is found, nil otherwise."
(let ((expansion ())
(buf (current-buffer))
+ (only-buffers hippie-expand-only-buffers)
+ (ignore-buffers hippie-expand-ignore-buffers)
(orig-case-fold-search case-fold-search))
(if (not old)
(progn
@@ -786,9 +790,9 @@
(< he-searched-n-bufs hippie-expand-max-buffers)))
(set-buffer (car he-search-bufs))
(if (and (not (eq (current-buffer) buf))
- (if hippie-expand-only-buffers
- (he-buffer-member hippie-expand-only-buffers)
- (not (he-buffer-member hippie-expand-ignore-buffers))))
+ (if only-buffers
+ (he-buffer-member only-buffers)
+ (not (he-buffer-member ignore-buffers))))
(save-excursion
(save-restriction
(if hippie-expand-no-restriction
@@ -926,6 +930,8 @@
string). It returns t if a new expansion is found, nil otherwise."
(let ((expansion ())
(buf (current-buffer))
+ (only-buffers hippie-expand-only-buffers)
+ (ignore-buffers hippie-expand-ignore-buffers)
(orig-case-fold-search case-fold-search))
(if (not old)
(progn
@@ -941,9 +947,9 @@
(< he-searched-n-bufs hippie-expand-max-buffers)))
(set-buffer (car he-search-bufs))
(if (and (not (eq (current-buffer) buf))
- (if hippie-expand-only-buffers
- (he-buffer-member hippie-expand-only-buffers)
- (not (he-buffer-member hippie-expand-ignore-buffers))))
+ (if only-buffers
+ (he-buffer-member only-buffers)
+ (not (he-buffer-member ignore-buffers))))
(save-excursion
(save-restriction
(if hippie-expand-no-restriction
Diff finished. Mon Jan 27 22:20:31 2014
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: hippie-expand, a patch
2014-01-28 7:35 hippie-expand, a patch Emilio C. Lopes
@ 2014-01-31 7:58 ` Glenn Morris
2014-06-12 13:47 ` Stefan Monnier
1 sibling, 0 replies; 3+ messages in thread
From: Glenn Morris @ 2014-01-31 7:58 UTC (permalink / raw)
To: Emilio C. Lopes; +Cc: emacs-devel
Thanks; filed as http://debbugs.gnu.org/16607 .
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: hippie-expand, a patch
2014-01-28 7:35 hippie-expand, a patch Emilio C. Lopes
2014-01-31 7:58 ` Glenn Morris
@ 2014-06-12 13:47 ` Stefan Monnier
1 sibling, 0 replies; 3+ messages in thread
From: Stefan Monnier @ 2014-06-12 13:47 UTC (permalink / raw)
To: Emilio C. Lopes; +Cc: emacs-devel
> [ It has been quite a long time since I've submited a patch to GNU Emacs.
> Please let me know if I should be doing it differently. ]
That was fine. We generally prefer if you send it to bug-gnu-emacs so
it gets a tracking number, but either way works.
> 2014-01-27 Emilio C. Lopes <eclig@gmx.net>
> * hippie-exp.el (try-expand-line-all-buffers)
> (try-expand-list-all-buffers, try-expand-dabbrev-all-buffers):
> Use the value of `hippie-expand-only-buffers' and
> `hippie-expand-ignore-buffers' from the buffer where
> `hippie-expand' was invoked allowing these variables to be
> buffer-local.
Installed into `trunk', thank you. And sorry it took so long,
Stefan
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2014-06-12 13:47 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2014-01-28 7:35 hippie-expand, a patch Emilio C. Lopes
2014-01-31 7:58 ` Glenn Morris
2014-06-12 13:47 ` Stefan Monnier
Code repositories for project(s) associated with this public inbox
https://git.savannah.gnu.org/cgit/emacs.git
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).