From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Lars Ingebrigtsen Newsgroups: gmane.emacs.bugs Subject: bug#16607: hippie-expand, a patch Date: Wed, 24 Feb 2016 14:26:22 +1100 Message-ID: <87ziuqlrfl.fsf@gnus.org> References: NNTP-Posting-Host: plane.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=iso-8859-1 Content-Transfer-Encoding: quoted-printable X-Trace: ger.gmane.org 1456284441 16353 80.91.229.3 (24 Feb 2016 03:27:21 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Wed, 24 Feb 2016 03:27:21 +0000 (UTC) Cc: 16607@debbugs.gnu.org To: Emilio C. Lopes Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Wed Feb 24 04:27:09 2016 Return-path: Envelope-to: geb-bug-gnu-emacs@m.gmane.org Original-Received: from lists.gnu.org ([208.118.235.17]) by plane.gmane.org with esmtp (Exim 4.69) (envelope-from ) id 1aYQ6X-0001ht-C3 for geb-bug-gnu-emacs@m.gmane.org; Wed, 24 Feb 2016 04:27:09 +0100 Original-Received: from localhost ([::1]:33174 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1aYQ6W-0001ML-Te for geb-bug-gnu-emacs@m.gmane.org; Tue, 23 Feb 2016 22:27:08 -0500 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:59940) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1aYQ6T-0001MD-1G for bug-gnu-emacs@gnu.org; Tue, 23 Feb 2016 22:27:06 -0500 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1aYQ6P-0000rI-Qp for bug-gnu-emacs@gnu.org; Tue, 23 Feb 2016 22:27:04 -0500 Original-Received: from debbugs.gnu.org ([208.118.235.43]:44885) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1aYQ6P-0000rE-Md for bug-gnu-emacs@gnu.org; Tue, 23 Feb 2016 22:27:01 -0500 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84) (envelope-from ) id 1aYQ6P-00067i-IQ for bug-gnu-emacs@gnu.org; Tue, 23 Feb 2016 22:27:01 -0500 X-Loop: help-debbugs@gnu.org Resent-From: Lars Ingebrigtsen Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Wed, 24 Feb 2016 03:27:01 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 16607 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: patch Original-Received: via spool by 16607-submit@debbugs.gnu.org id=B16607.145628441323524 (code B ref 16607); Wed, 24 Feb 2016 03:27:01 +0000 Original-Received: (at 16607) by debbugs.gnu.org; 24 Feb 2016 03:26:53 +0000 Original-Received: from localhost ([127.0.0.1]:42012 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84) (envelope-from ) id 1aYQ6G-00067M-Lo for submit@debbugs.gnu.org; Tue, 23 Feb 2016 22:26:52 -0500 Original-Received: from hermes.netfonds.no ([80.91.224.195]:41980) by debbugs.gnu.org with esmtp (Exim 4.84) (envelope-from ) id 1aYQ6E-00067E-HY for 16607@debbugs.gnu.org; Tue, 23 Feb 2016 22:26:51 -0500 Original-Received: from cpe-60-225-211-161.nsw.bigpond.net.au ([60.225.211.161] helo=mouse) by hermes.netfonds.no with esmtpsa (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.72) (envelope-from ) id 1aYQ5q-00075L-NP; Wed, 24 Feb 2016 04:26:27 +0100 In-Reply-To: (Emilio C. Lopes's message of "Tue, 28 Jan 2014 08:35:37 +0100") User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/25.1.50 (gnu/linux) X-MailScanner-ID: 1aYQ5q-00075L-NP MailScanner-NULL-Check: 1456889187.78522@hYVg3pCW1VOZX981PUy+Pg X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-Received-From: 208.118.235.43 X-BeenThere: bug-gnu-emacs@gnu.org List-Id: "Bug reports for GNU Emacs, the Swiss army knife of text editors" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Original-Sender: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Xref: news.gmane.org gmane.emacs.bugs:113642 Archived-At: Emilio C. Lopes 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=EDlio > > 2014-01-27 Emilio C. Lopes > > * 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 --=20 (domestic pets only, the antidote for overdose, milk.) bloggy blog: http://lars.ingebrigtsen.no