unofficial mirror of bug-gnu-emacs@gnu.org 
 help / color / mirror / code / Atom feed
From: Robert Pluim <rpluim@gmail.com>
To: Federico Tedin <federicotedin@gmail.com>
Cc: Lars Ingebrigtsen <larsi@gnus.org>, 38317@debbugs.gnu.org
Subject: bug#38317: Buffer-local variables don't work as history for read-from-minibuffer
Date: Wed, 27 Nov 2019 09:14:13 +0100	[thread overview]
Message-ID: <m2eextka7e.fsf@gmail.com> (raw)
In-Reply-To: <87o8wyl2wa.fsf@gmail.com> (Federico Tedin's message of "Tue, 26 Nov 2019 22:54:29 +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>  \f
    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





  reply	other threads:[~2019-11-27  8:14 UTC|newest]

Thread overview: 22+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-11-21 21:30 bug#38317: Buffer-local variables don't work as history for read-from-minibuffer Federico Tedin
2019-11-22 13:33 ` Lars Ingebrigtsen
2019-11-22 15:23   ` Michael Heerdegen
2019-11-22 16:24   ` martin rudalics
2019-11-23 11:54     ` Lars Ingebrigtsen
2019-11-23 20:36       ` Federico Tedin
2019-11-23 23:12         ` Federico Tedin
2019-11-26 21:54           ` Federico Tedin
2019-11-27  8:14             ` Robert Pluim [this message]
2019-11-27 15:24               ` Drew Adams
2019-11-27 15:28                 ` Robert Pluim
2019-11-27 11:53             ` Lars Ingebrigtsen
2019-11-27 18:50               ` Federico Tedin
2019-11-27 19:25                 ` Eli Zaretskii
2019-11-27 21:04                   ` Federico Tedin
2019-11-28 12:05                     ` Federico Tedin
2019-12-05  9:31                       ` Lars Ingebrigtsen
2019-11-29  5:22                     ` Richard Stallman
2019-11-29 10:21                       ` Eli Zaretskii
2019-11-29 17:02                         ` Federico Tedin
2019-12-01  5:59                       ` Richard Stallman
2019-11-27 21:19             ` Juri Linkov

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://www.gnu.org/software/emacs/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=m2eextka7e.fsf@gmail.com \
    --to=rpluim@gmail.com \
    --cc=38317@debbugs.gnu.org \
    --cc=federicotedin@gmail.com \
    --cc=larsi@gnus.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).