GNU bug report logs - #38317
Buffer-local variables don't work as history for read-from-minibuffer

Please note: This is a static page, with minimal formatting, updated once a day.
Click here to see this page with the latest information and nicer formatting.

Package: emacs; Reported by: Federico Tedin <federicotedin@HIDDEN>; Keywords: fixed; Done: Lars Ingebrigtsen <larsi@HIDDEN>; Maintainer for emacs is bug-gnu-emacs@HIDDEN.
bug marked as fixed in version 27.1, send any further explanations to 38317 <at> debbugs.gnu.org and Federico Tedin <federicotedin@HIDDEN> Request was from Lars Ingebrigtsen <larsi@HIDDEN> to control <at> debbugs.gnu.org. Full text available.
Added tag(s) fixed. Request was from Lars Ingebrigtsen <larsi@HIDDEN> to control <at> debbugs.gnu.org. Full text available.

Message received at 38317 <at> debbugs.gnu.org:


Received: (at 38317) by debbugs.gnu.org; 5 Dec 2019 09:31:28 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Thu Dec 05 04:31:27 2019
Received: from localhost ([127.0.0.1]:43000 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1icnTr-00067b-O0
	for submit <at> debbugs.gnu.org; Thu, 05 Dec 2019 04:31:27 -0500
Received: from quimby.gnus.org ([95.216.78.240]:45592)
 by debbugs.gnu.org with esmtp (Exim 4.84_2)
 (envelope-from <larsi@HIDDEN>) id 1icnTp-00067F-OK
 for 38317 <at> debbugs.gnu.org; Thu, 05 Dec 2019 04:31:26 -0500
Received: from cm-84.212.202.86.getinternet.no ([84.212.202.86] helo=marnie)
 by quimby.gnus.org with esmtpsa (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256)
 (Exim 4.92) (envelope-from <larsi@HIDDEN>)
 id 1icnTg-00044M-Jq; Thu, 05 Dec 2019 10:31:19 +0100
From: Lars Ingebrigtsen <larsi@HIDDEN>
To: Federico Tedin <federicotedin@HIDDEN>
Subject: Re: bug#38317: Buffer-local variables don't work as history for
 read-from-minibuffer
References: <87eey0lxxm.fsf@HIDDEN> <87v9rcqbls.fsf@HIDDEN>
 <5a0c68d0-4d25-bf8d-fbe8-f106b0f92210@HIDDEN>
 <875zjareo1.fsf@HIDDEN> <874kyu72kl.fsf@HIDDEN>
 <87wobq5gs0.fsf@HIDDEN> <87o8wyl2wa.fsf@HIDDEN>
 <87k17lfscs.fsf@HIDDEN> <87h82pw3vr.fsf@HIDDEN>
 <83y2w1p1f7.fsf@HIDDEN> <87d0ddvxnk.fsf@HIDDEN>
 <874kyow6i3.fsf@HIDDEN>
Date: Thu, 05 Dec 2019 10:31:15 +0100
In-Reply-To: <874kyow6i3.fsf@HIDDEN> (Federico Tedin's message of "Thu, 28
 Nov 2019 13:05:40 +0100")
Message-ID: <87h82f3yqk.fsf@HIDDEN>
User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/27.0.50 (gnu/linux)
MIME-Version: 1.0
Content-Type: text/plain
X-Spam-Report: Spam detection software, running on the system "quimby.gnus.org",
 has NOT identified this incoming email as spam.  The original
 message has been attached to this so you can view it or label
 similar future email.  If you have any questions, see
 @@CONTACT_ADDRESS@@ for details.
 Content preview:  Federico Tedin <federicotedin@HIDDEN> writes: > I'm now
 attaching a new patch with feedback corrections from everyone in > the thread
 (threads?). Looks good to me, and after some cursory testing I've applied
 this to Emacs 27. 
 Content analysis details:   (-2.9 points, 5.0 required)
 pts rule name              description
 ---- ---------------------- --------------------------------------------------
 -1.0 ALL_TRUSTED            Passed through trusted hosts only via SMTP
 -1.9 BAYES_00               BODY: Bayes spam probability is 0 to 1%
 [score: 0.0000]
 0.0 URIBL_BLOCKED          ADMINISTRATOR NOTICE: The query to URIBL was
 blocked.  See
 http://wiki.apache.org/spamassassin/DnsBlocklists#dnsbl-block
 for more information. [URIs: ingebrigtsen.no]
X-Spam-Score: 0.0 (/)
X-Debbugs-Envelope-To: 38317
Cc: Eli Zaretskii <eliz@HIDDEN>, 38317 <at> debbugs.gnu.org
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.18
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
X-Spam-Score: -1.0 (-)

Federico Tedin <federicotedin@HIDDEN> writes:

> I'm now attaching a new patch with feedback corrections from everyone in
> the thread (threads?).

Looks good to me, and after some cursory testing I've applied this to
Emacs 27.

-- 
(domestic pets only, the antidote for overdose, milk.)
   bloggy blog: http://lars.ingebrigtsen.no




Information forwarded to bug-gnu-emacs@HIDDEN:
bug#38317; Package emacs. Full text available.

Message received at 38317 <at> debbugs.gnu.org:


Received: (at 38317) by debbugs.gnu.org; 1 Dec 2019 05:59:47 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Sun Dec 01 00:59:47 2019
Received: from localhost ([127.0.0.1]:35370 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1ibIGp-0004Pe-Bp
	for submit <at> debbugs.gnu.org; Sun, 01 Dec 2019 00:59:47 -0500
Received: from eggs.gnu.org ([209.51.188.92]:53858)
 by debbugs.gnu.org with esmtp (Exim 4.84_2)
 (envelope-from <rms@HIDDEN>) id 1ibIGn-0004PI-Pp
 for 38317 <at> debbugs.gnu.org; Sun, 01 Dec 2019 00:59:46 -0500
Received: from fencepost.gnu.org ([2001:470:142:3::e]:44928)
 by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from <rms@HIDDEN>)
 id 1ibIGi-0004CX-Hd; Sun, 01 Dec 2019 00:59:40 -0500
Received: from rms by fencepost.gnu.org with local (Exim 4.82)
 (envelope-from <rms@HIDDEN>)
 id 1ibIGh-0000KC-M2; Sun, 01 Dec 2019 00:59:39 -0500
Content-Type: text/plain; charset=Utf-8
From: Richard Stallman <rms@HIDDEN>
to: federicotedin@HIDDEN, 38317 <at> debbugs.gnu.org, larsi@HIDDEN
In-Reply-To: <E1iaYjV-000433-3V@HIDDEN> (message from Richard
 Stallman on Fri, 29 Nov 2019 00:22:21 -0500)
Subject: Re: bug#38317: Buffer-local variables don't work as history for
 read-from-minibuffer
References: <87eey0lxxm.fsf@HIDDEN> <87v9rcqbls.fsf@HIDDEN>
 <5a0c68d0-4d25-bf8d-fbe8-f106b0f92210@HIDDEN>
 <875zjareo1.fsf@HIDDEN> <874kyu72kl.fsf@HIDDEN>
 <87wobq5gs0.fsf@HIDDEN> <87o8wyl2wa.fsf@HIDDEN>
 <87k17lfscs.fsf@HIDDEN> <87h82pw3vr.fsf@HIDDEN>
 <83y2w1p1f7.fsf@HIDDEN> <87d0ddvxnk.fsf@HIDDEN>
 <E1iaYjV-000433-3V@HIDDEN>
Message-Id: <E1ibIGh-0000KC-M2@HIDDEN>
Date: Sun, 01 Dec 2019 00:59:39 -0500
X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic]
X-Spam-Score: -0.8 (/)
X-Debbugs-Envelope-To: 38317
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.18
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Reply-To: rms@HIDDEN
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
X-Spam-Score: -1.8 (-)

[[[ To any NSA and FBI agents reading my email: please consider    ]]]
[[[ whether defending the US Constitution against all enemies,     ]]]
[[[ foreign or domestic, requires you to follow Snowden's example. ]]]

  > Since the two sections have the same name, would it be helpful to give
  > the Emacs Manual section a cross reference to the Elisp Manual section?
  > Perhaps, "See also the section of the same name, @xref{...}."

Someone responded that the two sections are not about the same topic.
It may nonetheless be useful to make each one mention the other
in a notice to prevent this kind of confusion.

-- 
Dr Richard Stallman
Founder, Free Software Foundation (https://gnu.org, https://fsf.org)
Internet Hall-of-Famer (https://internethalloffame.org)






Information forwarded to bug-gnu-emacs@HIDDEN:
bug#38317; Package emacs. Full text available.

Message received at 38317 <at> debbugs.gnu.org:


Received: (at 38317) by debbugs.gnu.org; 29 Nov 2019 17:02:34 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Fri Nov 29 12:02:34 2019
Received: from localhost ([127.0.0.1]:33504 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1iajf8-0005oy-9n
	for submit <at> debbugs.gnu.org; Fri, 29 Nov 2019 12:02:34 -0500
Received: from mail-wm1-f45.google.com ([209.85.128.45]:33158)
 by debbugs.gnu.org with esmtp (Exim 4.84_2)
 (envelope-from <federicotedin@HIDDEN>) id 1iajf6-0005ok-QS
 for 38317 <at> debbugs.gnu.org; Fri, 29 Nov 2019 12:02:33 -0500
Received: by mail-wm1-f45.google.com with SMTP id y23so5593178wma.0
 for <38317 <at> debbugs.gnu.org>; Fri, 29 Nov 2019 09:02:32 -0800 (PST)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025;
 h=from:to:cc:subject:references:date:in-reply-to:message-id
 :user-agent:mime-version;
 bh=XlMreszL4qiYBky/ePl7NyCDJAiKWg8APH9dLGeotE8=;
 b=UHfzlj5kVyXtv7htxSJIYq44QvGkpKOxWrePDNzH9YY2z4ikzb3/EZLl2y0etJmcYy
 KoivMi9xuFaMxhN2YkemB6VIY2hrFkmGJEyQythYyXDiMg7ryyAfcspiB0y6VZNdxkDK
 56fmzsJKbZ8pyNfdFozz4OV5LFf9GaCP2nCZeWxDedwKZ4A+kZCdndXcE+aKoa5sk7A5
 +Vf8ztFlb9ZJu+e87uQ/4RaCRS2cKX12X7EIhhkIvBghRnjcz/yJQreU2pKAdPuKxspC
 +pxhP9DpE9yUapKZxEUbmTaxvsLcr0qODsiT8WeVI7TrHtVUdSPxe+evdw/6GrGv3Qbw
 BEeg==
X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
 d=1e100.net; s=20161025;
 h=x-gm-message-state:from:to:cc:subject:references:date:in-reply-to
 :message-id:user-agent:mime-version;
 bh=XlMreszL4qiYBky/ePl7NyCDJAiKWg8APH9dLGeotE8=;
 b=hyijt6vHhhUmJPY6FcsydVWEqxdvpD+cmHu9N6dkohornORs6CiGHhs+xTTDZ1M9CY
 LB4warojRFw8igxXhpfgQGGJk/unccwlwy2/Effvc7K+fLn+MlXCIy05zYwUrCskwwyN
 FqtAPIAajP6LN9kFGqHHAOXZFgnhEt/DFYiU/rNHsRRviCyQ3q2gEAgL84R98QW75r+X
 UmcYjL7YSDXFNtxhwJ3rmOGJE2VYh2z5QeQanBr3lkMRMgxiaoGPt0vUaU5DK3l5y4CP
 SvOmzCprrEd0ZxZxKh1xoRgTukw2l60t/GQhFUN1WSjISH2aCAZNnij4GRBdeQmT2Oye
 H/8w==
X-Gm-Message-State: APjAAAVMRgEjWx1mWtTM6cg5WXHXJfTN0iAb24nbBHsL/EiX7uGBpUNc
 CAvYIpF/uCP3F8igMdViSwOnVaygVbI=
X-Google-Smtp-Source: APXvYqxWl6+r1l5k1S60epdGC8kI5C/YI9e3BlX2mY55Z2pHsYbSEuEuPKXDie7mDz/La4DwsXF54Q==
X-Received: by 2002:a1c:2745:: with SMTP id n66mr15533292wmn.171.1575046946357; 
 Fri, 29 Nov 2019 09:02:26 -0800 (PST)
Received: from lead ([2a02:8109:8ac0:2ff0:918e:a083:2c78:74e5])
 by smtp.gmail.com with ESMTPSA id u187sm14681507wme.15.2019.11.29.09.02.24
 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256);
 Fri, 29 Nov 2019 09:02:25 -0800 (PST)
From: Federico Tedin <federicotedin@HIDDEN>
To: Eli Zaretskii <eliz@HIDDEN>
Subject: Re: bug#38317: Buffer-local variables don't work as history for
 read-from-minibuffer
References: <87eey0lxxm.fsf@HIDDEN> <87v9rcqbls.fsf@HIDDEN>
 <5a0c68d0-4d25-bf8d-fbe8-f106b0f92210@HIDDEN>
 <875zjareo1.fsf@HIDDEN> <874kyu72kl.fsf@HIDDEN>
 <87wobq5gs0.fsf@HIDDEN> <87o8wyl2wa.fsf@HIDDEN>
 <87k17lfscs.fsf@HIDDEN> <87h82pw3vr.fsf@HIDDEN>
 <83y2w1p1f7.fsf@HIDDEN> <87d0ddvxnk.fsf@HIDDEN>
 <E1iaYjV-000433-3V@HIDDEN> <83blsvoudj.fsf@HIDDEN>
Date: Fri, 29 Nov 2019 18:02:23 +0100
In-Reply-To: <83blsvoudj.fsf@HIDDEN> (Eli Zaretskii's message of "Fri, 29 Nov
 2019 12:21:44 +0200")
Message-ID: <87blsu7h0g.fsf@HIDDEN>
User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/26.3 (gnu/linux)
MIME-Version: 1.0
Content-Type: text/plain
X-Spam-Score: 0.0 (/)
X-Debbugs-Envelope-To: 38317
Cc: larsi@HIDDEN, 38317 <at> debbugs.gnu.org, rms@HIDDEN
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.18
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
X-Spam-Score: -1.0 (-)

>> Since the two sections have the same name, would it be helpful to give
>> the Emacs Manual section a cross reference to the Elisp Manual section?
>> Perhaps, "See also the section of the same name, @xref{...}."
>
> They have identical names, but discuss radically different subjects.

Would the following titles make sense?

emacs/Minibuffer History -> emacs/Minibuffer History Variable[s]

elisp/Minibuffer History -> elisp/Navigating the Minibuffer History
elisp/Minibuffer History -> elisp/Minibuffer History Commands

Obviously it's an unimportant thing to change, but I think it would help
users searching for "emacs minibuffer history" on the Internet.

- Fede




Information forwarded to bug-gnu-emacs@HIDDEN:
bug#38317; Package emacs. Full text available.

Message received at 38317 <at> debbugs.gnu.org:


Received: (at 38317) by debbugs.gnu.org; 29 Nov 2019 10:21:53 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Fri Nov 29 05:21:53 2019
Received: from localhost ([127.0.0.1]:59394 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1iadPN-0004Dy-CO
	for submit <at> debbugs.gnu.org; Fri, 29 Nov 2019 05:21:53 -0500
Received: from eggs.gnu.org ([209.51.188.92]:36653)
 by debbugs.gnu.org with esmtp (Exim 4.84_2)
 (envelope-from <eliz@HIDDEN>) id 1iadPK-0004Di-Pv
 for 38317 <at> debbugs.gnu.org; Fri, 29 Nov 2019 05:21:51 -0500
Received: from fencepost.gnu.org ([2001:470:142:3::e]:59863)
 by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from <eliz@HIDDEN>)
 id 1iadPE-0001Qu-0g; Fri, 29 Nov 2019 05:21:44 -0500
Received: from [176.228.60.248] (port=1635 helo=home-c4e4a596f7)
 by fencepost.gnu.org with esmtpsa (TLS1.2:RSA_AES_256_CBC_SHA1:256)
 (Exim 4.82) (envelope-from <eliz@HIDDEN>)
 id 1iadP1-0005o0-8o; Fri, 29 Nov 2019 05:21:35 -0500
Date: Fri, 29 Nov 2019 12:21:44 +0200
Message-Id: <83blsvoudj.fsf@HIDDEN>
From: Eli Zaretskii <eliz@HIDDEN>
To: rms@HIDDEN
In-reply-to: <E1iaYjV-000433-3V@HIDDEN> (message from Richard
 Stallman on Fri, 29 Nov 2019 00:22:21 -0500)
Subject: Re: bug#38317: Buffer-local variables don't work as history for
 read-from-minibuffer
References: <87eey0lxxm.fsf@HIDDEN> <87v9rcqbls.fsf@HIDDEN>
 <5a0c68d0-4d25-bf8d-fbe8-f106b0f92210@HIDDEN>
 <875zjareo1.fsf@HIDDEN> <874kyu72kl.fsf@HIDDEN>
 <87wobq5gs0.fsf@HIDDEN> <87o8wyl2wa.fsf@HIDDEN>
 <87k17lfscs.fsf@HIDDEN> <87h82pw3vr.fsf@HIDDEN>
 <83y2w1p1f7.fsf@HIDDEN> <87d0ddvxnk.fsf@HIDDEN>
 <E1iaYjV-000433-3V@HIDDEN>
X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic]
X-Spam-Score: -0.8 (/)
X-Debbugs-Envelope-To: 38317
Cc: larsi@HIDDEN, 38317 <at> debbugs.gnu.org, federicotedin@HIDDEN
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.18
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
X-Spam-Score: -1.8 (-)

> From: Richard Stallman <rms@HIDDEN>
> Cc: eliz@HIDDEN, larsi@HIDDEN, 38317 <at> debbugs.gnu.org
> Date: Fri, 29 Nov 2019 00:22:21 -0500
> 
> Since the two sections have the same name, would it be helpful to give
> the Emacs Manual section a cross reference to the Elisp Manual section?
> Perhaps, "See also the section of the same name, @xref{...}."

They have identical names, but discuss radically different subjects.




Information forwarded to bug-gnu-emacs@HIDDEN:
bug#38317; Package emacs. Full text available.

Message received at 38317 <at> debbugs.gnu.org:


Received: (at 38317) by debbugs.gnu.org; 29 Nov 2019 05:22:36 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Fri Nov 29 00:22:36 2019
Received: from localhost ([127.0.0.1]:59309 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1iaYjk-0005fs-C9
	for submit <at> debbugs.gnu.org; Fri, 29 Nov 2019 00:22:36 -0500
Received: from eggs.gnu.org ([209.51.188.92]:54424)
 by debbugs.gnu.org with esmtp (Exim 4.84_2)
 (envelope-from <rms@HIDDEN>) id 1iaYjh-0005fd-KN
 for 38317 <at> debbugs.gnu.org; Fri, 29 Nov 2019 00:22:34 -0500
Received: from fencepost.gnu.org ([2001:470:142:3::e]:55621)
 by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from <rms@HIDDEN>)
 id 1iaYjY-000163-Ez; Fri, 29 Nov 2019 00:22:24 -0500
Received: from rms by fencepost.gnu.org with local (Exim 4.82)
 (envelope-from <rms@HIDDEN>)
 id 1iaYjV-000433-3V; Fri, 29 Nov 2019 00:22:21 -0500
Content-Type: text/plain; charset=Utf-8
From: Richard Stallman <rms@HIDDEN>
To: Federico Tedin <federicotedin@HIDDEN>
In-Reply-To: <87d0ddvxnk.fsf@HIDDEN> (message from Federico Tedin on Wed,
 27 Nov 2019 22:04:31 +0100)
Subject: Re: bug#38317: Buffer-local variables don't work as history for
 read-from-minibuffer
References: <87eey0lxxm.fsf@HIDDEN> <87v9rcqbls.fsf@HIDDEN>
 <5a0c68d0-4d25-bf8d-fbe8-f106b0f92210@HIDDEN>
 <875zjareo1.fsf@HIDDEN> <874kyu72kl.fsf@HIDDEN>
 <87wobq5gs0.fsf@HIDDEN> <87o8wyl2wa.fsf@HIDDEN>
 <87k17lfscs.fsf@HIDDEN> <87h82pw3vr.fsf@HIDDEN>
 <83y2w1p1f7.fsf@HIDDEN> <87d0ddvxnk.fsf@HIDDEN>
Message-Id: <E1iaYjV-000433-3V@HIDDEN>
Date: Fri, 29 Nov 2019 00:22:21 -0500
X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic]
X-Spam-Score: -0.8 (/)
X-Debbugs-Envelope-To: 38317
Cc: eliz@HIDDEN, 38317 <at> debbugs.gnu.org, larsi@HIDDEN
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.18
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Reply-To: rms@HIDDEN
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
X-Spam-Score: -1.8 (-)

[[[ To any NSA and FBI agents reading my email: please consider    ]]]
[[[ whether defending the US Constitution against all enemies,     ]]]
[[[ foreign or domestic, requires you to follow Snowden's example. ]]]

  > You're right, I was looking at the Emacs manual instead of the Elisp
  > manual (the sections have the same title). I can see that the Elisp manual is
  > more specific about the history list variable. I could mention the
  > possibility of using a buffer-local variable there.

Since the two sections have the same name, would it be helpful to give
the Emacs Manual section a cross reference to the Elisp Manual section?
Perhaps, "See also the section of the same name, @xref{...}."
-- 
Dr Richard Stallman
Founder, Free Software Foundation (https://gnu.org, https://fsf.org)
Internet Hall-of-Famer (https://internethalloffame.org)






Information forwarded to bug-gnu-emacs@HIDDEN:
bug#38317; Package emacs. Full text available.

Message received at 38317 <at> debbugs.gnu.org:


Received: (at 38317) by debbugs.gnu.org; 28 Nov 2019 12:05:52 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Thu Nov 28 07:05:52 2019
Received: from localhost ([127.0.0.1]:56786 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1iaIYR-0005Ps-TO
	for submit <at> debbugs.gnu.org; Thu, 28 Nov 2019 07:05:52 -0500
Received: from mail-wm1-f54.google.com ([209.85.128.54]:38593)
 by debbugs.gnu.org with esmtp (Exim 4.84_2)
 (envelope-from <federicotedin@HIDDEN>) id 1iaIYP-0005Pe-Mb
 for 38317 <at> debbugs.gnu.org; Thu, 28 Nov 2019 07:05:50 -0500
Received: by mail-wm1-f54.google.com with SMTP id z19so11432941wmk.3
 for <38317 <at> debbugs.gnu.org>; Thu, 28 Nov 2019 04:05:49 -0800 (PST)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025;
 h=from:to:cc:subject:references:date:in-reply-to:message-id
 :user-agent:mime-version;
 bh=NjrhGaosaPVGHaPtved6wZWN3RBxQDe0I2togm4OizE=;
 b=bpwx6MY2BqC2yCF9W4OTVIB0XrrwpG7yly1GJe0o0G0NV9PK2Ej1kt6Fc0zh1KdxI7
 KuHyjyVXcr8XshrFIZcSR1EQsxs68y7QrDZ1GHVomlSPzmcfFFF4xRSuzq0TrgCDKYr7
 3pujQRNrwvm+pVmTlchD4DOgQf22+qIbCO4js37ENAqkEVX1It7AxxyYCE3kchP95QU0
 g1qj4N3ifGXXsiMl5Jq0gk1lM6za65VQthxE7PjeXk0Jp509apPlu9BQBjiCgUShKPSB
 8SheAe0g4ZnAnyg+WoIIH9Y7Jr1JBJ38qpqfq0WOw1gjTM9tAFajLQ/pJLyx+ouCahzS
 6Xyg==
X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
 d=1e100.net; s=20161025;
 h=x-gm-message-state:from:to:cc:subject:references:date:in-reply-to
 :message-id:user-agent:mime-version;
 bh=NjrhGaosaPVGHaPtved6wZWN3RBxQDe0I2togm4OizE=;
 b=eW+ZHyDy0a7XkgfQaH4YINOCdI4RENLGd5bf5M8W3QvXu8EQLtiZIhXLkD9tndQn3q
 sFEPcudJC8Cb2e1ynT6Kdr++FPAoAOUqh050+I9i+Mw9wXwdQCpEc1b2LTfUr4c5FYpu
 E/ZME0oE7Co556NLW4v8Z0skNg+lj3KdCGqUpCTXq5Ez/wemW/tXt0YTqK/1n3bd2xNl
 3m6jppAQLm4My/9FAgGH25S4jkqHrAvXFwGQEG8O39hcyDv0Mcc38IXsb7anlg/Zv24b
 QIma0r3KrvlNY00t/a8zqe5RAUyC34b4UgzAAOOkvvy8uM0A40BQyTBhHakbgnzMBtnc
 BNLQ==
X-Gm-Message-State: APjAAAXrTa6qRwebajRGrRcK26RdE5F9XBv2DfGqjD3U5k2jbkiuNJRO
 MgaeRW2bW+fG0MPFz3E66Zc=
X-Google-Smtp-Source: APXvYqyOA3zhPBLDEy/vA50mKcRgcbBZYEyF9BRFAU36BTq8wXtKJ9JRlA0zdGUExYvHwNcw02hsGA==
X-Received: by 2002:a1c:ca:: with SMTP id 193mr9174638wma.111.1574942742900;
 Thu, 28 Nov 2019 04:05:42 -0800 (PST)
Received: from lead ([2a02:8109:8ac0:2ff0:918e:a083:2c78:74e5])
 by smtp.gmail.com with ESMTPSA id t16sm10699318wmt.38.2019.11.28.04.05.41
 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256);
 Thu, 28 Nov 2019 04:05:41 -0800 (PST)
From: Federico Tedin <federicotedin@HIDDEN>
To: 38317 <at> debbugs.gnu.org
Subject: Re: bug#38317: Buffer-local variables don't work as history for
 read-from-minibuffer
References: <87eey0lxxm.fsf@HIDDEN> <87v9rcqbls.fsf@HIDDEN>
 <5a0c68d0-4d25-bf8d-fbe8-f106b0f92210@HIDDEN>
 <875zjareo1.fsf@HIDDEN> <874kyu72kl.fsf@HIDDEN>
 <87wobq5gs0.fsf@HIDDEN> <87o8wyl2wa.fsf@HIDDEN>
 <87k17lfscs.fsf@HIDDEN> <87h82pw3vr.fsf@HIDDEN>
 <83y2w1p1f7.fsf@HIDDEN> <87d0ddvxnk.fsf@HIDDEN>
Date: Thu, 28 Nov 2019 13:05:40 +0100
In-Reply-To: <87d0ddvxnk.fsf@HIDDEN> (Federico Tedin's message of "Wed, 27
 Nov 2019 22:04:31 +0100")
Message-ID: <874kyow6i3.fsf@HIDDEN>
User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/26.3 (gnu/linux)
MIME-Version: 1.0
Content-Type: multipart/mixed; boundary="=-=-="
X-Spam-Score: 0.0 (/)
X-Debbugs-Envelope-To: 38317
Cc: larsi@HIDDEN, Eli Zaretskii <eliz@HIDDEN>
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.18
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
X-Spam-Score: -1.0 (-)

--=-=-=
Content-Type: text/plain

I'm now attaching a new patch with feedback corrections from everyone in
the thread (threads?).


--=-=-=
Content-Type: text/x-diff
Content-Disposition: attachment; filename=minibuffer.patch
Content-Description: patch

From 481f85d70463207c5ca5c43c287f1edcc6ed288e Mon Sep 17 00:00:00 2001
From: Federico Tedin <federicotedin@HIDDEN>
Date: Thu, 28 Nov 2019 12:59:52 +0100
Subject: [PATCH 1/1] Make HIST arg of read-from-minibuffer work with
 buffer-local vars

* lisp/simple.el (minibuffer-history-values): New function, should be
used to access the minibuffer input history variable when the
minibuffer might be active.  If the variable is buffer-local, the
previous buffer's value will be used.
(goto-history-element): Use the new function to access the minibuffer
history.
(minibuffer-history-isearch-wrap): Use the new function to access the
minibuffer history.
* src/minibuf.c (read_minibuf): Switch to previous buffer temporarily
before updating history list (Bug#38317).
(read-from-minibuffer): Extend documentation to mention that the
result of using the command will be added to the history list by
default.
* doc/lispref/minibuf.texi (Minibuffer History): Mention the
possibility of using a buffer-local variable as history.
* etc/NEWS: Announce changes.
---
 doc/lispref/minibuf.texi |  3 ++-
 etc/NEWS                 |  6 ++++++
 lisp/simple.el           | 18 +++++++++++++-----
 src/minibuf.c            | 20 ++++++++++++++++++--
 4 files changed, 39 insertions(+), 8 deletions(-)

diff --git a/doc/lispref/minibuf.texi b/doc/lispref/minibuf.texi
index 4a218fe737..dde30ce67f 100644
--- a/doc/lispref/minibuf.texi
+++ b/doc/lispref/minibuf.texi
@@ -547,7 +547,8 @@ Minibuffer History
   If you don't specify @var{history}, then the default history list
 @code{minibuffer-history} is used.  For other standard history lists,
 see below.  You can also create your own history list variable; just
-initialize it to @code{nil} before the first use.
+initialize it to @code{nil} before the first use.  If the variable is
+buffer local, then each buffer will have its own input history list.
 
   Both @code{read-from-minibuffer} and @code{completing-read} add new
 elements to the history list automatically, and provide commands to
diff --git a/etc/NEWS b/etc/NEWS
index cb73e46358..bc088129f8 100644
--- a/etc/NEWS
+++ b/etc/NEWS
@@ -522,6 +522,12 @@ Note that this key binding will not work on MS-Windows systems if
 key binding with an upper case letter - if you can type it, you can
 bind it.
 
++++
+** 'read-from-minibuffer' now works with buffer-local history variables.
+The HIST argument of 'read-from-minibuffer' now works correctly with
+buffer-local variables.  This means that different buffers can have
+their own separated input history list if desired.
+
 
 * Editing Changes in Emacs 27.1
 
diff --git a/lisp/simple.el b/lisp/simple.el
index 2aac557154..ef36ff9f8a 100644
--- a/lisp/simple.el
+++ b/lisp/simple.el
@@ -2041,7 +2041,7 @@ previous-matching-history-element
 	     (null minibuffer-text-before-history))
 	(setq minibuffer-text-before-history
 	      (minibuffer-contents-no-properties)))
-    (let ((history (symbol-value minibuffer-history-variable))
+    (let ((history (minibuffer-history-value))
 	  (case-fold-search
 	   (if (isearch-no-upper-case-p regexp t) ; assume isearch.el is dumped
 	       ;; On some systems, ignore case for file names.
@@ -2141,6 +2141,14 @@ minibuffer-default-add-completions
 	(append def all)
       (cons def (delete def all)))))
 
+(defun minibuffer-history-value ()
+  "Return the value of the minibuffer input history list.
+If `minibuffer-history-variable' points to a buffer-local variable and
+the minibuffer is active, return the buffer-local value for the buffer
+that was current when the minibuffer was activated."
+  (buffer-local-value minibuffer-history-variable
+                      (window-buffer (minibuffer-selected-window))))
+
 (defun goto-history-element (nabs)
   "Puts element of the minibuffer history in the minibuffer.
 The argument NABS specifies the absolute history position in
@@ -2169,8 +2177,8 @@ goto-history-element
 	(user-error (if minibuffer-default
                         "End of defaults; no next item"
                       "End of history; no default available")))
-    (if (> nabs (if (listp (symbol-value minibuffer-history-variable))
-                    (length (symbol-value minibuffer-history-variable))
+    (if (> nabs (if (listp (minibuffer-history-value))
+                    (length (minibuffer-history-value))
                   0))
 	(user-error "Beginning of history; no preceding item"))
     (unless (memq last-command '(next-history-element
@@ -2192,7 +2200,7 @@ goto-history-element
 	   (setq minibuffer-returned-to-present t)
 	   (setq minibuffer-text-before-history nil))
 	  (t (setq elt (nth (1- minibuffer-history-position)
-			    (symbol-value minibuffer-history-variable)))))
+			    (minibuffer-history-value)))))
     (insert
      (if (and (eq minibuffer-history-sexp-flag (minibuffer-depth))
 	      (not minibuffer-returned-to-present))
@@ -2445,7 +2453,7 @@ minibuffer-history-isearch-wrap
   ;; beginning/end of the history, wrap the search to the first/last
   ;; minibuffer history element.
   (if isearch-forward
-      (goto-history-element (length (symbol-value minibuffer-history-variable)))
+      (goto-history-element (length (minibuffer-history-value)))
     (goto-history-element 0))
   (setq isearch-success t)
   (goto-char (if isearch-forward (minibuffer-prompt-end) (point-max))))
diff --git a/src/minibuf.c b/src/minibuf.c
index 1e87c5044a..bdae01dbc5 100644
--- a/src/minibuf.c
+++ b/src/minibuf.c
@@ -353,7 +353,7 @@ read_minibuf (Lisp_Object map, Lisp_Object initial, Lisp_Object prompt,
 	      Lisp_Object histvar, Lisp_Object histpos, Lisp_Object defalt,
 	      bool allow_props, bool inherit_input_method)
 {
-  Lisp_Object val;
+  Lisp_Object val, previous_buffer = Fcurrent_buffer ();
   ptrdiff_t count = SPECPDL_INDEX ();
   Lisp_Object mini_frame, ambient_dir, minibuffer, input_method;
   Lisp_Object enable_multibyte;
@@ -698,7 +698,20 @@ read_minibuf (Lisp_Object map, Lisp_Object initial, Lisp_Object prompt,
 
   /* Add the value to the appropriate history list, if any.  */
   if (! (NILP (Vhistory_add_new_input) || NILP (histstring)))
-    call2 (intern ("add-to-history"), Vminibuffer_history_variable, histstring);
+    {
+      ptrdiff_t count2 = SPECPDL_INDEX ();
+
+      /* If possible, switch back to the previous buffer first, in
+	 case the history variable is buffer-local.  */
+      if (BUFFER_LIVE_P (XBUFFER (previous_buffer)))
+	{
+	  record_unwind_current_buffer ();
+	  Fset_buffer (previous_buffer);
+	}
+
+      call2 (intern ("add-to-history"), Vminibuffer_history_variable, histstring);
+      unbind_to (count2, Qnil);
+    }
 
   /* If Lisp form desired instead of string, parse it.  */
   if (expflag)
@@ -879,6 +892,9 @@ Fifth arg HIST, if non-nil, specifies a history list and optionally
   starting from 1 at the beginning of the list.  If HIST is the symbol
   `t', history is not recorded.
 
+  If `history-add-new-input' is non-nil (the default), the result will
+  be added to the history list using `add-to-history'.
+
 Sixth arg DEFAULT-VALUE, if non-nil, should be a string, which is used
   as the default to `read' if READ is non-nil and the user enters
   empty input.  But if READ is nil, this function does _not_ return
-- 
2.17.1


--=-=-=--




Information forwarded to bug-gnu-emacs@HIDDEN:
bug#38317; Package emacs. Full text available.

Message received at 38317 <at> debbugs.gnu.org:


Received: (at 38317) by debbugs.gnu.org; 27 Nov 2019 21:55:54 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Wed Nov 27 16:55:54 2019
Received: from localhost ([127.0.0.1]:56289 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1ia5Ht-00086f-Q8
	for submit <at> debbugs.gnu.org; Wed, 27 Nov 2019 16:55:53 -0500
Received: from camel.birch.relay.mailchannels.net ([23.83.209.29]:17517)
 by debbugs.gnu.org with esmtp (Exim 4.84_2)
 (envelope-from <juri@HIDDEN>) id 1ia5Hr-00086W-8N
 for 38317 <at> debbugs.gnu.org; Wed, 27 Nov 2019 16:55:51 -0500
X-Sender-Id: dreamhost|x-authsender|jurta@HIDDEN
Received: from relay.mailchannels.net (localhost [127.0.0.1])
 by relay.mailchannels.net (Postfix) with ESMTP id EC97A2143C;
 Wed, 27 Nov 2019 21:55:49 +0000 (UTC)
Received: from pdx1-sub0-mail-a94.g.dreamhost.com
 (100-96-4-107.trex.outbound.svc.cluster.local [100.96.4.107])
 (Authenticated sender: dreamhost)
 by relay.mailchannels.net (Postfix) with ESMTPA id 53C2321DA4;
 Wed, 27 Nov 2019 21:55:49 +0000 (UTC)
X-Sender-Id: dreamhost|x-authsender|jurta@HIDDEN
Received: from pdx1-sub0-mail-a94.g.dreamhost.com ([TEMPUNAVAIL].
 [64.90.62.162]) (using TLSv1.2 with cipher DHE-RSA-AES256-GCM-SHA384)
 by 0.0.0.0:2500 (trex/5.18.5); Wed, 27 Nov 2019 21:55:49 +0000
X-MC-Relay: Neutral
X-MailChannels-SenderId: dreamhost|x-authsender|jurta@HIDDEN
X-MailChannels-Auth-Id: dreamhost
X-Power-Abaft: 6b504b927111e675_1574891749596_3313524259
X-MC-Loop-Signature: 1574891749596:2022281800
X-MC-Ingress-Time: 1574891749595
Received: from pdx1-sub0-mail-a94.g.dreamhost.com (localhost [127.0.0.1])
 by pdx1-sub0-mail-a94.g.dreamhost.com (Postfix) with ESMTP id 114A69C45A;
 Wed, 27 Nov 2019 13:55:47 -0800 (PST)
DKIM-Signature: v=1; a=rsa-sha1; c=relaxed; d=linkov.net; h=from:to:cc
 :subject:references:date:in-reply-to:message-id:mime-version
 :content-type; s=linkov.net; bh=o3ynUs7+sjcl826y+NdeeaPPdag=; b=
 ZIbaVLPxseM56YqHb+ORD3utyuxO8TV+abhwQaJ5zpe1xPrXJJ/nufHZzip9WLI9
 tvJ74EKkcDcPGFePievq18oCDgRywl+frliMCBZiIetk4qEHgOw7pDT1UYX1Y+J4
 QXOJ7YyLt6BoIlZkM44O36/3PVgIuCqNffWiK0sJnKw=
Received: from mail.jurta.org (m91-129-96-42.cust.tele2.ee [91.129.96.42])
 (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits))
 (No client certificate requested)
 (Authenticated sender: jurta@HIDDEN)
 by pdx1-sub0-mail-a94.g.dreamhost.com (Postfix) with ESMTPSA id D758F9C453;
 Wed, 27 Nov 2019 13:55:44 -0800 (PST)
X-DH-BACKEND: pdx1-sub0-mail-a94
From: Juri Linkov <juri@HIDDEN>
To: Federico Tedin <federicotedin@HIDDEN>
Subject: Re: bug#38317: Buffer-local variables don't work as history for
 read-from-minibuffer
Organization: LINKOV.NET
References: <87eey0lxxm.fsf@HIDDEN> <87v9rcqbls.fsf@HIDDEN>
 <5a0c68d0-4d25-bf8d-fbe8-f106b0f92210@HIDDEN>
 <875zjareo1.fsf@HIDDEN> <874kyu72kl.fsf@HIDDEN>
 <87wobq5gs0.fsf@HIDDEN> <87o8wyl2wa.fsf@HIDDEN>
Date: Wed, 27 Nov 2019 23:19:11 +0200
In-Reply-To: <87o8wyl2wa.fsf@HIDDEN> (Federico Tedin's message of "Tue, 26
 Nov 2019 22:54:29 +0100")
Message-ID: <87y2w18bi8.fsf@HIDDEN>
User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/27.0.50 (x86_64-pc-linux-gnu)
MIME-Version: 1.0
Content-Type: text/plain
X-Spam-Score: 0.0 (/)
X-Debbugs-Envelope-To: 38317
Cc: Lars Ingebrigtsen <larsi@HIDDEN>, 38317 <at> debbugs.gnu.org
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.18
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
X-Spam-Score: -1.0 (-)

> I'm now attaching a final version of my patch.
>
> I've tested the following commands with it, using `read-from-minibuffer'
> with a buffer-local HIST:
>
> - previous-history-element (M-p)
> - next-history-element (M-n)
> - previous-matching-history-element (M-r)
> - next-matching-history-element (M-s)
> - isearch-forward (C-s)
> - isearch-backward (C-r)

Thanks, only one question about the function name:

> +(defun minibuffer-history-values ()
> +  "Return the minibuffer input history values.

Why "values" in the plural form?  This looks like a multivalued function.
It would be more clear with a singular "value".




Information forwarded to bug-gnu-emacs@HIDDEN:
bug#38317; Package emacs. Full text available.

Message received at 38317 <at> debbugs.gnu.org:


Received: (at 38317) by debbugs.gnu.org; 27 Nov 2019 21:04:41 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Wed Nov 27 16:04:41 2019
Received: from localhost ([127.0.0.1]:56272 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1ia4UL-0006rb-8S
	for submit <at> debbugs.gnu.org; Wed, 27 Nov 2019 16:04:41 -0500
Received: from mail-wr1-f42.google.com ([209.85.221.42]:42197)
 by debbugs.gnu.org with esmtp (Exim 4.84_2)
 (envelope-from <federicotedin@HIDDEN>) id 1ia4UJ-0006rO-M7
 for 38317 <at> debbugs.gnu.org; Wed, 27 Nov 2019 16:04:40 -0500
Received: by mail-wr1-f42.google.com with SMTP id a15so28404523wrf.9
 for <38317 <at> debbugs.gnu.org>; Wed, 27 Nov 2019 13:04:39 -0800 (PST)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025;
 h=from:to:cc:subject:references:date:in-reply-to:message-id
 :user-agent:mime-version;
 bh=vNh3abtuhWwHzmHXc+OFK4fnE9cL/VGTIbhOa1Zq2RY=;
 b=eOxSY44PqJH3Fpox4Td25eYKB/yQ3k92T3RVmDufknhQGJ0FTwDHxLZHms3CXKFikA
 O4J0hVTgiVbPPsrcPIfLdC5NrZoNAVVBKg8AfgWVoAVYbKXaY1vnC9GXxSABxukkdPV6
 pMpfjo/7YVYEOD2pz4F7E7xN8GB5TnDAIUs7uCzCt7g9AHD1TxRX/SLeoEbuvXdcxDnY
 F3NewBpZStDqgmanvwzrwy8gnaDDIj1JWp6wkyr317P8ZPMTEMp8g4WZJhzPM0Bgs7zy
 TCwOd0R6sM33pROiwdgzIi72h4a/1AUXrdU/y8dpMsByQ9By2CncbJMk2gh7XqfKV4J2
 oe9w==
X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
 d=1e100.net; s=20161025;
 h=x-gm-message-state:from:to:cc:subject:references:date:in-reply-to
 :message-id:user-agent:mime-version;
 bh=vNh3abtuhWwHzmHXc+OFK4fnE9cL/VGTIbhOa1Zq2RY=;
 b=QzXCQCcyjVD0utQ+WvbTEjPOK7wMQtZZWBkG+vVN+FPzac1mjdtAhPbADQx3DNorb4
 FdlhOrHUSZ3avERRSjgJFy8AJnRnqApcqrtDO+CEsSP9C3PgNAyHxXL0QkTmoFbhM4YO
 FH8ngnMdEHIxnjbO7hDjkwLVrZ+IyQFxQ4ql3kLyG6u1/9eXkRYYmuPEeKwBF18m1P0N
 RoVbsDrDP3gjJw46EECjlFIcMY48mCzeoGe5FEJI5M7YDhfKjAz4GKxn42vcL2LAn/Lz
 OEGOL/QwqX1oWk597qVsNp8gozIETah+Wl0uzMl+++/3pT9W+4+jmv/Z+vnxZ1dYE3JK
 2XRg==
X-Gm-Message-State: APjAAAUWL0Tyj/IsWgDhQVaIdFK/SPcu+CinBOkEiIoMAWFcaxaJpgoL
 NFlrgKY2yyRjoicDF67lVm2FUz/YSpY=
X-Google-Smtp-Source: APXvYqwOPrHTyieYq6rypoZEh/SgZkaUcDBQqiiAKwsMhnnJNCatCAz6n5LMXpZkZ6ex8xey4ftjxg==
X-Received: by 2002:adf:e2c1:: with SMTP id d1mr33366687wrj.130.1574888673419; 
 Wed, 27 Nov 2019 13:04:33 -0800 (PST)
Received: from lead ([2a02:8109:8ac0:2ff0:918e:a083:2c78:74e5])
 by smtp.gmail.com with ESMTPSA id n10sm2007251wrt.14.2019.11.27.13.04.31
 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256);
 Wed, 27 Nov 2019 13:04:32 -0800 (PST)
From: Federico Tedin <federicotedin@HIDDEN>
To: Eli Zaretskii <eliz@HIDDEN>
Subject: Re: bug#38317: Buffer-local variables don't work as history for
 read-from-minibuffer
References: <87eey0lxxm.fsf@HIDDEN> <87v9rcqbls.fsf@HIDDEN>
 <5a0c68d0-4d25-bf8d-fbe8-f106b0f92210@HIDDEN>
 <875zjareo1.fsf@HIDDEN> <874kyu72kl.fsf@HIDDEN>
 <87wobq5gs0.fsf@HIDDEN> <87o8wyl2wa.fsf@HIDDEN>
 <87k17lfscs.fsf@HIDDEN> <87h82pw3vr.fsf@HIDDEN>
 <83y2w1p1f7.fsf@HIDDEN>
Date: Wed, 27 Nov 2019 22:04:31 +0100
In-Reply-To: <83y2w1p1f7.fsf@HIDDEN> (Eli Zaretskii's message of "Wed, 27 Nov
 2019 21:25:00 +0200")
Message-ID: <87d0ddvxnk.fsf@HIDDEN>
User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/26.3 (gnu/linux)
MIME-Version: 1.0
Content-Type: text/plain
X-Spam-Score: 0.0 (/)
X-Debbugs-Envelope-To: 38317
Cc: larsi@HIDDEN, 38317 <at> debbugs.gnu.org
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.18
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
X-Spam-Score: -1.0 (-)

Eli Zaretskii <eliz@HIDDEN> writes:
> That section does mention the history variables, and even includes a
> list of them.  So I'm not sure why you say it doesn't.

You're right, I was looking at the Emacs manual instead of the Elisp
manual (the sections have the same title). I can see that the Elisp manual is
more specific about the history list variable. I could mention the
possibility of using a buffer-local variable there.

> That it adds to the history is worth mentioning, but the fact that it
> can be buffer-local we don't normally say explicitly, because it's
> expected to "just work".

Ok, thanks.





Information forwarded to bug-gnu-emacs@HIDDEN:
bug#38317; Package emacs. Full text available.

Message received at 38317 <at> debbugs.gnu.org:


Received: (at 38317) by debbugs.gnu.org; 27 Nov 2019 19:25:00 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Wed Nov 27 14:25:00 2019
Received: from localhost ([127.0.0.1]:56229 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1ia2vr-0004FX-NV
	for submit <at> debbugs.gnu.org; Wed, 27 Nov 2019 14:25:00 -0500
Received: from eggs.gnu.org ([209.51.188.92]:57550)
 by debbugs.gnu.org with esmtp (Exim 4.84_2)
 (envelope-from <eliz@HIDDEN>) id 1ia2vp-0004FK-Qp
 for 38317 <at> debbugs.gnu.org; Wed, 27 Nov 2019 14:24:58 -0500
Received: from fencepost.gnu.org ([2001:470:142:3::e]:56275)
 by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from <eliz@HIDDEN>)
 id 1ia2vk-0005gc-LZ; Wed, 27 Nov 2019 14:24:52 -0500
Received: from [176.228.60.248] (port=3040 helo=home-c4e4a596f7)
 by fencepost.gnu.org with esmtpsa (TLS1.2:RSA_AES_256_CBC_SHA1:256)
 (Exim 4.82) (envelope-from <eliz@HIDDEN>)
 id 1ia2vk-0008Qk-2r; Wed, 27 Nov 2019 14:24:52 -0500
Date: Wed, 27 Nov 2019 21:25:00 +0200
Message-Id: <83y2w1p1f7.fsf@HIDDEN>
From: Eli Zaretskii <eliz@HIDDEN>
To: Federico Tedin <federicotedin@HIDDEN>
In-reply-to: <87h82pw3vr.fsf@HIDDEN> (message from Federico Tedin on Wed,
 27 Nov 2019 19:50:00 +0100)
Subject: Re: bug#38317: Buffer-local variables don't work as history for
 read-from-minibuffer
References: <87eey0lxxm.fsf@HIDDEN> <87v9rcqbls.fsf@HIDDEN>
 <5a0c68d0-4d25-bf8d-fbe8-f106b0f92210@HIDDEN>
 <875zjareo1.fsf@HIDDEN> <874kyu72kl.fsf@HIDDEN>
 <87wobq5gs0.fsf@HIDDEN> <87o8wyl2wa.fsf@HIDDEN>
 <87k17lfscs.fsf@HIDDEN> <87h82pw3vr.fsf@HIDDEN>
X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic]
X-Spam-Score: -2.3 (--)
X-Debbugs-Envelope-To: 38317
Cc: larsi@HIDDEN, 38317 <at> debbugs.gnu.org
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.18
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
X-Spam-Score: -3.3 (---)

> From: Federico Tedin <federicotedin@HIDDEN>
> Date: Wed, 27 Nov 2019 19:50:00 +0100
> Cc: 38317 <at> debbugs.gnu.org
> 
> Thanks. In what part of the manual would you document this? I was
> thinking of either in:
> 
> 1) The "Minibuffer History" section (but it doesn't mention the actual
> HIST variable anywhere in there, though, and never mentions any specific
> minibuffer-reading function)

That section does mention the history variables, and even includes a
list of them.  So I'm not sure why you say it doesn't.

> Should I update the docstring for `read-from-minibuffer' as well? I
> would like to add two things: that the value can be buffer-local, and
> that the newly read item will be added to the history list.

That it adds to the history is worth mentioning, but the fact that it
can be buffer-local we don't normally say explicitly, because it's
expected to "just work".




Information forwarded to bug-gnu-emacs@HIDDEN:
bug#38317; Package emacs. Full text available.

Message received at 38317 <at> debbugs.gnu.org:


Received: (at 38317) by debbugs.gnu.org; 27 Nov 2019 18:50:13 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Wed Nov 27 13:50:13 2019
Received: from localhost ([127.0.0.1]:56210 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1ia2OD-0003OG-7g
	for submit <at> debbugs.gnu.org; Wed, 27 Nov 2019 13:50:13 -0500
Received: from mail-wr1-f52.google.com ([209.85.221.52]:36941)
 by debbugs.gnu.org with esmtp (Exim 4.84_2)
 (envelope-from <federicotedin@HIDDEN>) id 1ia2OB-0003O2-IY
 for 38317 <at> debbugs.gnu.org; Wed, 27 Nov 2019 13:50:11 -0500
Received: by mail-wr1-f52.google.com with SMTP id g7so7251240wrw.4
 for <38317 <at> debbugs.gnu.org>; Wed, 27 Nov 2019 10:50:11 -0800 (PST)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025;
 h=from:to:cc:subject:references:date:in-reply-to:message-id
 :user-agent:mime-version;
 bh=sO4doUxv2I9wtUrrn7zRuk+HXGelWyZeu/z81j+at2o=;
 b=ITZkgwGJ18HIZr0iQTxumo4EqOYvnt+fsoGKCRq7CqSbyY1ZcYpi0uv+OP4WpuKNXI
 tsN5H7XiLGq4L4KD4kPcerw8sh8ApotlWBuL7YxVaw99i+mP0iE80mSxULzmFj8FGMjk
 /4Q6nLe8YkyxXvPRF8rzuM1tjq6VkfpQ2Y+5DCV2s906ec7jQHKVXNeKnsARkTf52Cql
 dXoqMQJzM0cMDmrbz1sAiof8XUNg4mMGIRgGKvxlmXnHB8VkJnhDZE8o5HNWQyzAagFx
 uiLs5zf5+jY/BqaVaEVs0FbwqJB1mRherrd8BddG3ZLpFdYF2mWHDHSarUx2QPUh9VAu
 1ZEA==
X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
 d=1e100.net; s=20161025;
 h=x-gm-message-state:from:to:cc:subject:references:date:in-reply-to
 :message-id:user-agent:mime-version;
 bh=sO4doUxv2I9wtUrrn7zRuk+HXGelWyZeu/z81j+at2o=;
 b=NacgLcfoM2tiWmQZAEGPDfmE4vNttK3YLr6+iS3JdzwCcM2ZSWvIxOTFvLDrbcVz1f
 xUi/vVuwAjo/5w8j6F//dfiE8IP6uClnaLTNqN4utmlecrvjPprSvkN6wJx7Op7cAP2+
 QVSKQHFOysXQrDNnPlOHc1sptBFfUQ40l9Be36Zqfi6hgbEz+IFuwZGLwdx00NVvljEw
 Wm9ME+6NZJgQPPhLGRv0nlJ1p3QAe2LfqB3grjjcb9s9Wzc8Rm1pI8PfzuEz4Uo47z7+
 zjyF0woc6KciPdQG9Jmd9dc72frtSQJ04SwtDBKgEpcQVyLMOM8o2ElM3ADYaazQ5g9h
 CJMg==
X-Gm-Message-State: APjAAAXMEh33ox5fo64yDMopmANR1DV/5UoBbkVUknSBGXQaunq1Iy3Q
 PvcxGn69xO64xfQ2RPDKX+IdrU03aQc=
X-Google-Smtp-Source: APXvYqxfT2os3rw5KrY9yuQyzZ+42UqnE+1Iev90f7igWXB/saoTOzQ1AooH8ZRh5TnQIPDHkisVNg==
X-Received: by 2002:a5d:4445:: with SMTP id x5mr45911923wrr.341.1574880605190; 
 Wed, 27 Nov 2019 10:50:05 -0800 (PST)
Received: from lead ([2a02:8109:8ac0:2ff0:918e:a083:2c78:74e5])
 by smtp.gmail.com with ESMTPSA id w7sm19392534wru.62.2019.11.27.10.50.00
 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256);
 Wed, 27 Nov 2019 10:50:04 -0800 (PST)
From: Federico Tedin <federicotedin@HIDDEN>
To: Lars Ingebrigtsen <larsi@HIDDEN>
Subject: Re: bug#38317: Buffer-local variables don't work as history for
 read-from-minibuffer
References: <87eey0lxxm.fsf@HIDDEN> <87v9rcqbls.fsf@HIDDEN>
 <5a0c68d0-4d25-bf8d-fbe8-f106b0f92210@HIDDEN>
 <875zjareo1.fsf@HIDDEN> <874kyu72kl.fsf@HIDDEN>
 <87wobq5gs0.fsf@HIDDEN> <87o8wyl2wa.fsf@HIDDEN>
 <87k17lfscs.fsf@HIDDEN>
Date: Wed, 27 Nov 2019 19:50:00 +0100
In-Reply-To: <87k17lfscs.fsf@HIDDEN> (Lars Ingebrigtsen's message of "Wed,
 27 Nov 2019 12:53:23 +0100")
Message-ID: <87h82pw3vr.fsf@HIDDEN>
User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/26.3 (gnu/linux)
MIME-Version: 1.0
Content-Type: text/plain
X-Spam-Score: 0.0 (/)
X-Debbugs-Envelope-To: 38317
Cc: martin rudalics <rudalics@HIDDEN>, 38317 <at> debbugs.gnu.org
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.18
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
X-Spam-Score: -1.0 (-)

> I haven't tested the code, but it makes sense to me.  I do wonder
> whether there are any instances of the variables that are local to the
> minibuffer...  but I guess that's unlikely?

I agree that it would be unlikely. I am not sure what the use-case for
having a history local to the minibuffer itself would be. It makes much
more sense for the history to be global or to be determined by the
context i.e. the current buffer (like I want to do with `goto-line').

>> +** 'read-from-minibuffer' now works with buffer-local history variables
>> +The HIST argument of 'read-from-minibuffer' now works correctly with
>> +buffer-local variables. This means that different buffers can have
>> +their own separated input history list if desired.
>
> This should probably be documented in the manual, too?
>
> The patch otherwise looks good to me.

Thanks. In what part of the manual would you document this? I was
thinking of either in:

1) The "Minibuffer History" section (but it doesn't mention the actual
HIST variable anywhere in there, though, and never mentions any specific
minibuffer-reading function)

2) In "Reading Text Strings with the Minibuffer", in the entry for
`read-from-minibuffer' (right before the link to "Minibuffer
History"). Maybe if we add it there users can then infer that other
minibuffer commands with a HIST argument also accept buffer-local
values.

Should I update the docstring for `read-from-minibuffer' as well? I
would like to add two things: that the value can be buffer-local, and
that the newly read item will be added to the history list. IMO this
wasn't clear enough so I ended up calling `add-to-history' myself, which
was redundant since `read_minibuf' does that already.




Information forwarded to bug-gnu-emacs@HIDDEN:
bug#38317; Package emacs. Full text available.

Message received at 38317 <at> debbugs.gnu.org:


Received: (at 38317) by debbugs.gnu.org; 27 Nov 2019 15:28:19 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Wed Nov 27 10:28:19 2019
Received: from localhost ([127.0.0.1]:56083 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1iZzEp-00050v-9o
	for submit <at> debbugs.gnu.org; Wed, 27 Nov 2019 10:28:19 -0500
Received: from mail-wm1-f54.google.com ([209.85.128.54]:39039)
 by debbugs.gnu.org with esmtp (Exim 4.84_2)
 (envelope-from <rpluim@HIDDEN>) id 1iZzEn-00050d-No
 for 38317 <at> debbugs.gnu.org; Wed, 27 Nov 2019 10:28:18 -0500
Received: by mail-wm1-f54.google.com with SMTP id s14so1183538wmh.4
 for <38317 <at> debbugs.gnu.org>; Wed, 27 Nov 2019 07:28:17 -0800 (PST)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025;
 h=from:to:cc:subject:references:date:in-reply-to:message-id
 :mime-version; bh=A9tyrFhpgHUlmebLt1DW0m+yGn9Aieyim9gydq5R5P0=;
 b=dwX79HUR+9J42zl9o+mKzX2tquk6bEeQHbsGrIEbvHRxgkhbkm8pPhCgbth/LKVtlC
 943S/9NtnU7PlTK5wkBN82ZkejlBGQy4hyDLP9aW99bSFgIh0fJPB5O4/7UOuJdHSsC8
 VvHG8aYyrLnkrhmO6+4zy/rclUUyANMVNMlxOSZ0fS/shS2+Bf81+xZJdvpmN0Wn/xzd
 r2MN8nk6xox+h60gMlYXbAddoQ0Aj71gpOqW3JmqICcGOvY7MWa8o261GxzY3+gNDJM1
 LrPPfWuntYUMroHqyl4d9yyUrtppxIiMs9fCGBPffzNcD10P/NzMkxWQZEkNpqzN/Tqe
 UFGg==
X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
 d=1e100.net; s=20161025;
 h=x-gm-message-state:from:to:cc:subject:references:date:in-reply-to
 :message-id:mime-version;
 bh=A9tyrFhpgHUlmebLt1DW0m+yGn9Aieyim9gydq5R5P0=;
 b=C1PlQAu8w+nB4jOlTfoU+GApBLEVXMCsBv0gPp6KA5Zo2KkFZtiiEXpCgUxR4LMlDn
 ftlwmbGfRkJnuql2J4i5mnhjMZH5RsbkWczKvZ9YNJIDkaxQJ3zhJvTuh6Jr8O89f9/m
 Dm7KsDyDF+9onk/wG80aSjv7hhOZBo03RncK9BDyQHp1FMS829bkwDbevWyRSprKk2c0
 RY5LkqIcjYsegPrpLuzyBboLN6WgD29YS4XcUdiGHLctRa4VQyKZCkU29kRNiOMG500R
 QM5hwTdiGf2QUNGdQpQRDvGxm+6EOxveTv4+mQDb5JuXDwFUWWvQdA+z2imgo3bvQD1G
 1i3g==
X-Gm-Message-State: APjAAAWld2KDyE1ezhQX3oqGcL68NdAPMZMIbbTyM5LsoppHNeh1CqwC
 yqL9G1Ifs44UMCUfp0aQJLInycz3
X-Google-Smtp-Source: APXvYqw+/hIuEOAg2f2GKC2zQOCTd3ucXQjjR1NaOe8nRZyWSCjyLYe8/EGSI/J7Ej/4TsSL4JzjdA==
X-Received: by 2002:a1c:6255:: with SMTP id w82mr4841418wmb.20.1574868491245; 
 Wed, 27 Nov 2019 07:28:11 -0800 (PST)
Received: from rpluim-mac ([2a01:e34:ecfc:a860:6dee:4697:b3c4:4ce5])
 by smtp.gmail.com with ESMTPSA id k4sm7556096wmk.26.2019.11.27.07.28.10
 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256);
 Wed, 27 Nov 2019 07:28:10 -0800 (PST)
From: Robert Pluim <rpluim@HIDDEN>
To: Drew Adams <drew.adams@HIDDEN>
Subject: Re: bug#38317: Buffer-local variables don't work as history for
 read-from-minibuffer
References: <87eey0lxxm.fsf@HIDDEN> <87v9rcqbls.fsf@HIDDEN>
 <5a0c68d0-4d25-bf8d-fbe8-f106b0f92210@HIDDEN>
 <875zjareo1.fsf@HIDDEN> <874kyu72kl.fsf@HIDDEN>
 <87wobq5gs0.fsf@HIDDEN> <87o8wyl2wa.fsf@HIDDEN>
 <m2eextka7e.fsf@HIDDEN>
 <5d71afcf-61aa-4e9e-a842-abaab7ae97a3@default>
Date: Wed, 27 Nov 2019 16:28:09 +0100
In-Reply-To: <5d71afcf-61aa-4e9e-a842-abaab7ae97a3@default> (Drew Adams's
 message of "Wed, 27 Nov 2019 07:24:46 -0800 (PST)")
Message-ID: <m2o8wxibjq.fsf@HIDDEN>
MIME-Version: 1.0
Content-Type: text/plain
X-Spam-Score: 0.0 (/)
X-Debbugs-Envelope-To: 38317
Cc: Lars Ingebrigtsen <larsi@HIDDEN>, 38317 <at> debbugs.gnu.org,
 Federico Tedin <federicotedin@HIDDEN>
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.18
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
X-Spam-Score: -1.0 (-)

>>>>> On Wed, 27 Nov 2019 07:24:46 -0800 (PST), Drew Adams <drew.adams@HIDDEN> said:

    >> "for the buffer selected when the minibuffer was activated."
    Drew> A buffer isn't "selected"; it's "current".

    Drew> In Emacs jargon, windows and frames are selected;
    Drew> buffers are made current.

Sure, that works as well.

Robert




Information forwarded to bug-gnu-emacs@HIDDEN:
bug#38317; Package emacs. Full text available.

Message received at 38317 <at> debbugs.gnu.org:


Received: (at 38317) by debbugs.gnu.org; 27 Nov 2019 15:24:59 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Wed Nov 27 10:24:59 2019
Received: from localhost ([127.0.0.1]:56078 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1iZzBa-0004uI-Pa
	for submit <at> debbugs.gnu.org; Wed, 27 Nov 2019 10:24:58 -0500
Received: from userp2130.oracle.com ([156.151.31.86]:33282)
 by debbugs.gnu.org with esmtp (Exim 4.84_2)
 (envelope-from <drew.adams@HIDDEN>) id 1iZzBZ-0004tz-83
 for 38317 <at> debbugs.gnu.org; Wed, 27 Nov 2019 10:24:57 -0500
Received: from pps.filterd (userp2130.oracle.com [127.0.0.1])
 by userp2130.oracle.com (8.16.0.27/8.16.0.27) with SMTP id xARFJHVx071791;
 Wed, 27 Nov 2019 15:24:51 GMT
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=oracle.com;
 h=mime-version :
 message-id : date : from : sender : to : cc : subject : references :
 in-reply-to : content-type : content-transfer-encoding; s=corp-2019-08-05;
 bh=uCHSKbmt2Ve0+eX5ZWsUTPmu7b9o/hVS+qS51dRdC7U=;
 b=rtAimX43dzdMUbpGbiPkq9LnfAaPpCp9Fjkk+PbuA/vSMVhxSWgq+dQ8DKPzw89QOQnF
 008iBEibFfK8SKvWf1J10bg682h2OV8EMhd0cOCfQXoKeHKLqIZrUhGpPKdlSzbkQGk1
 qocBv0MZB8DVVbbwoZ8PGHPPNSFhpX+El1bprdVIoXMin3xI1yR29OzR417oy1jpF03M
 TA2ytsgBuD+HOqTbheb7cwRXen48XBi+QRwTjCcGHDi85kJ4HgO4IEIFaPCP/5vrm0Mr
 k3aO1FVYRrIqq4l5fGF6KypInsncFITi9N2mEngEN2XQqYUaUvcq4zhQNmaMQrHJ0CgC Pw== 
Received: from userp3020.oracle.com (userp3020.oracle.com [156.151.31.79])
 by userp2130.oracle.com with ESMTP id 2wev6uea09-1
 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK);
 Wed, 27 Nov 2019 15:24:51 +0000
Received: from pps.filterd (userp3020.oracle.com [127.0.0.1])
 by userp3020.oracle.com (8.16.0.27/8.16.0.27) with SMTP id xARFNDAZ158729;
 Wed, 27 Nov 2019 15:24:51 GMT
Received: from aserv0121.oracle.com (aserv0121.oracle.com [141.146.126.235])
 by userp3020.oracle.com with ESMTP id 2whrkrj2s5-1
 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK);
 Wed, 27 Nov 2019 15:24:51 +0000
Received: from abhmp0007.oracle.com (abhmp0007.oracle.com [141.146.116.13])
 by aserv0121.oracle.com (8.14.4/8.13.8) with ESMTP id xARFOlnC011390;
 Wed, 27 Nov 2019 15:24:47 GMT
MIME-Version: 1.0
Message-ID: <5d71afcf-61aa-4e9e-a842-abaab7ae97a3@default>
Date: Wed, 27 Nov 2019 07:24:46 -0800 (PST)
From: Drew Adams <drew.adams@HIDDEN>
To: Robert Pluim <rpluim@HIDDEN>, Federico Tedin <federicotedin@HIDDEN>
Subject: RE: bug#38317: Buffer-local variables don't work as history for
 read-from-minibuffer
References: <87eey0lxxm.fsf@HIDDEN> <87v9rcqbls.fsf@HIDDEN>
 <5a0c68d0-4d25-bf8d-fbe8-f106b0f92210@HIDDEN> <875zjareo1.fsf@HIDDEN>
 <874kyu72kl.fsf@HIDDEN> <87wobq5gs0.fsf@HIDDEN>
 <87o8wyl2wa.fsf@HIDDEN> <m2eextka7e.fsf@HIDDEN>
In-Reply-To: <m2eextka7e.fsf@HIDDEN>
X-Priority: 3
X-Mailer: Oracle Beehive Extensions for Outlook 2.0.1.9.1  (1003210) [OL
 16.0.4927.0 (x86)]
Content-Type: text/plain; charset=us-ascii
Content-Transfer-Encoding: quoted-printable
X-Proofpoint-Virus-Version: vendor=nai engine=6000 definitions=9454
 signatures=668685
X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 suspectscore=0
 malwarescore=0
 phishscore=0 bulkscore=0 spamscore=0 mlxscore=0 mlxlogscore=875
 adultscore=0 classifier=spam adjust=0 reason=mlx scancount=1
 engine=8.0.1-1911140001 definitions=main-1911270134
X-Proofpoint-Virus-Version: vendor=nai engine=6000 definitions=9454
 signatures=668685
X-Proofpoint-Spam-Details: rule=notspam policy=default score=0
 priorityscore=1501 malwarescore=0
 suspectscore=0 phishscore=0 bulkscore=0 spamscore=0 clxscore=1011
 lowpriorityscore=0 mlxscore=0 impostorscore=0 mlxlogscore=957 adultscore=0
 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.0.1-1911140001
 definitions=main-1911270134
X-Spam-Score: -2.3 (--)
X-Debbugs-Envelope-To: 38317
Cc: Lars Ingebrigtsen <larsi@HIDDEN>, 38317 <at> debbugs.gnu.org
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.18
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
X-Spam-Score: -3.3 (---)

> "for the buffer selected when the minibuffer was activated."

A buffer isn't "selected"; it's "current".

In Emacs jargon, windows and frames are selected;
buffers are made current.




Information forwarded to bug-gnu-emacs@HIDDEN:
bug#38317; Package emacs. Full text available.

Message received at 38317 <at> debbugs.gnu.org:


Received: (at 38317) by debbugs.gnu.org; 27 Nov 2019 11:53:34 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Wed Nov 27 06:53:34 2019
Received: from localhost ([127.0.0.1]:53521 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1iZvt0-0006zS-Jn
	for submit <at> debbugs.gnu.org; Wed, 27 Nov 2019 06:53:34 -0500
Received: from quimby.gnus.org ([95.216.78.240]:55004)
 by debbugs.gnu.org with esmtp (Exim 4.84_2)
 (envelope-from <larsi@HIDDEN>) id 1iZvsz-0006zC-Bj
 for 38317 <at> debbugs.gnu.org; Wed, 27 Nov 2019 06:53:33 -0500
Received: from cm-84.212.202.86.getinternet.no ([84.212.202.86] helo=marnie)
 by quimby.gnus.org with esmtpsa (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256)
 (Exim 4.92) (envelope-from <larsi@HIDDEN>)
 id 1iZvsq-0001De-Kj; Wed, 27 Nov 2019 12:53:27 +0100
From: Lars Ingebrigtsen <larsi@HIDDEN>
To: Federico Tedin <federicotedin@HIDDEN>
Subject: Re: bug#38317: Buffer-local variables don't work as history for
 read-from-minibuffer
References: <87eey0lxxm.fsf@HIDDEN> <87v9rcqbls.fsf@HIDDEN>
 <5a0c68d0-4d25-bf8d-fbe8-f106b0f92210@HIDDEN>
 <875zjareo1.fsf@HIDDEN> <874kyu72kl.fsf@HIDDEN>
 <87wobq5gs0.fsf@HIDDEN> <87o8wyl2wa.fsf@HIDDEN>
Date: Wed, 27 Nov 2019 12:53:23 +0100
In-Reply-To: <87o8wyl2wa.fsf@HIDDEN> (Federico Tedin's message of "Tue, 26
 Nov 2019 22:54:29 +0100")
Message-ID: <87k17lfscs.fsf@HIDDEN>
User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/27.0.50 (gnu/linux)
MIME-Version: 1.0
Content-Type: text/plain
X-Spam-Report: Spam detection software, running on the system "quimby.gnus.org",
 has NOT identified this incoming email as spam.  The original
 message has been attached to this so you can view it or label
 similar future email.  If you have any questions, see
 @@CONTACT_ADDRESS@@ for details.
 Content preview: Federico Tedin <federicotedin@HIDDEN> writes: > I've
 tested the following commands with it,
 using `read-from-minibuffer' > with a buffer-local
 HIST: > > - previous-history-element (M-p) > - next-history-element (M-n)
 > - previous-matching-history [...] 
 Content analysis details:   (-2.9 points, 5.0 required)
 pts rule name              description
 ---- ---------------------- --------------------------------------------------
 0.0 URIBL_BLOCKED          ADMINISTRATOR NOTICE: The query to URIBL was
 blocked.  See
 http://wiki.apache.org/spamassassin/DnsBlocklists#dnsbl-block
 for more information. [URIs: ingebrigtsen.no]
 -1.0 ALL_TRUSTED            Passed through trusted hosts only via SMTP
 -1.9 BAYES_00               BODY: Bayes spam probability is 0 to 1%
 [score: 0.0000]
X-Spam-Score: 0.0 (/)
X-Debbugs-Envelope-To: 38317
Cc: martin rudalics <rudalics@HIDDEN>, 38317 <at> debbugs.gnu.org
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.18
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
X-Spam-Score: -1.0 (-)

Federico Tedin <federicotedin@HIDDEN> writes:

> I've tested the following commands with it, using `read-from-minibuffer'
> with a buffer-local HIST:
>
> - previous-history-element (M-p)
> - next-history-element (M-n)
> - previous-matching-history-element (M-r)
> - next-matching-history-element (M-s)
> - isearch-forward (C-s)
> - isearch-backward (C-r)
>
> They've all worked correctly and used only the buffer's local history
> value.

I haven't tested the code, but it makes sense to me.  I do wonder
whether there are any instances of the variables that are local to the
minibuffer...  but I guess that's unlikely?

> +** 'read-from-minibuffer' now works with buffer-local history variables
> +The HIST argument of 'read-from-minibuffer' now works correctly with
> +buffer-local variables. This means that different buffers can have
> +their own separated input history list if desired.

This should probably be documented in the manual, too?

The patch otherwise looks good to me.

-- 
(domestic pets only, the antidote for overdose, milk.)
   bloggy blog: http://lars.ingebrigtsen.no




Information forwarded to bug-gnu-emacs@HIDDEN:
bug#38317; Package emacs. Full text available.

Message received at 38317 <at> debbugs.gnu.org:


Received: (at 38317) by debbugs.gnu.org; 27 Nov 2019 08:14:23 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Wed Nov 27 03:14:23 2019
Received: from localhost ([127.0.0.1]:53405 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1iZsSt-00018v-34
	for submit <at> debbugs.gnu.org; Wed, 27 Nov 2019 03:14:23 -0500
Received: from mail-wm1-f51.google.com ([209.85.128.51]:50989)
 by debbugs.gnu.org with esmtp (Exim 4.84_2)
 (envelope-from <rpluim@HIDDEN>) id 1iZsSq-00018g-Te
 for 38317 <at> debbugs.gnu.org; Wed, 27 Nov 2019 03:14:21 -0500
Received: by mail-wm1-f51.google.com with SMTP id l17so6051444wmh.0
 for <38317 <at> debbugs.gnu.org>; Wed, 27 Nov 2019 00:14:20 -0800 (PST)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025;
 h=from:to:cc:subject:references:gmane-reply-to-list:date:in-reply-to
 :message-id:mime-version;
 bh=XjRFN+T6MzLzgkCBNWWRkUiKL5MDNPsobHmpIj+LUa0=;
 b=II2Iu3ZJZuyJZIE8ShGzlFSOMCvDUn9Y8wqJDgZKQKEPhb1JOujpSAUVaQgnYj3RfD
 uws9aQVrY0hFAg6o9YK9B9fF2AMi8N/hklRGYaFZ0I5ZoJ+JWOBudC+Oe0ftTcdRt0NA
 NY5aDF1eF9C1Kl35PT4B0chFzTcQvr0JZNsRZMwSXa0Iku6VWt4xP6WTdx3b5r2+SLMV
 wk+rjdLrNHWv3M32Y8osOn6+li6/ha7cdvaZGOt1KtqIiX3Y3SVque9k+OZSxVi9OeCL
 hkHluRSxbRZqgbUEIrdMCPT/QzroQ+/yW8jiL+oajLStopQa0hZT0fqEhj9Tc82JliDz
 B1ig==
X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
 d=1e100.net; s=20161025;
 h=x-gm-message-state:from:to:cc:subject:references
 :gmane-reply-to-list:date:in-reply-to:message-id:mime-version;
 bh=XjRFN+T6MzLzgkCBNWWRkUiKL5MDNPsobHmpIj+LUa0=;
 b=pGc7vlc1IS+zOzc4vZV5MmbLn4yyVC+FFdpL9/mQKQUhM8nCN+3KBZTvjgD7StDa2N
 d7k2MVNxE/PeJgOd3ja2TRegYvDyeHCIBNMmappgeDQp/FJq2hZkukliPU/Xr4liOWH5
 kNIDEWBK8CprkaKG6zzlVzb4HYggJVEg63j8kPs8aNWcDewE8m0tsum7XwRDEL34wUJ5
 L73/9pVEgCHe3m+XMQqusLb/PX2xPfOyuIuhUYI5xISzUxvcnuN0UI2eKj0MexSiq2O6
 yjVdATjasEoGH60nSdBYozYm2UnYLNaZd6GXiUAoIs9oUx24QsMY4Ph8tieolDGUL13O
 G8aQ==
X-Gm-Message-State: APjAAAV7xVfq0wCDy57eymhmKasoNNS4mivxMTfM+PzJodHQASZvdeb8
 o+m8dXrlVHb+2OQZgt/z3i0=
X-Google-Smtp-Source: APXvYqykGuNdDEA4lZpl6PRCw+ChJ9kQFaexwm5c5rCV7/GdcdhFLVfxKaJWdhi5qbkGjH9w5eww4A==
X-Received: by 2002:a7b:cb54:: with SMTP id v20mr2912281wmj.11.1574842454828; 
 Wed, 27 Nov 2019 00:14:14 -0800 (PST)
Received: from rpluim-mac ([2a01:e34:ecfc:a860:6dee:4697:b3c4:4ce5])
 by smtp.gmail.com with ESMTPSA id x7sm17786351wrq.41.2019.11.27.00.14.13
 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256);
 Wed, 27 Nov 2019 00:14:14 -0800 (PST)
From: Robert Pluim <rpluim@HIDDEN>
To: Federico Tedin <federicotedin@HIDDEN>
Subject: Re: bug#38317: Buffer-local variables don't work as history for
 read-from-minibuffer
References: <87eey0lxxm.fsf@HIDDEN> <87v9rcqbls.fsf@HIDDEN>
 <5a0c68d0-4d25-bf8d-fbe8-f106b0f92210@HIDDEN>
 <875zjareo1.fsf@HIDDEN> <874kyu72kl.fsf@HIDDEN>
 <87wobq5gs0.fsf@HIDDEN> <87o8wyl2wa.fsf@HIDDEN>
X-Debbugs-No-Ack: yes
Gmane-Reply-To-List: yes
Date: Wed, 27 Nov 2019 09:14:13 +0100
In-Reply-To: <87o8wyl2wa.fsf@HIDDEN> (Federico Tedin's message of "Tue, 26
 Nov 2019 22:54:29 +0100")
Message-ID: <m2eextka7e.fsf@HIDDEN>
MIME-Version: 1.0
Content-Type: text/plain
X-Spam-Score: 0.0 (/)
X-Debbugs-Envelope-To: 38317
Cc: Lars Ingebrigtsen <larsi@HIDDEN>, 38317 <at> debbugs.gnu.org
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.18
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
X-Spam-Score: -1.0 (-)

>>>>> On Tue, 26 Nov 2019 22:54:29 +0100, Federico Tedin <federicotedin@HIDDEN> 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@HIDDEN>
    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




Information forwarded to bug-gnu-emacs@HIDDEN:
bug#38317; Package emacs. Full text available.

Message received at 38317 <at> debbugs.gnu.org:


Received: (at 38317) by debbugs.gnu.org; 26 Nov 2019 21:54:39 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Tue Nov 26 16:54:39 2019
Received: from localhost ([127.0.0.1]:53110 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1iZin9-00064z-AL
	for submit <at> debbugs.gnu.org; Tue, 26 Nov 2019 16:54:39 -0500
Received: from mail-wm1-f53.google.com ([209.85.128.53]:40322)
 by debbugs.gnu.org with esmtp (Exim 4.84_2)
 (envelope-from <federicotedin@HIDDEN>) id 1iZin7-00064l-Kx
 for 38317 <at> debbugs.gnu.org; Tue, 26 Nov 2019 16:54:38 -0500
Received: by mail-wm1-f53.google.com with SMTP id y5so5117725wmi.5
 for <38317 <at> debbugs.gnu.org>; Tue, 26 Nov 2019 13:54:37 -0800 (PST)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025;
 h=from:to:cc:subject:references:date:in-reply-to:message-id
 :user-agent:mime-version;
 bh=7a76mQ/nqoLCgDJAgcHFujxkYIV1Pt6qBcJR2BEomHQ=;
 b=M/nWxswGQnbaKcDe/f7ISExtNPDn5Gx+MG75n5iArGkcWp3Bh6/h189uIqXakQtIEO
 dCwBopoAXqb6Cu8WtJTy4rNV0/VD0M9TI8A/3uDiOms0X6kjOvCVU7HY2Aovk7BJMRBO
 /lsYIiAVsyiiQEiynxNFbBK9MU1FrxlPLuiLFmivqORWTbecQYG71LlQa1pcZdtMyA94
 dLBc3R0PC0D3G4r7V9lpvZLduLVRpVh/aNVfOIwEzM31MrTOvKusm7Gva3VbMhr2Duui
 7VVy2Nv7rt3zCM8Ta7QdpcizDUc6XsywarMMcMb6GlLVbts2zulPkz3bcxl0Tq7mYeYz
 Pmqw==
X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
 d=1e100.net; s=20161025;
 h=x-gm-message-state:from:to:cc:subject:references:date:in-reply-to
 :message-id:user-agent:mime-version;
 bh=7a76mQ/nqoLCgDJAgcHFujxkYIV1Pt6qBcJR2BEomHQ=;
 b=jM4ryFdGfnc96YM4wa6ijWy19EbTLlJmgk7a5EKbdHhWPMyUqGOvPwFpXCkMNsfbJ8
 BDAa0m8NO+ZYnfSlYNUBUVz+3TzSqhLuZv01GYqWbojJYAKAq3ZuH9SpdNVvG6BZzlIY
 1pDi8D3PImb69iEs777+YmbF2ekA72x9I1CnR07VbN37VHYa2jpvNiEFkxO6vBjg6jFb
 8B/CzrVUC4+QTXMk77yEKGP+RAgIPllPFsqmL7+ItguRCxa0mX2WoMrP3mZ2I354nL+q
 a+Tnr0pnzfh03Av+lZNXNDVj1Y8eZu6oUPp3v7AxgQGF/plTUN5x/rYipoTpRsNvOnv/
 haNw==
X-Gm-Message-State: APjAAAWggOeonO2XxeCAR3mDXvz1DOe/UsZPKEhhx4v2LIR4ZOGuvuQe
 zIoO90jsgYDev98jLWcs9bo=
X-Google-Smtp-Source: APXvYqy4CRa18t9Pw6WTasiwaHCU0kjFqHocJqGEXkzl3+4JuqbXq26VYS00M7wgGKi0tHn1qka3/Q==
X-Received: by 2002:a7b:c92c:: with SMTP id h12mr1084192wml.106.1574805271673; 
 Tue, 26 Nov 2019 13:54:31 -0800 (PST)
Received: from lead ([2a02:8109:8ac0:2ff0:918e:a083:2c78:74e5])
 by smtp.gmail.com with ESMTPSA id x13sm4358003wmc.19.2019.11.26.13.54.30
 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256);
 Tue, 26 Nov 2019 13:54:30 -0800 (PST)
From: Federico Tedin <federicotedin@HIDDEN>
To: 38317 <at> debbugs.gnu.org
Subject: Re: bug#38317: Buffer-local variables don't work as history for
 read-from-minibuffer
References: <87eey0lxxm.fsf@HIDDEN> <87v9rcqbls.fsf@HIDDEN>
 <5a0c68d0-4d25-bf8d-fbe8-f106b0f92210@HIDDEN>
 <875zjareo1.fsf@HIDDEN> <874kyu72kl.fsf@HIDDEN>
 <87wobq5gs0.fsf@HIDDEN>
Date: Tue, 26 Nov 2019 22:54:29 +0100
In-Reply-To: <87wobq5gs0.fsf@HIDDEN> (Federico Tedin's message of "Sun, 24
 Nov 2019 00:12:15 +0100")
Message-ID: <87o8wyl2wa.fsf@HIDDEN>
User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/26.3 (gnu/linux)
MIME-Version: 1.0
Content-Type: multipart/mixed; boundary="=-=-="
X-Spam-Score: 0.0 (/)
X-Debbugs-Envelope-To: 38317
Cc: martin rudalics <rudalics@HIDDEN>, Lars Ingebrigtsen <larsi@HIDDEN>
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.18
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
X-Spam-Score: -1.0 (-)

--=-=-=
Content-Type: text/plain

> I'm attaching a draft patch in case anyone wants to provide some
> feedback. Thanks!

I'm now attaching a final version of my patch.

I've tested the following commands with it, using `read-from-minibuffer'
with a buffer-local HIST:

- previous-history-element (M-p)
- next-history-element (M-n)
- previous-matching-history-element (M-r)
- next-matching-history-element (M-s)
- isearch-forward (C-s)
- isearch-backward (C-r)

They've all worked correctly and used only the buffer's local history
value.

Thanks!


--=-=-=
Content-Type: text/x-diff
Content-Disposition: attachment; filename=minibuffer.patch
Content-Description: patch

From 496fbc75e02e016d50d3e1a21154e4da844a1140 Mon Sep 17 00:00:00 2001
From: Federico Tedin <federicotedin@HIDDEN>
Date: Tue, 26 Nov 2019 22:39:34 +0100
Subject: [PATCH 1/1] Make HIST arg of read-from-minibuffer work with
 buffer-local vars

* lisp/simple.el (minibuffer-history-values): New function, should be
used to access the minibuffer input history variable when the
minibuffer might be active. If the variable is buffer-local, the
previous buffer's value will be used.
(goto-history-element): Use the new function to access the minibuffer
history.
(minibuffer-history-isearch-wrap): Use the new function to access the
minibuffer history.
* src/minibuf.c (read_minibuf): Switch to previous buffer temporarily
before updating history list (Bug#38317).
* etc/NEWS: Announce changes.
---
 etc/NEWS       |  6 ++++++
 lisp/simple.el | 18 +++++++++++++-----
 src/minibuf.c  | 17 +++++++++++++++--
 3 files changed, 34 insertions(+), 7 deletions(-)

diff --git a/etc/NEWS b/etc/NEWS
index d3331daf17..9dbf36ae40 100644
--- a/etc/NEWS
+++ b/etc/NEWS
@@ -518,6 +518,12 @@ Note that this key binding will not work on MS-Windows systems if
 key binding with an upper case letter - if you can type it, you can
 bind it.
 
+---
+** 'read-from-minibuffer' now works with buffer-local history variables
+The HIST argument of 'read-from-minibuffer' now works correctly with
+buffer-local variables. This means that different buffers can have
+their own separated input history list if desired.
+
 
 * Editing Changes in Emacs 27.1
 
diff --git a/lisp/simple.el b/lisp/simple.el
index 2aac557154..0b1d7b73ab 100644
--- a/lisp/simple.el
+++ b/lisp/simple.el
@@ -2041,7 +2041,7 @@ previous-matching-history-element
 	     (null minibuffer-text-before-history))
 	(setq minibuffer-text-before-history
 	      (minibuffer-contents-no-properties)))
-    (let ((history (symbol-value minibuffer-history-variable))
+    (let ((history (minibuffer-history-values))
 	  (case-fold-search
 	   (if (isearch-no-upper-case-p regexp t) ; assume isearch.el is dumped
 	       ;; On some systems, ignore case for file names.
@@ -2141,6 +2141,14 @@ minibuffer-default-add-completions
 	(append def all)
       (cons def (delete def all)))))
 
+(defun minibuffer-history-values ()
+  "Return the minibuffer input history values.
+If `minibuffer-history-variable' points to a buffer-local variable and
+the minibuffer is active, return the buffer-local value for the buffer
+selected in the window returned by `minibuffer-selected-window'."
+  (buffer-local-value minibuffer-history-variable
+                      (window-buffer (minibuffer-selected-window))))
+
 (defun goto-history-element (nabs)
   "Puts element of the minibuffer history in the minibuffer.
 The argument NABS specifies the absolute history position in
@@ -2169,8 +2177,8 @@ goto-history-element
 	(user-error (if minibuffer-default
                         "End of defaults; no next item"
                       "End of history; no default available")))
-    (if (> nabs (if (listp (symbol-value minibuffer-history-variable))
-                    (length (symbol-value minibuffer-history-variable))
+    (if (> nabs (if (listp (minibuffer-history-values))
+                    (length (minibuffer-history-values))
                   0))
 	(user-error "Beginning of history; no preceding item"))
     (unless (memq last-command '(next-history-element
@@ -2192,7 +2200,7 @@ goto-history-element
 	   (setq minibuffer-returned-to-present t)
 	   (setq minibuffer-text-before-history nil))
 	  (t (setq elt (nth (1- minibuffer-history-position)
-			    (symbol-value minibuffer-history-variable)))))
+			    (minibuffer-history-values)))))
     (insert
      (if (and (eq minibuffer-history-sexp-flag (minibuffer-depth))
 	      (not minibuffer-returned-to-present))
@@ -2445,7 +2453,7 @@ minibuffer-history-isearch-wrap
   ;; beginning/end of the history, wrap the search to the first/last
   ;; minibuffer history element.
   (if isearch-forward
-      (goto-history-element (length (symbol-value minibuffer-history-variable)))
+      (goto-history-element (length (minibuffer-history-values)))
     (goto-history-element 0))
   (setq isearch-success t)
   (goto-char (if isearch-forward (minibuffer-prompt-end) (point-max))))
diff --git a/src/minibuf.c b/src/minibuf.c
index 1e87c5044a..2fbfb31b99 100644
--- a/src/minibuf.c
+++ b/src/minibuf.c
@@ -353,7 +353,7 @@ read_minibuf (Lisp_Object map, Lisp_Object initial, Lisp_Object prompt,
 	      Lisp_Object histvar, Lisp_Object histpos, Lisp_Object defalt,
 	      bool allow_props, bool inherit_input_method)
 {
-  Lisp_Object val;
+  Lisp_Object val, previous_buffer = Fcurrent_buffer ();
   ptrdiff_t count = SPECPDL_INDEX ();
   Lisp_Object mini_frame, ambient_dir, minibuffer, input_method;
   Lisp_Object enable_multibyte;
@@ -698,7 +698,20 @@ read_minibuf (Lisp_Object map, Lisp_Object initial, Lisp_Object prompt,
 
   /* Add the value to the appropriate history list, if any.  */
   if (! (NILP (Vhistory_add_new_input) || NILP (histstring)))
-    call2 (intern ("add-to-history"), Vminibuffer_history_variable, histstring);
+    {
+      ptrdiff_t count2 = SPECPDL_INDEX ();
+
+      /* If possible, switch back to the previous buffer first, in
+	 case the history variable is buffer-local.  */
+      if (BUFFER_LIVE_P (XBUFFER (previous_buffer)))
+	{
+	  record_unwind_current_buffer ();
+	  Fset_buffer (previous_buffer);
+	}
+
+      call2 (intern ("add-to-history"), Vminibuffer_history_variable, histstring);
+      unbind_to (count2, Qnil);
+    }
 
   /* If Lisp form desired instead of string, parse it.  */
   if (expflag)
-- 
2.17.1


--=-=-=--




Information forwarded to bug-gnu-emacs@HIDDEN:
bug#38317; Package emacs. Full text available.

Message received at 38317 <at> debbugs.gnu.org:


Received: (at 38317) by debbugs.gnu.org; 23 Nov 2019 23:14:46 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Sat Nov 23 18:14:46 2019
Received: from localhost ([127.0.0.1]:57960 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1iYebz-0007TZ-Oj
	for submit <at> debbugs.gnu.org; Sat, 23 Nov 2019 18:14:46 -0500
Received: from mail-wr1-f41.google.com ([209.85.221.41]:46901)
 by debbugs.gnu.org with esmtp (Exim 4.84_2)
 (envelope-from <federicotedin@HIDDEN>) id 1iYebq-0007TD-Kl
 for 38317 <at> debbugs.gnu.org; Sat, 23 Nov 2019 18:14:39 -0500
Received: by mail-wr1-f41.google.com with SMTP id z7so9544719wrl.13
 for <38317 <at> debbugs.gnu.org>; Sat, 23 Nov 2019 15:14:34 -0800 (PST)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025;
 h=from:to:cc:subject:references:date:in-reply-to:message-id
 :user-agent:mime-version;
 bh=+xa+qOHl6vSbHtQE/NlGKdhQOOxh23wLfABzWEvNZJ0=;
 b=t80+e9rmyqeVgbgoG6NHCsyJlro+cNa0wrhiBEWAJ/jW1Y8VUklW/dGHvew7w0/X4v
 jJSN6ADxEZulfc262Bfi/XubBboLS/c8KOcZr2YAEB5EwIsyq5qXmdgwjNVfJVh03stT
 CuZmr/slcIuE3jHYuHRclQjq0wdkLeupuXrq9o+CZE0AXvodeo/Bmbhf/Ni6Sm/Yjai3
 U6S8udHmMfAmYn258cD66VGHymgtRpbfoC+dNsi6omWciuLyYLbpvYjkiPQah2Q4Hkul
 ihxcHtSOtR1Eh3WY0Yy7Bj7gGjASwt8zxPQDg61PDOKvqg6YfLNwmZF4S68NgQTjNMVp
 gauA==
X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
 d=1e100.net; s=20161025;
 h=x-gm-message-state:from:to:cc:subject:references:date:in-reply-to
 :message-id:user-agent:mime-version;
 bh=+xa+qOHl6vSbHtQE/NlGKdhQOOxh23wLfABzWEvNZJ0=;
 b=Rv+R08SMsDnMBuswpsP99Kyy246PfPLSR8FrLXnN9yRPAbcC9ND4HiVTzL8bX4NSOM
 mPN7VEwgqMF4g6BXkkeT8P0XKBtm2+7NyTz8yFOHvNZO9ClK3dF9hJv6rabmI0Syhk4R
 lkEaN10SHz42QPbsGeCH0Lnt69GeTm1/HG9itkjdSlvUuacjjAS6ucMbW2bxb9kPXHJl
 hDPJLxq+4nqImgsqosChyl84qGh/Ske9Syhs/qAn4OZI0JcAXX4fgTEN1N+uEe38LKfJ
 DEngoS8gLc0SuzYoQkgLsxI3koSBklOdP7Kx/BsZIg31NTwV1Vw0cmMkK9QQ3VpIMPcw
 QM9Q==
X-Gm-Message-State: APjAAAVpQAxiq9rzi+Jcngyzwmo1k7sN/rOYOZhT0VdSiITh0PnVgopy
 4ETAZ6O1d7UZVllkCgPYhzpcSxtNAzU=
X-Google-Smtp-Source: APXvYqzcw/EA36kHbTKo0Nk/ysetePfYGaPZ4iwDH5KZq567H5ErN14ae3fEXbZg4jnl9mG/r5CHrw==
X-Received: by 2002:a5d:6548:: with SMTP id z8mr25677729wrv.273.1574550868462; 
 Sat, 23 Nov 2019 15:14:28 -0800 (PST)
Received: from lead (ip5f5bd750.dynamic.kabel-deutschland.de. [95.91.215.80])
 by smtp.gmail.com with ESMTPSA id
 2sm3709933wrq.31.2019.11.23.15.14.26
 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256);
 Sat, 23 Nov 2019 15:14:27 -0800 (PST)
From: Federico Tedin <federicotedin@HIDDEN>
To: Lars Ingebrigtsen <larsi@HIDDEN>
Subject: Re: bug#38317: Buffer-local variables don't work as history for
 read-from-minibuffer
References: <87eey0lxxm.fsf@HIDDEN> <87v9rcqbls.fsf@HIDDEN>
 <5a0c68d0-4d25-bf8d-fbe8-f106b0f92210@HIDDEN>
 <875zjareo1.fsf@HIDDEN> <874kyu72kl.fsf@HIDDEN>
Date: Sun, 24 Nov 2019 00:12:15 +0100
In-Reply-To: <874kyu72kl.fsf@HIDDEN> (Federico Tedin's message of "Sat, 23
 Nov 2019 21:36:10 +0100")
Message-ID: <87wobq5gs0.fsf@HIDDEN>
User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/26.3 (gnu/linux)
MIME-Version: 1.0
Content-Type: multipart/mixed; boundary="=-=-="
X-Spam-Score: 0.0 (/)
X-Debbugs-Envelope-To: 38317
Cc: martin rudalics <rudalics@HIDDEN>, 38317 <at> debbugs.gnu.org
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.18
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
X-Spam-Score: -1.0 (-)

--=-=-=
Content-Type: text/plain

> So although `read_minibuf' does call `add-to-history' before returning
> (and after setting the current buffer to be the minibuffer's), my input
> wasn't added to any list (that I know of). This is strange, since
> `add-to-history' seemed to work correctly with buffer-local variables
> when I tested it separately. I would've expected the new history item to
> be added to one of the minibuffer's `test-history' local variable.
>
> So I think the first step would be to make `read_minibuf' add the new
> history item into the right place when HIST is buffer-local.

Turns out `get_minibuffer' sets the minibuffer's buffer mode to
`minibuffer-inactive-mode', which resets the minibuffer's local
variables (though not 100% sure about this). I think the history items
were being added to the minibuffer's local version of the variable, and
then being deleted by that.

I created a small patch that sets back the original buffer at the end of
`read_minibuf', so that the history item is added in the right
place. Then, I modified `goto-history-element' as Michael suggested, so
that the function reads the buffer-local version of the variable, but
not the minibuffer's (and updated `minibuffer-history-isearch-wrap' just
in case as well). With this, M-p and M-n works again.

I'm attaching a draft patch in case anyone wants to provide some
feedback. Thanks!

- Fede


--=-=-=
Content-Type: text/x-diff
Content-Disposition: attachment; filename=minibuf.diff
Content-Description: patch

diff --git a/lisp/simple.el b/lisp/simple.el
index c61ccd511c..e5f9e9e785 100644
--- a/lisp/simple.el
+++ b/lisp/simple.el
@@ -2028,7 +2028,7 @@ previous-matching-history-element
 	     (null minibuffer-text-before-history))
 	(setq minibuffer-text-before-history
 	      (minibuffer-contents-no-properties)))
-    (let ((history (symbol-value minibuffer-history-variable))
+    (let ((history (minibuffer-history-values))
 	  (case-fold-search
 	   (if (isearch-no-upper-case-p regexp t) ; assume isearch.el is dumped
 	       ;; On some systems, ignore case for file names.
@@ -2128,6 +2128,14 @@ minibuffer-default-add-completions
 	(append def all)
       (cons def (delete def all)))))
 
+(defun minibuffer-history-values ()
+  "Return the minibuffer input history values.
+If `minibuffer-history-variable' points to a buffer-local variable and
+the minibuffer is active, return the buffer-local value for the buffer
+selected in the window returned by `minibuffer-selected-window'."
+  (buffer-local-value minibuffer-history-variable
+                      (window-buffer (minibuffer-selected-window))))
+
 (defun goto-history-element (nabs)
   "Puts element of the minibuffer history in the minibuffer.
 The argument NABS specifies the absolute history position in
@@ -2156,8 +2164,8 @@ goto-history-element
 	(user-error (if minibuffer-default
                         "End of defaults; no next item"
                       "End of history; no default available")))
-    (if (> nabs (if (listp (symbol-value minibuffer-history-variable))
-                    (length (symbol-value minibuffer-history-variable))
+    (if (> nabs (if (listp (minibuffer-history-values))
+                    (length (minibuffer-history-values))
                   0))
 	(user-error "Beginning of history; no preceding item"))
     (unless (memq last-command '(next-history-element
@@ -2179,7 +2187,7 @@ goto-history-element
 	   (setq minibuffer-returned-to-present t)
 	   (setq minibuffer-text-before-history nil))
 	  (t (setq elt (nth (1- minibuffer-history-position)
-			    (symbol-value minibuffer-history-variable)))))
+			    (minibuffer-history-values)))))
     (insert
      (if (and (eq minibuffer-history-sexp-flag (minibuffer-depth))
 	      (not minibuffer-returned-to-present))
@@ -2432,7 +2440,7 @@ minibuffer-history-isearch-wrap
   ;; beginning/end of the history, wrap the search to the first/last
   ;; minibuffer history element.
   (if isearch-forward
-      (goto-history-element (length (symbol-value minibuffer-history-variable)))
+      (goto-history-element (length (minibuffer-history-values)))
     (goto-history-element 0))
   (setq isearch-success t)
   (goto-char (if isearch-forward (minibuffer-prompt-end) (point-max))))
diff --git a/src/minibuf.c b/src/minibuf.c
index 1e87c5044a..c4d2fae9b4 100644
--- a/src/minibuf.c
+++ b/src/minibuf.c
@@ -353,7 +353,7 @@ read_minibuf (Lisp_Object map, Lisp_Object initial, Lisp_Object prompt,
 	      Lisp_Object histvar, Lisp_Object histpos, Lisp_Object defalt,
 	      bool allow_props, bool inherit_input_method)
 {
-  Lisp_Object val;
+  Lisp_Object val, previous_buffer = Fcurrent_buffer ();
   ptrdiff_t count = SPECPDL_INDEX ();
   Lisp_Object mini_frame, ambient_dir, minibuffer, input_method;
   Lisp_Object enable_multibyte;
@@ -696,7 +696,12 @@ read_minibuf (Lisp_Object map, Lisp_Object initial, Lisp_Object prompt,
   else
     histstring = Qnil;
 
-  /* Add the value to the appropriate history list, if any.  */
+  /* Add the value to the appropriate history list, if any.  If
+   possible, switch back to the previous buffer first, in case the
+   history variable was buffer-local.  */
+  if (BUFFER_LIVE_P (XBUFFER (previous_buffer)))
+    Fset_buffer (previous_buffer);
+
   if (! (NILP (Vhistory_add_new_input) || NILP (histstring)))
     call2 (intern ("add-to-history"), Vminibuffer_history_variable, histstring);
 

--=-=-=--




Information forwarded to bug-gnu-emacs@HIDDEN:
bug#38317; Package emacs. Full text available.

Message received at 38317 <at> debbugs.gnu.org:


Received: (at 38317) by debbugs.gnu.org; 23 Nov 2019 20:38:48 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Sat Nov 23 15:38:48 2019
Received: from localhost ([127.0.0.1]:57885 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1iYcB1-0003fa-CH
	for submit <at> debbugs.gnu.org; Sat, 23 Nov 2019 15:38:45 -0500
Received: from mail-wr1-f52.google.com ([209.85.221.52]:41520)
 by debbugs.gnu.org with esmtp (Exim 4.84_2)
 (envelope-from <federicotedin@HIDDEN>) id 1iYcAn-0003fB-Jc
 for 38317 <at> debbugs.gnu.org; Sat, 23 Nov 2019 15:38:30 -0500
Received: by mail-wr1-f52.google.com with SMTP id b18so12717320wrj.8
 for <38317 <at> debbugs.gnu.org>; Sat, 23 Nov 2019 12:38:29 -0800 (PST)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025;
 h=from:to:cc:subject:references:date:in-reply-to:message-id
 :user-agent:mime-version;
 bh=uPx/15iEYOc25VeTM9yuSxlZA2O//WU/NFf/sHN/Yas=;
 b=rZPphuBYTLMSE06LDbkjKbs9s1LFMrM8+AaPZ/EHxpmY7kNWZTmfh+AXisEWR4HlLy
 n/1gUn7QfN2qwq1N9vyr1TR+uNkbtRNkx6FfdZ6MDqPosT/uuvCyAy7Lfcr9CiuvyI4F
 ARBP00bT4VigzHr8yq614brFXXCxCeg+65FpqpfyilluOfR98BWsTaZ6P6DIeapmpUlT
 3IFBB/thq/FN9nsRoMKvcicqL6f5VbvwUNmRJkWliNBIMqENfGfBnU+yGgX8WnUeUhkP
 FI8RFl//eUIWQsgKO8+X2ak+1f+ByzfvEM38ISUmYBATvYpy60IqJ+tfIgAAx0xsNL3Y
 AGlw==
X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
 d=1e100.net; s=20161025;
 h=x-gm-message-state:from:to:cc:subject:references:date:in-reply-to
 :message-id:user-agent:mime-version;
 bh=uPx/15iEYOc25VeTM9yuSxlZA2O//WU/NFf/sHN/Yas=;
 b=RB4V4GDp1tt400LOStGUMirMaM3LTUh5DRbOPZZLEKiTtRHaTQmTNe0wz3PJWorqSL
 02HMd2RMOKU9VA2OgHpoHhYlJQVB3/Vvs5l7rICUV2+5nlvNagLPEd1sS9UZvURollNU
 eorKg+xX1UAaYiYjIjeNXoGyRaiiR7iW9Y5Hopg19GhZV/J6uIvYT5hQL465lpniRPcL
 ZYxRF68N1dHnig1YIHaiEIMiYSWOCxO81GhqykxG/uneS7qOrGIzt2CX/H7/smndAvb3
 41UiQ82XZyXMIP7LGiYGxiL8mbkY0eiIQBue7G2uBsZvsNLB3tTh6HRJfLMvITJ8+WcA
 lULw==
X-Gm-Message-State: APjAAAW2UK+o1AkJLYs/sM9xib2PYSx2T+GJGL0bzal3Gu3OGL0ITm6z
 ZrI3UFeZ6/Ae0Y8Y8jMtIIs4czCiVnU=
X-Google-Smtp-Source: APXvYqxWInvHOAHKDYamsE3pAZiNKYXDmalyoxX55c3JFzPF0Vuwxde37js6nK2P5Ay24ZRouGjNlQ==
X-Received: by 2002:a5d:5050:: with SMTP id h16mr25551756wrt.380.1574541503362; 
 Sat, 23 Nov 2019 12:38:23 -0800 (PST)
Received: from lead (ip5f5bd750.dynamic.kabel-deutschland.de. [95.91.215.80])
 by smtp.gmail.com with ESMTPSA id
 16sm5590614wmf.0.2019.11.23.12.38.21
 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256);
 Sat, 23 Nov 2019 12:38:22 -0800 (PST)
From: Federico Tedin <federicotedin@HIDDEN>
To: Lars Ingebrigtsen <larsi@HIDDEN>
Subject: Re: bug#38317: Buffer-local variables don't work as history for
 read-from-minibuffer
References: <87eey0lxxm.fsf@HIDDEN> <87v9rcqbls.fsf@HIDDEN>
 <5a0c68d0-4d25-bf8d-fbe8-f106b0f92210@HIDDEN>
 <875zjareo1.fsf@HIDDEN>
Date: Sat, 23 Nov 2019 21:36:10 +0100
In-Reply-To: <875zjareo1.fsf@HIDDEN> (Lars Ingebrigtsen's message of "Sat,
 23 Nov 2019 12:54:38 +0100")
Message-ID: <874kyu72kl.fsf@HIDDEN>
User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/26.3 (gnu/linux)
MIME-Version: 1.0
Content-Type: text/plain
X-Spam-Score: 0.0 (/)
X-Debbugs-Envelope-To: 38317
Cc: martin rudalics <rudalics@HIDDEN>, 38317 <at> debbugs.gnu.org
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.18
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
X-Spam-Score: -1.0 (-)

I've been looking into the problem, what I found so far is:

`read-from-minibuffer' works normally if HIST is not buffer-local.

If HIST is buffer-local, then the history variable doesn't seem to be
updated correctly after returning (so using M-p and M-n doesn't do
anything).

My test was:

(setq test-history nil)
(make-variable-buffer-local 'test-history)

(read-from-minibuffer "" nil nil nil 'test-history)

After running that and inputting "hello", I checked:

(buffer-local-value 'test-history (current-buffer))            ;; -> nil
(buffer-local-value 'test-history (get-buffer " *Minibuf-0*")) ;; -> nil
(buffer-local-value 'test-history (get-buffer " *Minibuf-1*")) ;; -> nil

So although `read_minibuf' does call `add-to-history' before returning
(and after setting the current buffer to be the minibuffer's), my input
wasn't added to any list (that I know of). This is strange, since
`add-to-history' seemed to work correctly with buffer-local variables
when I tested it separately. I would've expected the new history item to
be added to one of the minibuffer's `test-history' local variable.

So I think the first step would be to make `read_minibuf' add the new
history item into the right place when HIST is buffer-local.




Information forwarded to bug-gnu-emacs@HIDDEN:
bug#38317; Package emacs. Full text available.

Message received at 38317 <at> debbugs.gnu.org:


Received: (at 38317) by debbugs.gnu.org; 23 Nov 2019 11:54:58 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Sat Nov 23 06:54:58 2019
Received: from localhost ([127.0.0.1]:55853 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1iYU06-0002qv-Pw
	for submit <at> debbugs.gnu.org; Sat, 23 Nov 2019 06:54:57 -0500
Received: from quimby.gnus.org ([95.216.78.240]:34852)
 by debbugs.gnu.org with esmtp (Exim 4.84_2)
 (envelope-from <larsi@HIDDEN>) id 1iYU00-0002qd-3W
 for 38317 <at> debbugs.gnu.org; Sat, 23 Nov 2019 06:54:51 -0500
Received: from cm-84.212.202.86.getinternet.no ([84.212.202.86] helo=marnie)
 by quimby.gnus.org with esmtpsa (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256)
 (Exim 4.92) (envelope-from <larsi@HIDDEN>)
 id 1iYTzr-0004wM-Bp; Sat, 23 Nov 2019 12:54:41 +0100
From: Lars Ingebrigtsen <larsi@HIDDEN>
To: martin rudalics <rudalics@HIDDEN>
Subject: Re: bug#38317: Buffer-local variables don't work as history for
 read-from-minibuffer
References: <87eey0lxxm.fsf@HIDDEN> <87v9rcqbls.fsf@HIDDEN>
 <5a0c68d0-4d25-bf8d-fbe8-f106b0f92210@HIDDEN>
Date: Sat, 23 Nov 2019 12:54:38 +0100
In-Reply-To: <5a0c68d0-4d25-bf8d-fbe8-f106b0f92210@HIDDEN> (martin rudalics's
 message of "Fri, 22 Nov 2019 17:24:22 +0100")
Message-ID: <875zjareo1.fsf@HIDDEN>
User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/27.0.50 (gnu/linux)
MIME-Version: 1.0
Content-Type: text/plain
X-Spam-Report: Spam detection software, running on the system "quimby.gnus.org",
 has NOT identified this incoming email as spam.  The original
 message has been attached to this so you can view it or label
 similar future email.  If you have any questions, see
 @@CONTACT_ADDRESS@@ for details.
 Content preview:  martin rudalics <rudalics@HIDDEN> writes: >> There doesn't
 seem to be any way to tell read_minibuf what buffer it >> should be looking
 at to get at the buffer-local value? > > The one from the buffer of
 'minibuffer-selected-window'?
 Content analysis details:   (-2.9 points, 5.0 required)
 pts rule name              description
 ---- ---------------------- --------------------------------------------------
 -1.0 ALL_TRUSTED            Passed through trusted hosts only via SMTP
 0.0 URIBL_BLOCKED          ADMINISTRATOR NOTICE: The query to URIBL was
 blocked.  See
 http://wiki.apache.org/spamassassin/DnsBlocklists#dnsbl-block
 for more information. [URIs: gmx.at]
 -1.9 BAYES_00               BODY: Bayes spam probability is 0 to 1%
 [score: 0.0000]
X-Spam-Score: 0.0 (/)
X-Debbugs-Envelope-To: 38317
Cc: 38317 <at> debbugs.gnu.org, Federico Tedin <federicotedin@HIDDEN>
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.18
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
X-Spam-Score: -1.0 (-)

martin rudalics <rudalics@HIDDEN> writes:

>> There doesn't seem to be any way to tell read_minibuf what buffer it
>> should be looking at to get at the buffer-local value?
>
> The one from the buffer of 'minibuffer-selected-window'?

Unconditionally looking at that buffer wouldn't work, I think?  Because
you may genuinely have a buffer-local version of the variable in the
minibuffer?  Or is that unlikely?

I guess that's quite unlikely.

-- 
(domestic pets only, the antidote for overdose, milk.)
   bloggy blog: http://lars.ingebrigtsen.no




Information forwarded to bug-gnu-emacs@HIDDEN:
bug#38317; Package emacs. Full text available.

Message received at 38317 <at> debbugs.gnu.org:


Received: (at 38317) by debbugs.gnu.org; 22 Nov 2019 16:24:36 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Fri Nov 22 11:24:36 2019
Received: from localhost ([127.0.0.1]:55406 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1iYBjY-0005cS-E1
	for submit <at> debbugs.gnu.org; Fri, 22 Nov 2019 11:24:36 -0500
Received: from mout.gmx.net ([212.227.15.15]:33461)
 by debbugs.gnu.org with esmtp (Exim 4.84_2)
 (envelope-from <rudalics@HIDDEN>) id 1iYBjT-0005cC-Es
 for 38317 <at> debbugs.gnu.org; Fri, 22 Nov 2019 11:24:35 -0500
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=gmx.net;
 s=badeba3b8450; t=1574439864;
 bh=nQWE/hnF6VMG+YCqGt5H+CRl2vcW73pkXxgykXDf9Zk=;
 h=X-UI-Sender-Class:Subject:To:Cc:References:From:Date:In-Reply-To;
 b=BBfEG2V+nfjVgsF2NUIkeVG5Nz2yzjGJriUf6FbtZlREEcuWnxm1akA07do32PcO5
 dvM4ng88yJ41gnqyYOcT9+29sQ3h+BrM5UDPB1hGDt3EsKLZF+nzSEMASSnsQhrhzh
 Yke/u/hgSIzIgAPSilB5A25g0FyvkGSiLqh1AST8=
X-UI-Sender-Class: 01bb95c1-4bf8-414a-932a-4f6e2808ef9c
Received: from [192.168.1.100] ([212.95.5.211]) by mail.gmx.com (mrgmx004
 [212.227.17.190]) with ESMTPSA (Nemesis) id 1MsHns-1hfw9V3s4I-00tjXe; Fri, 22
 Nov 2019 17:24:24 +0100
Subject: Re: bug#38317: Buffer-local variables don't work as history for
 read-from-minibuffer
To: Lars Ingebrigtsen <larsi@HIDDEN>,
 Federico Tedin <federicotedin@HIDDEN>
References: <87eey0lxxm.fsf@HIDDEN> <87v9rcqbls.fsf@HIDDEN>
From: martin rudalics <rudalics@HIDDEN>
Message-ID: <5a0c68d0-4d25-bf8d-fbe8-f106b0f92210@HIDDEN>
Date: Fri, 22 Nov 2019 17:24:22 +0100
MIME-Version: 1.0
In-Reply-To: <87v9rcqbls.fsf@HIDDEN>
Content-Type: text/plain; charset=utf-8; format=flowed
Content-Language: de-AT
Content-Transfer-Encoding: 7bit
X-Provags-ID: V03:K1:6V7nleqySQNKHGI67ANXj1Sp1y6hsw5dLJdCGCFScG1CzCMu07y
 wnJevsUY/1qk9QgqkApAv0IBNVlGZIqzMF77MK/8ioVvFX2sLZuZmE6TXRBwGt1jEjYcEC0
 vQzVn8BfEV1LmXDaYqqEd9sE+pse2bbCa22nC/31LWatXjEATZ6KGQI85kFPN1Fw3YjMk93
 Kf9aowEdRyfpP4hWR0nyQ==
X-Spam-Flag: NO
X-UI-Out-Filterresults: notjunk:1;V03:K0:DXj9guLUinc=:MaSyse3iu1cZHOlp3RIAEa
 1r/2Xb8+EZzwk23V0bBiN+7gbD87UNEu980qDpc7xzsHnfETMB7OsypDLfgThCqSOJ0HLCz5F
 1m/P4cdcCD9a9Ex9UJzQ1QZ95XiH/aFkM26W8G4OuND4PByzOG83eWDW1d0Iy8xd1JEJfRUON
 KKzrmm2iTTIYKJFJzIz6bcX8y9gkeLind8oZznvmCQsi7IDtutQmr2kB14sLg3pnGRnnGYSRc
 xyAR07pdAGsOU4EprK0zbcaqiEkB1E2YdYKftBHMBrfhBy9/paHA95r3dtsmLfCvolJUevgxH
 B0FgspTDaUjG9PLKIFj4I5ERJ+2Mmoki77gD0Iw1DqPRXp1jYohCDWpgIWuorxi2gVHUR4HBU
 md+X2O0BnC2Yul7+o1qTnCeNjzGExk1yHVYafColKpUOj/YrbKVa6ISWPoVe8JoPVHp9lNlmK
 zeolXYQ+k6VwOn5K8galPMCYWDty3Aq8w9IKics/7KmkVCnKqojAOkbUW9xJ4GZeeUCAj1HCC
 6KBll4/Y8+Uta9aj0oPJwWzt8WSvM93HAckMC/4olTNeXooDxV9/tQbNykS6nTp1kUa3K0GzF
 iu3iZHtlS603mwEqE6hNusNq3ZEPZ+TpUz2y1q2SYPeByjq9kvuZXts1zzl2/953cjh0K+bAM
 6DvEW/CLWN9QGlMv53R6QCiC5pmZPJIVOC+MT3y8e44Xi8LfFdsJIW/Kgk1Hobsp9n3J/dtOK
 itn7Zr5SQpsFGgNOd+qUdifEtPtmfaZDxKcNMEQFrwgHhzuunpxSSwjNdb8ZEzcCqg8t91sjW
 2zmExYtPqFhicFuYL76FkIRtXVjqcOtFWweI0R0z6KxDTVqQNvcejKfzB1+4WrxE7tDPUNpzP
 3lvi2nXKuU4GcVRJ0vbjxLBXhrNFmrtEz38O7QrmmRw14RgIb8IbGtxoTX+E/MDVzu/YkYKV4
 0x9ukD0Kgj6PGUDqlJAVX9UUF3c8FQ3bKlkEZBvQpBv81qjzh/L+EOE0YC3A9VqoFwlV1YtUE
 +tE4LYZu7C+L0HCyrHCTTvz3ufLPeDLDscFuHOG/kj/c7khZ0rNBPsvOBz7jhHiEhECeT6Dks
 ULgKGeSDqCkBlKhCw5XRvKJeNLBOeZo/hdl2g5M26QeMcvVR7Nvo7Rc1BCPTFL5OjHin0MoK0
 1t3m+GAe2rMVslCGUQdZJ9JK/YxNWKRt0bOLRkGBb65S7jorYIydgD0Ptk9UgOtsw133fRets
 xCcfELcFyW4o35m4QjSARucLOUzuKFhQnUGokRyAk4+BD2xdG2O1KMYbk9Xo=
X-Spam-Score: 0.0 (/)
X-Debbugs-Envelope-To: 38317
Cc: 38317 <at> debbugs.gnu.org
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.18
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
X-Spam-Score: -1.0 (-)

 > There doesn't seem to be any way to tell read_minibuf what buffer it
 > should be looking at to get at the buffer-local value?

The one from the buffer of 'minibuffer-selected-window'?

martin




Information forwarded to bug-gnu-emacs@HIDDEN:
bug#38317; Package emacs. Full text available.

Message received at 38317 <at> debbugs.gnu.org:


Received: (at 38317) by debbugs.gnu.org; 22 Nov 2019 15:24:04 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Fri Nov 22 10:24:04 2019
Received: from localhost ([127.0.0.1]:55374 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1iYAmy-00048E-AG
	for submit <at> debbugs.gnu.org; Fri, 22 Nov 2019 10:24:04 -0500
Received: from mout.web.de ([212.227.15.3]:46965)
 by debbugs.gnu.org with esmtp (Exim 4.84_2)
 (envelope-from <michael_heerdegen@HIDDEN>) id 1iYAmv-00047i-7L
 for 38317 <at> debbugs.gnu.org; Fri, 22 Nov 2019 10:24:01 -0500
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=web.de;
 s=dbaedf251592; t=1574436233;
 bh=Own0u7hhSEOlW7CbgaN/SBecfMG0khD1KY6I/zne1QY=;
 h=X-UI-Sender-Class:From:To:Cc:Subject:References:Date:In-Reply-To;
 b=qXLkeZjjRsB18kzmx+g5acNahQ4RBSfL/SPA/MTGlTL1XtPCrHuzVJEtlUp4jwKqi
 ZpO3D/iVDf7Z01Vv5Xp0a9Dl6K8fMKixVZbMCCjtTcD653mU7SbarndTSAaJlgPe/6
 y+8lcWsTLcan1Nb16kRT5L/ZN2XnNKfWk1t/7cb8=
X-UI-Sender-Class: c548c8c5-30a9-4db5-a2e7-cb6cb037b8f9
Received: from drachen.dragon ([94.218.222.9]) by smtp.web.de (mrweb003
 [213.165.67.108]) with ESMTPSA (Nemesis) id 0MIeTI-1iaMdt0ZIW-002E8z; Fri, 22
 Nov 2019 16:23:53 +0100
From: Michael Heerdegen <michael_heerdegen@HIDDEN>
To: Lars Ingebrigtsen <larsi@HIDDEN>
Subject: Re: bug#38317: Buffer-local variables don't work as history for
 read-from-minibuffer
References: <87eey0lxxm.fsf@HIDDEN> <87v9rcqbls.fsf@HIDDEN>
Date: Fri, 22 Nov 2019 16:23:49 +0100
In-Reply-To: <87v9rcqbls.fsf@HIDDEN> (Lars Ingebrigtsen's message of "Fri,
 22 Nov 2019 14:33:51 +0100")
Message-ID: <87pnhkory2.fsf@HIDDEN>
User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/27.0.50 (gnu/linux)
MIME-Version: 1.0
Content-Type: text/plain
X-Provags-ID: V03:K1:wt2Fgph5udkKuTfa8DwtWuerR1C4MnIdWMgHD53KPhicSw8xYh4
 kX6wKamcqpUicki9luc7HvV74FrxESrnQD5q8divhh3sQ0PB9HPvsdxSCYNzwNYqfQRxsEE
 rR7o22TeJDZO8w0mhhLGmTZiqBOqknfVnvMehtxaNkRCs7oiKBoraC0ajQW56vNSFEsC7cG
 0EMyA2T2RkDRjBxkGy4dg==
X-Spam-Flag: NO
X-UI-Out-Filterresults: notjunk:1;V03:K0:EV6/mMBoDp0=:ZraM1/EblEjP3FbcKP8jpz
 ywp3iTsNp8Gg2tZfYCDDccYV6Me9e/2LYM0qTrFhNnditq8K9QFq2iLWzndi8qI8JCtIMqQfS
 qR7VF2iW06JTq/qRyfblOlD7HX+BRhO16hTv9qOcCAanPQ+N5H9kFgkxUtukmB4uYDU7RfVN5
 t6nh0LMj3iJikB7M5wKCEkZT4LUVtU48pCcIxBQlwdCNiSjl6Fw0M6BoDA2lXvcGj/6PV9UxL
 5lN5EyG5CTdbYHKaqxCTWqiaYrLJJvpCeabAD6N8AgxO+gg22Dgkoo2YQLXgFfsAbYwO4w44a
 wblzGkT3NI6V0d3Pbf8uc7fOXRZzNphwjuCYXspLiiHmpI+X+8S0I8B2BVJSGFaWbHjxuXH6a
 LJV4JTaYlg7iKT19/M1CqszelGtH96dmb+ouGN9EeySlhHd0NdSJp2vPqb+q3qMoobFnyW6J/
 Yhrt1Hlc2fcVWQMtZ9wlhgY/YttLKXTRvcg89BD+N9EnQi7AG1FUt2WOScP3kOvViHQ/hH/rB
 g3Of/jWkPbdndMIREINvXYamtBz9rZxI5KNF/eScBDqs04M02baPyEptQG0EaU0B53D6OK13A
 Vf7as51iQX8JZj/vgSrh8BktrWAJWFhFTZQaya3hrzkX6cCUOfkT1s/B1nJUtbBdwTIwEFy92
 qjApcBE8xSsQvbl7SytTRSNrJP58BesYix3gOQK0U3b3WrRZ4G2kRMLecZUnvb12OFJt9EpSN
 +KppKkaVNMoS+JAPFrMECwM9R+Ex+FOajYMJi9rDg3H2h65kfmRCOFF2DtGiv9KKajWmsvtET
 wmNRX5jdV5ljK0su3iJuGb5XSuWxWRiVtU1oBJGw0bA9xWDUeDeuZQ4fgPpaI9NMk3kLziU73
 xE7FYclsNM1yGHBBV1TN/N6mxUOagGVHYF4zG6+sqjhPXUfAtZG6ssf8RgULGlhiDe2VKY8De
 YAO+hEprvZVhd0kYqFF61z3CT00jVU5srB1W4oHW1WLtvIR5MpGiZhSX3vTvfJqYQOi8ElG5d
 Nljb2KLBHdJft/nR9gMzrHqMJqhC7//vcfbR/qbqGEbQRZ5dtnAYOEiZ7nFM1pksB9ERFimET
 yL4oqsOA8BxAjw0Ft5vqWc9GRgqayDaEesn3vnPw6dwcMQnEF+8YKj8XrGJinWG5Ti4uPjNEj
 Uba284qEh16aeAuYEQeueUtW6uJ0vl5RAuBLF0rDuBUg5RyvfMkcWivDFeGGHjCSpBWJ3WAi+
 EqkYAPohvlQFR+u9kdDuLdmpnWx+E/cuBKPBhdjfVsWT5qWosNdNgDEtghEQ=
X-Spam-Score: 0.0 (/)
X-Debbugs-Envelope-To: 38317
Cc: 38317 <at> debbugs.gnu.org, Federico Tedin <federicotedin@HIDDEN>
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.18
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
X-Spam-Score: -1.0 (-)

Lars Ingebrigtsen <larsi@HIDDEN> writes:

> Looking at the code in read_minibuf, it does seem to access the
> buffer-local value of the HIST variable, but my guess is that the buffer
> it's looking at is the minibuffer?  And the variable isn't buffer-local
> there.

The problem is M-p: this command is called with the minibuffer current.
The helper `goto-history-element' calls (symbol-value
minibuffer-history-variable) and that returns the binding of the
variable in the minibuffer.  Adding to the buffer local history already
works as expected OTOH, so the behavior is inconsistent.

Dunno if there are more inconsistencies to expect when trying to fix
M-p.  My personal point of view is that when we can make it work without
risking breakage of anything else it would be nice to fix this.

Michael.




Information forwarded to bug-gnu-emacs@HIDDEN:
bug#38317; Package emacs. Full text available.

Message received at 38317 <at> debbugs.gnu.org:


Received: (at 38317) by debbugs.gnu.org; 22 Nov 2019 13:34:11 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Fri Nov 22 08:34:11 2019
Received: from localhost ([127.0.0.1]:53954 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1iY94c-0005mx-Ma
	for submit <at> debbugs.gnu.org; Fri, 22 Nov 2019 08:34:11 -0500
Received: from quimby.gnus.org ([95.216.78.240]:49098)
 by debbugs.gnu.org with esmtp (Exim 4.84_2)
 (envelope-from <larsi@HIDDEN>) id 1iY94T-0005mI-DX
 for 38317 <at> debbugs.gnu.org; Fri, 22 Nov 2019 08:34:02 -0500
Received: from cm-84.212.202.86.getinternet.no ([84.212.202.86] helo=marnie)
 by quimby.gnus.org with esmtpsa (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256)
 (Exim 4.92) (envelope-from <larsi@HIDDEN>)
 id 1iY94J-0003Rg-S1; Fri, 22 Nov 2019 14:33:54 +0100
From: Lars Ingebrigtsen <larsi@HIDDEN>
To: Federico Tedin <federicotedin@HIDDEN>
Subject: Re: bug#38317: Buffer-local variables don't work as history for
 read-from-minibuffer
References: <87eey0lxxm.fsf@HIDDEN>
Date: Fri, 22 Nov 2019 14:33:51 +0100
In-Reply-To: <87eey0lxxm.fsf@HIDDEN> (Federico Tedin's message of "Thu, 21
 Nov 2019 22:30:29 +0100")
Message-ID: <87v9rcqbls.fsf@HIDDEN>
User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/27.0.50 (gnu/linux)
MIME-Version: 1.0
Content-Type: text/plain
X-Spam-Report: Spam detection software, running on the system "quimby.gnus.org",
 has NOT identified this incoming email as spam.  The original
 message has been attached to this so you can view it or label
 similar future email.  If you have any questions, see
 @@CONTACT_ADDRESS@@ for details.
 Content preview:  Federico Tedin <federicotedin@HIDDEN> writes: > In this
 case, the variable `local-hist' will end up containing all the > inputted
 values (per buffer), but trying to use M-p or M-n to step > through the input
 history after invoking `my-command' wi [...] 
 Content analysis details:   (-2.9 points, 5.0 required)
 pts rule name              description
 ---- ---------------------- --------------------------------------------------
 0.0 URIBL_BLOCKED          ADMINISTRATOR NOTICE: The query to URIBL was
 blocked.  See
 http://wiki.apache.org/spamassassin/DnsBlocklists#dnsbl-block
 for more information. [URIs: ingebrigtsen.no]
 -1.0 ALL_TRUSTED            Passed through trusted hosts only via SMTP
 -1.9 BAYES_00               BODY: Bayes spam probability is 0 to 1%
 [score: 0.0000]
X-Spam-Score: 0.0 (/)
X-Debbugs-Envelope-To: 38317
Cc: 38317 <at> debbugs.gnu.org
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.18
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
X-Spam-Score: -1.0 (-)

Federico Tedin <federicotedin@HIDDEN> writes:

> In this case, the variable `local-hist' will end up containing all the
> inputted values (per buffer), but trying to use M-p or M-n to step
> through the input history after invoking `my-command' will not work ("no
> preceding item"). So to summarize, `read-from-minibuffer' doesn't seem
> to work correctly when HIST is buffer-local.

Looking at the code in read_minibuf, it does seem to access the
buffer-local value of the HIST variable, but my guess is that the buffer
it's looking at is the minibuffer?  And the variable isn't buffer-local
there.

There doesn't seem to be any way to tell read_minibuf what buffer it
should be looking at to get at the buffer-local value?

-- 
(domestic pets only, the antidote for overdose, milk.)
   bloggy blog: http://lars.ingebrigtsen.no




Information forwarded to bug-gnu-emacs@HIDDEN:
bug#38317; Package emacs. Full text available.

Message received at submit <at> debbugs.gnu.org:


Received: (at submit) by debbugs.gnu.org; 21 Nov 2019 21:30:40 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Thu Nov 21 16:30:40 2019
Received: from localhost ([127.0.0.1]:53427 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1iXu2B-0003Mz-4X
	for submit <at> debbugs.gnu.org; Thu, 21 Nov 2019 16:30:40 -0500
Received: from lists.gnu.org ([209.51.188.17]:45444)
 by debbugs.gnu.org with esmtp (Exim 4.84_2)
 (envelope-from <federicotedin@HIDDEN>) id 1iXu29-0003Mr-0E
 for submit <at> debbugs.gnu.org; Thu, 21 Nov 2019 16:30:37 -0500
Received: from eggs.gnu.org ([2001:470:142:3::10]:50399)
 by lists.gnu.org with esmtp (Exim 4.90_1)
 (envelope-from <federicotedin@HIDDEN>) id 1iXu27-0008Hl-IT
 for bug-gnu-emacs@HIDDEN; Thu, 21 Nov 2019 16:30:36 -0500
X-Spam-Checker-Version: SpamAssassin 3.3.2 (2011-06-06) on eggs.gnu.org
X-Spam-Level: 
X-Spam-Status: No, score=0.8 required=5.0 tests=BAYES_50,FREEMAIL_FROM,
 URIBL_BLOCKED autolearn=disabled version=3.3.2
Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71)
 (envelope-from <federicotedin@HIDDEN>) id 1iXu26-0005V4-20
 for bug-gnu-emacs@HIDDEN; Thu, 21 Nov 2019 16:30:35 -0500
Received: from mail-wm1-x344.google.com ([2a00:1450:4864:20::344]:53236)
 by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16)
 (Exim 4.71) (envelope-from <federicotedin@HIDDEN>)
 id 1iXu25-0005UT-R8
 for bug-gnu-emacs@HIDDEN; Thu, 21 Nov 2019 16:30:33 -0500
Received: by mail-wm1-x344.google.com with SMTP id l1so5349190wme.2
 for <bug-gnu-emacs@HIDDEN>; Thu, 21 Nov 2019 13:30:32 -0800 (PST)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025;
 h=from:to:subject:date:message-id:mime-version;
 bh=qFbrTqmLD646wttdLR1cSbiAqpUHPNnPNfymsxOE7Mg=;
 b=CJDmOpFpIqyz0z91OznGZ8u0lQ+5Amcp2Ap8po2g3Md7PMD3dQOhz9OXLkFcYCa+/B
 ahjlU8rPJEWqoQqpB+YRIviYndMIw3a11mNozPWLVKO5lnhuvMMP44R64R/3Iohef2NZ
 Bd36zOXv+wfO4yXVKqHl61cJo4A0c4u6Ti64UsZfrNvYNl2GvbWpvd9GqDTcoe5umqVq
 5Io3GGcCSnfE4qnTTgYcIX7pEPcQMTsXecDQF3It9lRRGCN8p53cd5IZmoAbYcNDrn3a
 KwFQqpemQsKz4/KCDbM+w4lOTfUkb0E0ir6f6ydaWgiSye/iL8/ASRNa4CgL86S7IiPQ
 pBLw==
X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
 d=1e100.net; s=20161025;
 h=x-gm-message-state:from:to:subject:date:message-id:mime-version;
 bh=qFbrTqmLD646wttdLR1cSbiAqpUHPNnPNfymsxOE7Mg=;
 b=Oobm6bY9lQe4K29lwewHAhFotrhhwAtayI7R7uvMrLxgn+m96vn6jgnYiBHQlUmAn6
 wUpMlS23R+qjF1P2YqGi9izaIyP2qSDNcWInjuFJJCzjKnaBmVVlUFcXp5IcMJhng9gg
 ++WjOF5CUnpnQ/r3NOK9uQ6aaLtUJEnFFYymvdayTRdyam3VuL6ymO2ncZUMQsQ9lqm0
 CX0s1BDB3BpYo4O63mkXz5f8ELzjXkRNfSCfgkUTrXNeawef664LAg2Xnwppw5fq3LQE
 XSmxcXiPoEc1aWirYDq4WCKhvLTSXjl5ED/FkavwE/AY0YrSlNNtYdckh2chLYl/v+ng
 DzKQ==
X-Gm-Message-State: APjAAAXEehYRVKsJ+0GT2QD3cSLrug9gjWyZJQsCqbNO59Mj8Y5x/yc4
 dEUvbY1bDPBU+EwcdWnrW3QgAy4A
X-Google-Smtp-Source: APXvYqz853X/alnB9wAAGFOdEzS+mZ6BrtwgeoHJ9P8OIiox/5b1j6E9pxU/C+w8yetz50Z9+U5CVw==
X-Received: by 2002:a1c:de88:: with SMTP id v130mr13290747wmg.89.1574371831344; 
 Thu, 21 Nov 2019 13:30:31 -0800 (PST)
Received: from lead ([2a02:8109:8ac0:2ff0:d17f:44c3:a5fa:4c03])
 by smtp.gmail.com with ESMTPSA id o10sm606118wmc.42.2019.11.21.13.30.29
 for <bug-gnu-emacs@HIDDEN>
 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256);
 Thu, 21 Nov 2019 13:30:30 -0800 (PST)
From: Federico Tedin <federicotedin@HIDDEN>
To: bug-gnu-emacs@HIDDEN
Subject: Buffer-local variables don't work as history for read-from-minibuffer
Date: Thu, 21 Nov 2019 22:30:29 +0100
Message-ID: <87eey0lxxm.fsf@HIDDEN>
MIME-Version: 1.0
Content-Type: text/plain
X-detected-operating-system: by eggs.gnu.org: Genre and OS details not
 recognized.
X-Received-From: 2a00:1450:4864:20::344
X-Spam-Score: 0.7 (/)
X-Debbugs-Envelope-To: submit
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.18
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
X-Spam-Score: -2.3 (--)

I was recently trying to modify `goto-line' so that it uses a
buffer-local variable as input history for the minibuffer (so that line
numbers don't get mixed up with other inputted values, and each buffer
has its own input history) (see: https://debbugs.gnu.org/cgi/bugreport.cgi?bug=38282).

First, I modified `read-number' and added a new HIST parameter. Then I
just forwarded that value to `read-from-minibuffer'.

Then, in simple.el, I added a new buffer-local variable
`goto-line--hist' and passed it to `read-number' in `goto-line'. I also
added I call to `add-to-history` to record the value read. All of this
did not work as expected: the input history for all buffers was shared
for all uses of `goto-line'. Inspecting `goto-line--hist' with M-:
showed the correct list of values, however.

The shortest way I've found of reproducing the problem is:

(defvar-local local-hist nil)

(defun my-command ()
  (interactive)
  (add-to-history 'local-hist (read-from-minibuffer "> " nil nil nil 'local-hist)))

In this case, the variable `local-hist' will end up containing all the
inputted values (per buffer), but trying to use M-p or M-n to step
through the input history after invoking `my-command' will not work ("no
preceding item"). So to summarize, `read-from-minibuffer' doesn't seem
to work correctly when HIST is buffer-local.

Related: https://emacs.stackexchange.com/questions/53892/buffer-local-input-history-for-read-from-minibuffer/53898#53898





Acknowledgement sent to Federico Tedin <federicotedin@HIDDEN>:
New bug report received and forwarded. Copy sent to bug-gnu-emacs@HIDDEN. Full text available.
Report forwarded to bug-gnu-emacs@HIDDEN:
bug#38317; Package emacs. Full text available.
Please note: This is a static page, with minimal formatting, updated once a day.
Click here to see this page with the latest information and nicer formatting.
Last modified: Thu, 5 Dec 2019 09:45:02 UTC

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