emacs-devel
[Top][All Lists]
Advanced

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

Re: New keybinding suggestion: C-x _ for `shrink-window'


From: Juanma Barranquero
Subject: Re: New keybinding suggestion: C-x _ for `shrink-window'
Date: Wed, 31 Oct 2007 17:18:00 +0100

On 10/31/07, Stefan Monnier <address@hidden> wrote:

> I usually don't know how by how many lines I want to expand/shrink a window,
> so I typically end up doing
>
>    C-x ^ C-x ^ C-x ^
>
> which is *really* inconvenient.

I've been using this for years:

;; Function by Hirose Yuuji and Bob Wiener
(defun resize-window (&optional arg)
  "Resize window interactively."
  (interactive "p")
  (when (one-window-p) (error "Cannot resize sole window"))
  (unless arg (setq arg 1))
  (catch 'done
    (while t
      (message "h=heighten, s=shrink, w=widen, n=narrow (by %d);
1-9=unit, q=quit"
               arg)
      (ignore-errors
        (let ((c (read-char))
              (window-size-fixed nil))
          (cond ((= c ?h) (enlarge-window arg))
                ((= c ?s) (shrink-window arg))
                ((= c ?w) (enlarge-window-horizontally arg))
                ((= c ?n) (shrink-window-horizontally arg))
                ((= c ?\^G) (keyboard-quit))
                ((= c ?q) (throw 'done t))
                ((and (> c ?0) (<= c ?9)) (setq arg (- c ?0))))))))
  (message "Done."))

             Juanma




reply via email to

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