[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: input to interactive M: key from text at point (was: help-gnu-emacs
From: |
Emanuel Berg |
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 |
User-agent: |
Gnus/5.13 (Gnus v5.13) Emacs/25.1 (gnu/linux) |
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
- Re: help-gnu-emacs Digest, Vol 198, Issue 83, Budi, 2019/05/24
- Re: help-gnu-emacs Digest, Vol 198, Issue 83, Emanuel Berg, 2019/05/25
- input to interactive M: key from text at point (was: help-gnu-emacs Digest, Vol 198, Issue 83), Van L, 2019/05/25
- Re: input to interactive M: key from text at point (was: help-gnu-emacs Digest, Vol 198, Issue 83),
Emanuel Berg <=