From: Evgeny Zajcev <lg.zevlg@gmail.com>
To: emacs-devel <emacs-devel@gnu.org>
Subject: Buffer local `switch-to-buffer-preserve-window-point'
Date: Mon, 30 Nov 2020 11:03:30 +0300 [thread overview]
Message-ID: <CAO=W_ZrwFh8S6U5NvVeN+LWF+ai_kW4c1NsmiG0NNhieUrEA=A@mail.gmail.com> (raw)
[-- Attachment #1: Type: text/plain, Size: 1137 bytes --]
I think we should add to the documentation that buffer local values for
`switch-to-buffer-obey-display-actions' and
`switch-to-buffer-preserve-window-point' won't work as user would expect.
The problem with their buffer local values is that they are used for buffer
logic *before* buffer is set as current, see `switch-to-buffer'. We should
either use `(buffer-local-value NAME buffer)' to get their values in
`switch-to-buffer', or add to the documentation that they should not have
buffer local values.
Here is code snippet to trigger unexpected behaviour:
;; Switch to scratch and eval
(progn
(setq switch-to-buffer-preserve-window-point t)
(with-current-buffer (get-buffer-create "pwp")
(setq-local switch-to-buffer-preserve-window-point nil)
(insert "asnoteh asoensnaot heusnatoeh usanotehu aeosntuhaoe")
(point))
(switch-to-buffer "pwp")
(switch-to-other-buffer 1)
(with-current-buffer "pwp"
(goto-char 10)
(point))
(switch-to-buffer "pwp")
;; Expecting point to be at 10 position, but it remains at the end
;; of the line
)
What do you think?
Thanks
--
lg
[-- Attachment #2: Type: text/html, Size: 1553 bytes --]
next reply other threads:[~2020-11-30 8:03 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-11-30 8:03 Evgeny Zajcev [this message]
2020-11-30 9:06 ` Buffer local `switch-to-buffer-preserve-window-point' martin rudalics
2020-11-30 10:34 ` Evgeny Zajcev
2020-11-30 17:30 ` martin rudalics
2020-11-30 17:54 ` Evgeny Zajcev
2020-11-30 17:57 ` Evgeny Zajcev
2020-11-30 19:01 ` martin rudalics
2020-12-01 9:32 ` martin rudalics
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to='CAO=W_ZrwFh8S6U5NvVeN+LWF+ai_kW4c1NsmiG0NNhieUrEA=A@mail.gmail.com' \
--to=lg.zevlg@gmail.com \
--cc=emacs-devel@gnu.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
Code repositories for project(s) associated with this external index
https://git.savannah.gnu.org/cgit/emacs.git
https://git.savannah.gnu.org/cgit/emacs/org-mode.git
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.