[Top][All Lists]

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

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

From: Drew Adams
Subject: RE: Patch for more useful C-x } and C-x { behavior
Date: Fri, 4 May 2012 20:15:31 -0700

> "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

(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

reply via email to

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