From mboxrd@z Thu Jan 1 00:00:00 1970 Path: main.gmane.org!not-for-mail From: Mathias Dahl Newsgroups: gmane.emacs.help Subject: Re: Insert debug statement with repeated string? ELSE, perhaps? Date: Mon, 14 Feb 2005 08:46:22 +0100 Message-ID: References: NNTP-Posting-Host: main.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-Trace: sea.gmane.org 1108367372 23470 80.91.229.2 (14 Feb 2005 07:49:32 GMT) X-Complaints-To: usenet@sea.gmane.org NNTP-Posting-Date: Mon, 14 Feb 2005 07:49:32 +0000 (UTC) Original-X-From: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Mon Feb 14 08:49:31 2005 Original-Received: from lists.gnu.org ([199.232.76.165]) by ciao.gmane.org with esmtp (Exim 4.43) id 1D0ayy-0006g5-1U for geh-help-gnu-emacs@m.gmane.org; Mon, 14 Feb 2005 08:49:24 +0100 Original-Received: from localhost ([127.0.0.1] helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1D0bES-00035V-Hf for geh-help-gnu-emacs@m.gmane.org; Mon, 14 Feb 2005 03:05:24 -0500 Original-Path: shelby.stanford.edu!newsfeed.stanford.edu!newsmi-us.news.garr.it!newsmi-eu.news.garr.it!NewsITBone-GARR!fu-berlin.de!uni-berlin.de!individual.net!not-for-mail Original-Newsgroups: gnu.emacs.help Original-Lines: 28 Original-X-Trace: individual.net PJFE5X1Xjgb7Cz95h3mkBg13IaCMZGxkOYgefbJ02MfTUE9N0r User-Agent: Gnus/5.11 (Gnus v5.11) Emacs/21.3.50 (windows-nt) Cancel-Lock: sha1:Nkgg2PrTC4BylcInZWDjCz85p+Y= Original-Xref: shelby.stanford.edu gnu.emacs.help:128540 Original-To: help-gnu-emacs@gnu.org X-BeenThere: help-gnu-emacs@gnu.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Users list for the GNU Emacs text editor List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Original-Sender: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Errors-To: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org X-MailScanner-To: geh-help-gnu-emacs@m.gmane.org Xref: main.gmane.org gmane.emacs.help:24072 X-Report-Spam: http://spam.gmane.org/gmane.emacs.help:24072 jjl@pobox.com (John J. Lee) writes: > I'd like to be able to insert debug statements that contain a repeated > string, for example: > > jjl.debug('fooBar %r' % fooBar) > > without typing the string 'fooBar' twice, and with not too many > keystrokes: ie without fiddling around with cursor positioning, C-y, > etc. (well, actually p or P rather than C-y for me, since I'm using > viper). I would use a keyboard macro for doing that, or put together a simple elisp snippet if this is something I would use often, like this: (defun insert-debug-string (dbg-str) (interactive "sString to debug: ") (insert (format "jjl.debugs('%s %%r' %% %s )" dbg-str dbg-str))) execute this with M-x insert-debug-string, or bind a key to it. There are probably hundreds of ways of doing this in Emacs, for example using abbrevs or code skeletons, but if the above works, it works... :) /Mathias