* split-window-keep-point
@ 2010-12-03 10:39 Thien-Thi Nguyen
0 siblings, 0 replies; only message in thread
From: Thien-Thi Nguyen @ 2010-12-03 10:39 UTC (permalink / raw)
To: emacs-devel
For the longest time (due to slow ttys just like the docstring
mentions), i set ‘split-window-keep-point’ to nil and was happy.
‘C-x 2’ and other internal usage of ‘split-window-vertically’
behaved more or less as expected.
Recently (1-2 years), i began to be annoyed at the behavior for
non-‘C-x 2’ usage of ‘split-window-vertically’. That is, Gnus or
‘M-x describe-variable’ or whatever would split the window, leaving
point in the upper window in a strange place (as warned by the
docstring). I could only guess that more functions are calling
‘split-window-vertically’ than before.
So, i wrote this in ~/.emacs and ask others for feedback on it:
(defun split-window-vertically-interactive (&optional size)
"Call `split-window-vertically' with SIZE, keeping point motionless.
This is achieved by let-binding `split-window-keep-point' to nil."
(interactive "P")
(let ((split-window-keep-point nil))
(split-window-vertically size)))
(setq split-window-keep-point t)
(global-set-key "\C-x2" 'split-window-vertically-interactive)
I suppose the inverse-polarity solution is to provide some kind of
‘split-window-vertically-keep-point’ for non-‘C-x 2’ calls, or
otherwise ensure that ‘split-window-keep-point’ is let-bound t for
such callers, everywhere.
^ permalink raw reply [flat|nested] only message in thread
only message in thread, other threads:[~2010-12-03 10:39 UTC | newest]
Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2010-12-03 10:39 split-window-keep-point Thien-Thi Nguyen
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).