From: "Drew Adams" <drew.adams@oracle.com>
To: "'andrea'" <andrea.crotti.0@gmail.com>, <help-gnu-emacs@gnu.org>
Subject: RE: Grab and yank
Date: Sun, 24 Jan 2010 08:43:38 -0800 [thread overview]
Message-ID: <04A099A7E49540D58224EFDFC10ED272@us.oracle.com> (raw)
In-Reply-To: <m1bpgjeqqc.fsf@ip116-027.hgracht.rwth-aachen.de>
> Another very nice feature that I would like to have is a sort of
> semantic grabbing of code, if for example I want to take the
> code of the python function foo I should just do M-x grab-code RET
> foo and that could even work for anything that works with tags (for
> example), what could be the best general solution for that?
I probably don't understand. What's wrong with this?
M-. foo ; go to foo's definition
C-M-h ; select it
M-w ; copy it
C-x b ; return
C-y ; yank
If that does what you want but you think it's too much work ;-), just roll it
into (a keyboard macro) or a command that uses `save-excursion' and the
constituent commands (`find-tag', `mark-defun', `kill-ring-save', and `yank').
A simple alternative, but which assumes that the function's definition is not
byte-compiled:
(defun grab (fn)
(interactive "aFunction: ")
(let ((strg (format "%s" (symbol-function fn))))
(insert strg))) ; or use `insert-for-yank'
next prev parent reply other threads:[~2010-01-24 16:43 UTC|newest]
Thread overview: 14+ messages / expand[flat|nested] mbox.gz Atom feed top
2010-01-23 21:31 Grab and yank andrea
2010-01-24 10:34 ` andrea
2010-01-24 16:43 ` Drew Adams [this message]
2010-01-24 11:24 ` Lennart Borgman
2010-01-24 11:50 ` Andrea Crotti
2010-01-24 12:05 ` Lennart Borgman
2010-01-24 13:48 ` Lennart Borgman
2010-01-24 15:13 ` Richard Riley
2010-01-24 15:16 ` Lennart Borgman
2010-01-24 17:29 ` Richard Riley
2010-01-24 17:39 ` Drew Adams
2010-01-24 17:47 ` Richard Riley
2010-01-24 14:32 ` Andreas Röhler
[not found] ` <mailman.99.1264332314.14305.help-gnu-emacs@gnu.org>
2010-01-25 18:07 ` Stefan Monnier
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
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=04A099A7E49540D58224EFDFC10ED272@us.oracle.com \
--to=drew.adams@oracle.com \
--cc=andrea.crotti.0@gmail.com \
--cc=help-gnu-emacs@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 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.