all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
* Insert debug statement with repeated string?  ELSE, perhaps?
@ 2005-02-13 19:15 John J. Lee
  0 siblings, 0 replies; 2+ messages in thread
From: John J. Lee @ 2005-02-13 19:15 UTC (permalink / raw)


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 suspect ELSE may be able to do this: does anybody have an example of
this kind of thing?

Or just some elisp usable by this elisp-illiterate?


John

^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: Insert debug statement with repeated string?  ELSE, perhaps?
       [not found] <mailman.1974.1108326317.2841.help-gnu-emacs@gnu.org>
@ 2005-02-14  7:46 ` Mathias Dahl
  0 siblings, 0 replies; 2+ messages in thread
From: Mathias Dahl @ 2005-02-14  7:46 UTC (permalink / raw)


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

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2005-02-14  7:46 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
     [not found] <mailman.1974.1108326317.2841.help-gnu-emacs@gnu.org>
2005-02-14  7:46 ` Insert debug statement with repeated string? ELSE, perhaps? Mathias Dahl
2005-02-13 19:15 John J. Lee

Code repositories for project(s) associated with this external index

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

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.