unofficial mirror of bug-gnu-emacs@gnu.org 
 help / color / mirror / code / Atom feed
* bug#16607: hippie-expand, a patch
       [not found] <ed8utwvb22.fsf@fencepost.gnu.org>
@ 2016-02-24  3:26 ` Lars Ingebrigtsen
  2017-07-02 19:35   ` npostavs
  0 siblings, 1 reply; 2+ messages in thread
From: Lars Ingebrigtsen @ 2016-02-24  3:26 UTC (permalink / raw)
  To: Emilio C. Lopes; +Cc: 16607

Emilio C. Lopes <eclig@gmx.net> writes:

> `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.

I think the patch below looks reasonable, but I've never used
hippie-expand.  Are there anybody that can weigh in on this?


>
> 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

-- 
(domestic pets only, the antidote for overdose, milk.)
   bloggy blog: http://lars.ingebrigtsen.no





^ permalink raw reply	[flat|nested] 2+ messages in thread

* bug#16607: hippie-expand, a patch
  2016-02-24  3:26 ` bug#16607: hippie-expand, a patch Lars Ingebrigtsen
@ 2017-07-02 19:35   ` npostavs
  0 siblings, 0 replies; 2+ messages in thread
From: npostavs @ 2017-07-02 19:35 UTC (permalink / raw)
  To: Lars Ingebrigtsen; +Cc: 16607, Emilio C. Lopes

tags 16607 fixed
close 16607 25.1
quit

Lars Ingebrigtsen <larsi@gnus.org> writes:

> Emilio C. Lopes <eclig@gmx.net> writes:
>
>> `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.
>
> I think the patch below looks reasonable, but I've never used
> hippie-expand.  Are there anybody that can weigh in on this?

This was already added in Emacs 25.1.

[1: 8576251878]: 2014-06-12 09:45:52 -0400
  * lisp/hippie-exp.el (try-expand-line-all-buffers) (try-expand-list-all-buffers, try-expand-dabbrev-all-buffers): Read hippie-expand-only-buffers and hippie-expand-ignore-buffers in the original buffer, in case they're buffer-local.
  http://git.savannah.gnu.org/cgit/emacs.git/commit/?id=8576251878f59f686b3a14c574a402549eabcbc1





^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2017-07-02 19:35 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
     [not found] <ed8utwvb22.fsf@fencepost.gnu.org>
2016-02-24  3:26 ` bug#16607: hippie-expand, a patch Lars Ingebrigtsen
2017-07-02 19:35   ` npostavs

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).