emacs-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Emacs-diffs] emacs-25 f99b512: In M-%, avoid making buffer-local bi


From: Alan Mackenzie
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
User-agent: Mutt/1.5.24 (2015-08-30)

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).



reply via email to

[Prev in Thread] Current Thread [Next in Thread]