GNU bug report logs - #16607
hippie-expand, a patch

Previous Next

Package: emacs;

Reported by: Emilio C. Lopes <eclig <at> gmx.net>

Date: Fri, 31 Jan 2014 07:58:02 UTC

Severity: minor

Tags: fixed, patch

Merged with 27501

Found in versions 24.3, 24.5

Fixed in version 25.1

Done: npostavs <at> users.sourceforge.net

Bug is archived. No further changes may be made.

To add a comment to this bug, you must first unarchive it, by sending
a message to control AT debbugs.gnu.org, with unarchive 16607 in the body.
You can then email your comments to 16607 AT debbugs.gnu.org in the normal way.

Toggle the display of automated, internal messages from the tracker.

View this report as an mbox folder, status mbox, maintainer mbox


Message #1 received at quiet <at> debbugs.gnu.org (full text, mbox):

From: Emilio C. Lopes <eclig <at> gmx.net>
To: quiet <at> debbugs.gnu.org
Subject: hippie-expand, a patch
Date: Tue, 28 Jan 2014 08:35:37 +0100
Package: emacs
Version: 24.3
Tags: patch

Resent from http://lists.gnu.org/archive/html/emacs-devel/2014-01/msg02160.html

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




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#16607; Package emacs. (Wed, 24 Feb 2016 03:27:01 GMT) Full text and rfc822 format available.

Message #4 received at 16607 <at> debbugs.gnu.org (full text, mbox):

From: Lars Ingebrigtsen <larsi <at> gnus.org>
To: Emilio C. Lopes <eclig <at> gmx.net>
Cc: 16607 <at> debbugs.gnu.org
Subject: Re: hippie-expand, a patch
Date: Wed, 24 Feb 2016 14:26:22 +1100
Emilio C. Lopes <eclig <at> 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 <at> 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




Severity set to 'wishlist' from 'normal' Request was from npostavs <at> users.sourceforge.net to control <at> debbugs.gnu.org. (Sun, 21 May 2017 22:32:02 GMT) Full text and rfc822 format available.

Forcibly Merged 16607 27501. Request was from npostavs <at> users.sourceforge.net to control <at> debbugs.gnu.org. (Fri, 30 Jun 2017 01:11:02 GMT) Full text and rfc822 format available.

Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#16607; Package emacs. (Sun, 02 Jul 2017 19:35:02 GMT) Full text and rfc822 format available.

Message #11 received at 16607 <at> debbugs.gnu.org (full text, mbox):

From: npostavs <at> users.sourceforge.net
To: Lars Ingebrigtsen <larsi <at> gnus.org>
Cc: 16607 <at> debbugs.gnu.org, "Emilio C. Lopes" <eclig <at> gmx.net>
Subject: Re: bug#16607: hippie-expand, a patch
Date: Sun, 02 Jul 2017 15:35:43 -0400
tags 16607 fixed
close 16607 25.1
quit

Lars Ingebrigtsen <larsi <at> gnus.org> writes:

> Emilio C. Lopes <eclig <at> 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




Added tag(s) fixed. Request was from npostavs <at> users.sourceforge.net to control <at> debbugs.gnu.org. (Sun, 02 Jul 2017 19:35:02 GMT) Full text and rfc822 format available.

bug marked as fixed in version 25.1, send any further explanations to 16607 <at> debbugs.gnu.org and Emilio C. Lopes <eclig <at> gmx.net> Request was from npostavs <at> users.sourceforge.net to control <at> debbugs.gnu.org. (Sun, 02 Jul 2017 19:35:03 GMT) Full text and rfc822 format available.

bug archived. Request was from Debbugs Internal Request <help-debbugs <at> gnu.org> to internal_control <at> debbugs.gnu.org. (Mon, 31 Jul 2017 11:24:03 GMT) Full text and rfc822 format available.

This bug report was last modified 6 years and 241 days ago.

Previous Next


GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997,2003 nCipher Corporation Ltd, 1994-97 Ian Jackson.