From: Emanuel Berg via help-gnu-emacs <help-gnu-emacs@gnu.org>
To: help-gnu-emacs@gnu.org
Subject: Re: input to interactive M: key from text at point (was: help-gnu-emacs Digest, Vol 198, Issue 83)
Date: Mon, 27 May 2019 23:26:04 +0200 [thread overview]
Message-ID: <86ef4jd1xv.fsf@zoho.eu> (raw)
In-Reply-To: m236l2rhn9.fsf_-_@scratch.space
Van L wrote:
>> How to hook string/word at point to be as
>> input interactive M-: key, i.e.
>> prompting Eval: on minibuffer ?
>
> Guessing that you have text you want to
> evaluate as elisp, try the following.
>
>
> C-h f eval-region
>
>
> What I do is select a region of elisp text
> and M-x eval-region.
OK, so this is the correct interpretation of
the question from the OP? I'm not sure it is,
but if it is, it is easier to answer.
`eval-region' is a bit of a trickster in my
book, I like `eval-last-sexp' better
(`C-x C-e'; place point after the
closing parenthesis).
Do it repeatedly if needed:
(message "1")
(message "2")
(message "3")
If you do it repeatedly, you can either do it
faster with something like this - and bind it
to a even faster and shorter keystroke than
`C-x C-e', e.g. I have it M-a:
(defun do-repeat-complex-command ()
(interactive)
(eval (car command-history) ))
This can be a trickster as well tho, as anyone
who tries it will realize quite soon :) But it
is useful as well, and not only in trivial
examples like the one above.
But the _best_ way of doing it if you notice
you do it a lot, is probably change the code
itself:
(progn
(message "1")
(message "2")
(message "3") )
;; ^ C-x C-e just once, with point here
HIH and please do clarify if we didn't answer
your actual question :)
--
underground experts united
http://user.it.uu.se/~embe8573
https://dataswamp.org/~incal
next prev parent reply other threads:[~2019-05-27 21:26 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
[not found] <mailman.14272.1558701102.1163.help-gnu-emacs@gnu.org>
2019-05-24 13:22 ` help-gnu-emacs Digest, Vol 198, Issue 83 Budi
2019-05-25 4:22 ` Emanuel Berg via help-gnu-emacs
2019-05-25 9:46 ` input to interactive M: key from text at point (was: help-gnu-emacs Digest, Vol 198, Issue 83) Van L
2019-05-27 21:26 ` Emanuel Berg via help-gnu-emacs [this message]
2019-05-28 11:02 ` input to interactive M: key from text at point Van L
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=86ef4jd1xv.fsf@zoho.eu \
--to=help-gnu-emacs@gnu.org \
--cc=moasenwood@zoho.eu \
/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.