[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
bug#16607: hippie-expand, a patch
From: |
Lars Ingebrigtsen |
Subject: |
bug#16607: hippie-expand, a patch |
Date: |
Wed, 24 Feb 2016 14:26:22 +1100 |
User-agent: |
Gnus/5.13 (Gnus v5.13) Emacs/25.1.50 (gnu/linux) |
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
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- bug#16607: hippie-expand, a patch,
Lars Ingebrigtsen <=