emacs-devel
[Top][All Lists]
Advanced

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

Re: goto-char doesn't stick


From: Eli Zaretskii
Subject: Re: goto-char doesn't stick
Date: Thu, 15 Jun 2017 17:30:29 +0300

> From: Stefan Monnier <address@hidden>
> Date: Thu, 15 Jun 2017 09:24:15 -0400
> Cc: Emacs developers <address@hidden>
> 
> >>>> (progn
> >>>> (set-buffer "z")
> >>>> (goto-char LOCATION))
> >> [...]
> >>> It's a feature, new in Emacs 26.  If you don't like it, turn off
> >>> switch-to-buffer-preserve-window-point.
> >> Really?  Why would set-buffer+goto-char be affected by a variable named
> >> switch-to-buffer-* ?
> > The switch-to-buffer-preserve-window-point affects point when you
> > switch to buffer "z" later.
> 
> I don't understand the scenario you have in mind.  If I do
> 
>     M-: (with-current-buffer "z" (goto-char (1+ (point))) (point))
> 
> repeatedly, when "z" is not displayed, I see an increasing sequence, so
> the value of point is correctly preserved.

Of course.

> > No, I verified that it happens when "z" is not displayed in any window.
> 
> I wonder what's the difference between your test and mine.

You need to switch to "z" so that it is displayed in a window,
e.g. with "C-x b".  switch-to-buffer-preserve-window-point does its
thing at that time.

IOW, "goto-char doesn't stick" is based n an illusion, created by
making "z" the current buffer in the window, after running the snippet
above.



reply via email to

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