[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
bug#38317: Buffer-local variables don't work as history for read-from-mi
From: |
Robert Pluim |
Subject: |
bug#38317: Buffer-local variables don't work as history for read-from-minibuffer |
Date: |
Wed, 27 Nov 2019 09:14:13 +0100 |
>>>>> On Tue, 26 Nov 2019 22:54:29 +0100, Federico Tedin
>>>>> <federicotedin@gmail.com> said:
>> I'm attaching a draft patch in case anyone wants to provide some
>> feedback. Thanks!
Federico> I'm now attaching a final version of my patch.
Federico> I've tested the following commands with it, using
`read-from-minibuffer'
Federico> with a buffer-local HIST:
Federico> - previous-history-element (M-p)
Federico> - next-history-element (M-n)
Federico> - previous-matching-history-element (M-r)
Federico> - next-matching-history-element (M-s)
Federico> - isearch-forward (C-s)
Federico> - isearch-backward (C-r)
Federico> They've all worked correctly and used only the buffer's local
history
Federico> value.
Federico> Thanks!
Federico> From 496fbc75e02e016d50d3e1a21154e4da844a1140 Mon Sep 17 00:00:00
2001
Federico> From: Federico Tedin <federicotedin@gmail.com>
Federico> Date: Tue, 26 Nov 2019 22:39:34 +0100
Federico> Subject: [PATCH 1/1] Make HIST arg of read-from-minibuffer work
with
Federico> buffer-local vars
Federico> * lisp/simple.el (minibuffer-history-values): New function,
should be
Federico> used to access the minibuffer input history variable when the
Federico> minibuffer might be active. If the variable is buffer-local, the
Federico> previous buffer's value will be used.
2 spaces after '.' (here and elsewhere).
Federico> (goto-history-element): Use the new function to access the
minibuffer
Federico> history.
Federico> (minibuffer-history-isearch-wrap): Use the new function to access
the
Federico> minibuffer history.
Federico> * src/minibuf.c (read_minibuf): Switch to previous buffer
temporarily
Federico> before updating history list (Bug#38317).
Federico> * etc/NEWS: Announce changes.
Federico> ---
Federico> etc/NEWS | 6 ++++++
Federico> lisp/simple.el | 18 +++++++++++++-----
Federico> src/minibuf.c | 17 +++++++++++++++--
Federico> 3 files changed, 34 insertions(+), 7 deletions(-)
Federico> diff --git a/etc/NEWS b/etc/NEWS
Federico> index d3331daf17..9dbf36ae40 100644
Federico> --- a/etc/NEWS
Federico> +++ b/etc/NEWS
Federico> @@ -518,6 +518,12 @@ Note that this key binding will not work on
MS-Windows systems if
Federico> key binding with an upper case letter - if you can type it, you
can
Federico> bind it.
Federico> +---
Federico> +** 'read-from-minibuffer' now works with buffer-local history
variables
'.' at end of sentence.
Federico> +The HIST argument of 'read-from-minibuffer' now works correctly
with
Federico> +buffer-local variables. This means that different buffers can
have
Federico> +their own separated input history list if desired.
Federico> +
Federico>
Federico> * Editing Changes in Emacs 27.1
Federico> diff --git a/lisp/simple.el b/lisp/simple.el
Federico> index 2aac557154..0b1d7b73ab 100644
Federico> --- a/lisp/simple.el
Federico> +++ b/lisp/simple.el
Federico> @@ -2041,7 +2041,7 @@ previous-matching-history-element
Federico> (null minibuffer-text-before-history))
Federico> (setq minibuffer-text-before-history
Federico> (minibuffer-contents-no-properties)))
Federico> - (let ((history (symbol-value minibuffer-history-variable))
Federico> + (let ((history (minibuffer-history-values))
Federico> (case-fold-search
Federico> (if (isearch-no-upper-case-p regexp t) ; assume isearch.el
is dumped
Federico> ;; On some systems, ignore case for file names.
Federico> @@ -2141,6 +2141,14 @@ minibuffer-default-add-completions
Federico> (append def all)
Federico> (cons def (delete def all)))))
Federico> +(defun minibuffer-history-values ()
Federico> + "Return the minibuffer input history values.
Federico> +If `minibuffer-history-variable' points to a buffer-local
variable and
Federico> +the minibuffer is active, return the buffer-local value for the
buffer
Federico> +selected in the window returned by
Federico> `minibuffer-selected-window'."
This is a true description of what the code does, but perhaps not
clear to users. How about:
"for the buffer selected when the minibuffer was activated."
Robert
- bug#38317: Buffer-local variables don't work as history for read-from-minibuffer, Federico Tedin, 2019/11/21
- bug#38317: Buffer-local variables don't work as history for read-from-minibuffer, Lars Ingebrigtsen, 2019/11/22
- bug#38317: Buffer-local variables don't work as history for read-from-minibuffer, Michael Heerdegen, 2019/11/22
- bug#38317: Buffer-local variables don't work as history for read-from-minibuffer, martin rudalics, 2019/11/22
- bug#38317: Buffer-local variables don't work as history for read-from-minibuffer, Lars Ingebrigtsen, 2019/11/23
- bug#38317: Buffer-local variables don't work as history for read-from-minibuffer, Federico Tedin, 2019/11/23
- bug#38317: Buffer-local variables don't work as history for read-from-minibuffer, Federico Tedin, 2019/11/23
- bug#38317: Buffer-local variables don't work as history for read-from-minibuffer, Federico Tedin, 2019/11/26
- bug#38317: Buffer-local variables don't work as history for read-from-minibuffer,
Robert Pluim <=
- bug#38317: Buffer-local variables don't work as history for read-from-minibuffer, Drew Adams, 2019/11/27
- bug#38317: Buffer-local variables don't work as history for read-from-minibuffer, Robert Pluim, 2019/11/27
- bug#38317: Buffer-local variables don't work as history for read-from-minibuffer, Lars Ingebrigtsen, 2019/11/27
- bug#38317: Buffer-local variables don't work as history for read-from-minibuffer, Federico Tedin, 2019/11/27
- bug#38317: Buffer-local variables don't work as history for read-from-minibuffer, Eli Zaretskii, 2019/11/27
- bug#38317: Buffer-local variables don't work as history for read-from-minibuffer, Federico Tedin, 2019/11/27
- bug#38317: Buffer-local variables don't work as history for read-from-minibuffer, Federico Tedin, 2019/11/28
- bug#38317: Buffer-local variables don't work as history for read-from-minibuffer, Richard Stallman, 2019/11/29
- bug#38317: Buffer-local variables don't work as history for read-from-minibuffer, Eli Zaretskii, 2019/11/29
- bug#38317: Buffer-local variables don't work as history for read-from-minibuffer, Federico Tedin, 2019/11/29