unofficial mirror of emacs-devel@gnu.org 
 help / color / mirror / code / Atom feed
* Re: [Emacs-diffs] emacs-25 f99b512: In M-%, avoid making buffer-local binding of text-property-default-nonsticky
       [not found] ` <E1akqKF-0005Rl-1Q@vcs.savannah.gnu.org>
@ 2016-03-29 12:01   ` Stefan Monnier
  2016-03-29 21:10     ` Alan Mackenzie
  0 siblings, 1 reply; 3+ messages in thread
From: Stefan Monnier @ 2016-03-29 12:01 UTC (permalink / raw)
  To: emacs-devel; +Cc: Alan Mackenzie

> +              (with-current-buffer (window-buffer (minibuffer-window))
> +                (let ((text-property-default-nonsticky
> +                       (cons '(separator . t) text-property-default-nonsticky)))

Using minibuffer-with-setup-hook would be a lot less hackish.
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).


        Stefan



^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [Emacs-diffs] emacs-25 f99b512: In M-%, avoid making buffer-local binding of text-property-default-nonsticky
  2016-03-29 12:01   ` [Emacs-diffs] emacs-25 f99b512: In M-%, avoid making buffer-local binding of text-property-default-nonsticky Stefan Monnier
@ 2016-03-29 21:10     ` Alan Mackenzie
  2016-03-29 22:47       ` Stefan Monnier
  0 siblings, 1 reply; 3+ messages in thread
From: Alan Mackenzie @ 2016-03-29 21:10 UTC (permalink / raw)
  To: Stefan Monnier; +Cc: emacs-devel

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



^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [Emacs-diffs] emacs-25 f99b512: In M-%, avoid making buffer-local binding of text-property-default-nonsticky
  2016-03-29 21:10     ` Alan Mackenzie
@ 2016-03-29 22:47       ` Stefan Monnier
  0 siblings, 0 replies; 3+ messages in thread
From: Stefan Monnier @ 2016-03-29 22:47 UTC (permalink / raw)
  To: Alan Mackenzie; +Cc: emacs-devel

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

No, you set it unconditionally and without looking back.
Think of it as setting up a major mode.


        Stefan



^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2016-03-29 22:47 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
     [not found] <20160329095238.20903.93640@vcs.savannah.gnu.org>
     [not found] ` <E1akqKF-0005Rl-1Q@vcs.savannah.gnu.org>
2016-03-29 12:01   ` [Emacs-diffs] emacs-25 f99b512: In M-%, avoid making buffer-local binding of text-property-default-nonsticky Stefan Monnier
2016-03-29 21:10     ` Alan Mackenzie
2016-03-29 22:47       ` Stefan Monnier

Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).