From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Deniz Dogan Newsgroups: gmane.emacs.devel Subject: Re: Patch for more useful C-x } and C-x { behavior Date: Sat, 05 May 2012 15:16:51 +0200 Message-ID: <4FA52843.1040508@dogan.se> References: <4FA48F92.2080706@dogan.se> NNTP-Posting-Host: plane.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit X-Trace: dough.gmane.org 1336223843 32710 80.91.229.3 (5 May 2012 13:17:23 GMT) X-Complaints-To: usenet@dough.gmane.org NNTP-Posting-Date: Sat, 5 May 2012 13:17:23 +0000 (UTC) Cc: emacs-devel@gnu.org To: Drew Adams Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Sat May 05 15:17:22 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 1SQerR-0003Vp-Hb for ged-emacs-devel@m.gmane.org; Sat, 05 May 2012 15:17:21 +0200 Original-Received: from localhost ([::1]:32790 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1SQerQ-0007nu-PE for ged-emacs-devel@m.gmane.org; Sat, 05 May 2012 09:17:20 -0400 Original-Received: from eggs.gnu.org ([208.118.235.92]:42896) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1SQerN-0007nn-PR for emacs-devel@gnu.org; Sat, 05 May 2012 09:17:19 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1SQerM-00075R-2E for emacs-devel@gnu.org; Sat, 05 May 2012 09:17:17 -0400 Original-Received: from mxf3.bahnhof.se ([213.80.101.27]:50332) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1SQerL-00075D-Rm for emacs-devel@gnu.org; Sat, 05 May 2012 09:17:15 -0400 Original-Received: from localhost (mxf3.local [127.0.0.1]) by mxf3-reinject (Postfix) with ESMTP id 0134321142B; Sat, 5 May 2012 15:17:12 +0200 (CEST) X-Virus-Scanned: by amavisd-new using ClamAV at bahnhof.se (MXF1) Original-Received: from mxf3.bahnhof.se ([127.0.0.1]) by localhost (mxf3.bahnhof.se [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id ai2kBJRapWT1; Sat, 5 May 2012 15:17:10 +0200 (CEST) Original-Received: from [176.10.168.241] (h-168-241.a336.priv.bahnhof.se [176.10.168.241]) by mxf3.bahnhof.se (Postfix) with ESMTP id B3F77211425; Sat, 5 May 2012 15:17:09 +0200 (CEST) User-Agent: Mozilla/5.0 (Windows NT 6.1; WOW64; rv:12.0) Gecko/20120428 Thunderbird/12.0.1 In-Reply-To: X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 213.80.101.27 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:150280 Archived-At: 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?