From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Alan Mackenzie Newsgroups: gmane.emacs.devel Subject: Re: [Emacs-diffs] emacs-25 f99b512: In M-%, avoid making buffer-local binding of text-property-default-nonsticky Date: Tue, 29 Mar 2016 21:10:30 +0000 Message-ID: <20160329211030.GC3377@acm.fritz.box> References: <20160329095238.20903.93640@vcs.savannah.gnu.org> NNTP-Posting-Host: plane.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-Trace: ger.gmane.org 1459285684 26790 80.91.229.3 (29 Mar 2016 21:08:04 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Tue, 29 Mar 2016 21:08:04 +0000 (UTC) Cc: emacs-devel@gnu.org To: Stefan Monnier Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Tue Mar 29 23:07:57 2016 Return-path: Envelope-to: ged-emacs-devel@m.gmane.org Original-Received: from lists.gnu.org ([208.118.235.17]) by plane.gmane.org with esmtp (Exim 4.69) (envelope-from ) id 1al0rk-0004MB-OG for ged-emacs-devel@m.gmane.org; Tue, 29 Mar 2016 23:07:56 +0200 Original-Received: from localhost ([::1]:50008 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1al0rj-0007sP-K4 for ged-emacs-devel@m.gmane.org; Tue, 29 Mar 2016 17:07:55 -0400 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:45037) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1al0rW-0007s9-IF for emacs-devel@gnu.org; Tue, 29 Mar 2016 17:07:43 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1al0rT-00039V-Ow for emacs-devel@gnu.org; Tue, 29 Mar 2016 17:07:42 -0400 Original-Received: from mail.muc.de ([193.149.48.3]:30085) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1al0rT-00039J-A1 for emacs-devel@gnu.org; Tue, 29 Mar 2016 17:07:39 -0400 Original-Received: (qmail 32932 invoked by uid 3782); 29 Mar 2016 21:07:37 -0000 Original-Received: from acm.muc.de (p548A5478.dip0.t-ipconnect.de [84.138.84.120]) by colin.muc.de (tmda-ofmipd) with ESMTP; Tue, 29 Mar 2016 23:07:35 +0200 Original-Received: (qmail 7111 invoked by uid 1000); 29 Mar 2016 21:10:30 -0000 Content-Disposition: inline In-Reply-To: User-Agent: Mutt/1.5.24 (2015-08-30) X-Delivery-Agent: TMDA/1.1.12 (Macallan) X-Primary-Address: acm@muc.de X-detected-operating-system: by eggs.gnu.org: FreeBSD 9.x X-Received-From: 193.149.48.3 X-BeenThere: emacs-devel@gnu.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: "Emacs development discussions." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Original-Sender: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Xref: news.gmane.org gmane.emacs.devel:202414 Archived-At: Hello, Stefan. On Tue, Mar 29, 2016 at 08:01:43AM -0400, Stefan Monnier wrote: > > + (with-current-buffer (window-buffer (minibuffer-window)) > > + (let ((text-property-default-nonsticky > > + (cons '(separator . t) text-property-default-nonsticky))) > Using minibuffer-setup-hook would be a lot less hackish. But very clumsy. You can't bind a variable in this sort of hook. So you have to save the current value somewhere, set the value you want, then hope that you can restore the original value afterwards (which you probably can, but you can't according to the (inadequate) doc string of minibuffer-exit-hook). > This assumes that (window-buffer (minibuffer-window)) returns the buffer > that read-from-minibuffer will use, which is only true in the normal > case by accident (e.g. it's probably not going to hold in case of > a recursive minibuffer invocation). Actually, it doesn't really matter. As long as the buffer it finds doesn't have a buffer local binding of text-property-default-nonsticky (and the minibuffer it will use doesn't, either), then the global value will get bound, and everything works. Why does this have to be so difficult? Why is there no function to return the (next) minibuffer? Why is there no facility to bind the default value of a variable? > Stefan -- Alan Mackenzie (Nuremberg, Germany).