unofficial mirror of emacs-devel@gnu.org 
 help / color / mirror / code / Atom feed
From: "Drew Adams" <drew.adams@oracle.com>
To: "'Deniz Dogan'" <deniz@dogan.se>, <emacs-devel@gnu.org>
Subject: RE: Patch for more useful C-x } and C-x { behavior
Date: Fri, 4 May 2012 20:15:31 -0700	[thread overview]
Message-ID: <D172094145114A2D8D85C44D1F045969@us.oracle.com> (raw)
In-Reply-To: <4FA48F92.2080706@dogan.se>

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




  reply	other threads:[~2012-05-05  3:15 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-05-05  2:25 Patch for more useful C-x } and C-x { behavior Deniz Dogan
2012-05-05  3:15 ` Drew Adams [this message]
2012-05-05 13:16   ` Deniz Dogan
2012-05-05 14:21     ` Drew Adams
2012-05-05 17:21       ` Deniz Dogan
2012-05-05 17:47         ` Drew Adams
2012-05-05  3:21 ` Leo

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://www.gnu.org/software/emacs/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=D172094145114A2D8D85C44D1F045969@us.oracle.com \
    --to=drew.adams@oracle.com \
    --cc=deniz@dogan.se \
    --cc=emacs-devel@gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).