emacs-devel
[Top][All Lists]
Advanced

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

split-window-keep-point


From: Thien-Thi Nguyen
Subject: split-window-keep-point
Date: Fri, 03 Dec 2010 11:39:35 +0100
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/24.0.50 (gnu/linux)

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.



reply via email to

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