elisp question
  Home FAQ Contact Sign in
gnu.emacs.help only
 
Advanced search
POPULAR GROUPS

more...

gnu.emacs.help Profile…
 Up
elisp question         


Author: harven
Date: Apr 30, 2008 14:23

I am trying to device a short command to
interactively resize the current window:

(defun resize-window (key)
"resize interactively the window"
(interactive "c- widen, _ shrink")
(cond
((eq key (string-to-char "-"))
(enlarge-window 1)
(call-interactively 'resize-window))
((eq key (string-to-char "_"))
(enlarge-window -1)
(call-interactively 'resize-window))
(t (insert key))))

I type -/_ a number of times, the window enlarges/shrinks, and if I
type another character, the window resizing stops and the character is
inserted.

However, I would like the following effect.
Any entry other than -/_ should end the resizing and be executed. How
can I achieve such effect ?
3 Comments
Re: elisp question         


Author: Kevin Rodgers
Date: May 1, 2008 06:08

harven wrote:
> I am trying to device a short command to
> interactively resize the current window:
>
> (defun resize-window (key)
> "resize interactively the window"
> (interactive "c- widen, _ shrink")
> (cond
> ((eq key (string-to-char "-"))
> (enlarge-window 1)
> (call-interactively 'resize-window))
> ((eq key (string-to-char "_"))
> (enlarge-window -1)
> (call-interactively 'resize-window))
> (t (insert key))))
>
> I type -/_ a number of times, the window enlarges/shrinks, and if I
> type another character, the window resizing stops and the character is
> inserted.
> ...
Show full article (1.78Kb)
no comments
Re: elisp question         


Author: harven
Date: May 1, 2008 06:54

Works perfectly. Thanks a lot !
no comments
Re: elisp question         


Author: Bastien
Date: May 3, 2008 08:38

harven writes:
> I am trying to device a short command to
> interactively resize the current window:

You might play with windresize.el:

http://lumiere.ens.fr/~guerry/u/windresize.el

M-x windresize RET

--
Bastien
no comments