emacs-devel
[Top][All Lists]
Advanced

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

Re: [PATCH] Make `C-x {' and `C-x }' repeatable


From: Juri Linkov
Subject: Re: [PATCH] Make `C-x {' and `C-x }' repeatable
Date: Tue, 21 May 2013 21:34:04 +0300
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/24.3.50 (x86_64-pc-linux-gnu)

> Ever since I started using emacs and tried to say good bye to my
> mouse, I have felt that the resizing of windows with `C-x }' and
> `C-x {' is too cumbersome to use.

Thanks for this useful feature.  I am experiencing the same difficulties
with `C-x }' and `C-x {', so your feature would be of a great help.

> Please tell me if I should have done that differently, and I'll
> try to implement it.

Please make the keymap user-customizable, e.g. if you'll create
a separate keymap with a name like `window-size-adjust-keymap' then
users would be able to add more keybindings in ~/.emacs like:

  (define-key window-size-adjust-keymap [right] 'enlarge-window-horizontally)
  (define-key window-size-adjust-keymap [left]  'shrink-window-horizontally)
  (define-key window-size-adjust-keymap [down]  'enlarge-window)
  (define-key window-size-adjust-keymap [up]    'shrink-window)

to use arrow keys for window resizing.  Then having such map
you could just add one line:

  (set-temporary-overlay-map window-size-adjust-keymap)

to the end of all these four functions to implement this feature.
I mean changing existing commands:

(defun shrink-window-horizontally (delta)
  (interactive "p")
  (shrink-window delta t))

to

(defun shrink-window-horizontally (delta)
  (interactive "p")
  (shrink-window delta t)
  (set-temporary-overlay-map window-size-adjust-keymap))

and the feature will just work without creating a "dispatcher" kind
of function `window-size-adjust'.  This will preserve the current global
keybindings (i.e. `shrink-window-horizontally' still bound to `C-x {' etc.)
and provide more customizability.

Then remaining possible improvements would be adding an option
to disable this feature (I think it should be enabled by default),
adding an informative echo-area message about available keybindings,
adding a keybinding (like `RET' in `isearch-mode') to exit a keysequence
of resizing keys, etc.

> One problem is that there is currently no standard key binding for
> (shrink-window).

It's very difficult to find a free global keybinding for
such less frequently used commands.  But there is no need
because users could use the existing global keybindings
to initiate a window-resizing keysequence and use other keys
from the map for more fine-grained resizing.



reply via email to

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