From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: "Drew Adams" Newsgroups: gmane.emacs.devel Subject: RE: Patch for more useful C-x } and C-x { behavior Date: Fri, 4 May 2012 20:15:31 -0700 Message-ID: References: <4FA48F92.2080706@dogan.se> NNTP-Posting-Host: plane.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit X-Trace: dough.gmane.org 1336187753 10420 80.91.229.3 (5 May 2012 03:15:53 GMT) X-Complaints-To: usenet@dough.gmane.org NNTP-Posting-Date: Sat, 5 May 2012 03:15:53 +0000 (UTC) To: "'Deniz Dogan'" , Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Sat May 05 05:15:53 2012 Return-path: Envelope-to: ged-emacs-devel@m.gmane.org Original-Received: from lists.gnu.org ([208.118.235.17]) by plane.gmane.org with esmtp (Exim 4.69) (envelope-from ) id 1SQVTL-0000TW-QF for ged-emacs-devel@m.gmane.org; Sat, 05 May 2012 05:15:51 +0200 Original-Received: from localhost ([::1]:43391 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1SQVTK-0003Bg-Ul for ged-emacs-devel@m.gmane.org; Fri, 04 May 2012 23:15:50 -0400 Original-Received: from eggs.gnu.org ([208.118.235.92]:33042) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1SQVTH-0003BQ-Tm for emacs-devel@gnu.org; Fri, 04 May 2012 23:15:49 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1SQVTF-0007x1-Ry for emacs-devel@gnu.org; Fri, 04 May 2012 23:15:47 -0400 Original-Received: from acsinet15.oracle.com ([141.146.126.227]:41659) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1SQVTF-0007wc-Lj for emacs-devel@gnu.org; Fri, 04 May 2012 23:15:45 -0400 Original-Received: from acsinet22.oracle.com (acsinet22.oracle.com [141.146.126.238]) by acsinet15.oracle.com (Sentrion-MTA-4.2.2/Sentrion-MTA-4.2.2) with ESMTP id q453FcHw026310 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK); Sat, 5 May 2012 03:15:39 GMT Original-Received: from acsmt358.oracle.com (acsmt358.oracle.com [141.146.40.158]) by acsinet22.oracle.com (8.14.4+Sun/8.14.4) with ESMTP id q453FckD023957 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=NO); Sat, 5 May 2012 03:15:38 GMT Original-Received: from abhmt120.oracle.com (abhmt120.oracle.com [141.146.116.72]) by acsmt358.oracle.com (8.12.11.20060308/8.12.11) with ESMTP id q453FbA3027371; Fri, 4 May 2012 22:15:38 -0500 Original-Received: from dradamslap1 (/10.159.221.111) by default (Oracle Beehive Gateway v4.0) with ESMTP ; Fri, 04 May 2012 20:15:37 -0700 X-Mailer: Microsoft Office Outlook 11 In-Reply-To: <4FA48F92.2080706@dogan.se> Thread-Index: Ac0qZmaZ2HgfprUdScegJyoGFVl0aQABXIJQ X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2900.6157 X-Source-IP: acsinet22.oracle.com [141.146.126.238] X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.6 (newer, 1) X-Received-From: 141.146.126.227 X-BeenThere: emacs-devel@gnu.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: "Emacs development discussions." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Original-Sender: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Xref: news.gmane.org gmane.emacs.devel:150266 Archived-At: > "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.