emacs-devel
[Top][All Lists]
Advanced

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

Re: Patch for more useful C-x } and C-x { behavior


From: Deniz Dogan
Subject: Re: Patch for more useful C-x } and C-x { behavior
Date: Sat, 05 May 2012 15:16:51 +0200
User-agent: Mozilla/5.0 (Windows NT 6.1; WOW64; rv:12.0) Gecko/20120428 Thunderbird/12.0.1

On 2012-05-05 05:15, Drew Adams wrote:
"Inspired" by C-x + and C-x -, I wrote a patch which lets the user
repeat the { or } character to continue enlarging/shrinking
the selected window's width.

I do that kind of thing in this generic way.  The same function `repeat-command'
can be used to define any repeater command.  And the prefix arg is passed
through as a bonus, in this case to set the increment (and direction) for the
repetitions.

(defun repeat-command (command)
   "Repeat COMMAND."
   (let ((repeat-message-function  'ignore))
     (setq last-repeatable-command  command)
     (repeat nil)))

(defun enlarge-window-horiz-repeat (arg)
   "..."
   (interactive "P")
   (require 'repeat)
   (repeat-command 'enlarge-window-horizontally))

(defun shrink-window-horiz-repeat (arg)
   "..."
   (interactive "P")
   (require 'repeat)
   (repeat-command 'shrink-window-horizontally))

(global-set-key "\C-x{" 'shrink-window-horiz-repeat)
(global-set-key "\C-x}" 'enlarge-window-horiz-repeat)

Of course, there is no `repeat-command' function in vanilla Emacs, so I end up
redefining it in various libraries (`bmkp-repeat-command',
`thgcmd-repeat-command', `wide-n-repeat-command'...).

As an example, I use `bmkp-repeat-command' to define 30 different repeating
commands for cycling among different types of bookmarks and bookmark sort
orders.


That's great!  Could we include it in Emacs?



reply via email to

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