From: Drew Adams <drew.adams@oracle.com>
To: "help-gnu-emacs@gnu.org" <help-gnu-emacs@gnu.org>
Subject: RE: [External] : Re: Does the command loop even look at the return values of commands executed?
Date: Thu, 26 Aug 2021 16:52:02 +0000 [thread overview]
Message-ID: <SJ0PR10MB54882409885FBB9552E1FB24F3C79@SJ0PR10MB5488.namprd10.prod.outlook.com> (raw)
In-Reply-To: <83a6l4tlmt.fsf@gnu.org>
> > I am pretty sure that the command loop discards anything returned by
> > a command invoked via a keybinding or M-x, but I couldn't find anything
> > about it in the Elisp reference. Is that true? Is it documented
> > anywhere?
>
> Yes, we ignore the value returned by commands. No, it isn't
> documented, AFAICT.
Just for info, in case it's somehow relevant to
Marcin: There is global variable `values'.
(elisp) node `Eval' tells us:
___
Variable: values
The value of this variable is a list of the values returned by all
the expressions that were read, evaluated, and printed from buffers
(including the minibuffer) by the standard Emacs commands which do
this. (Note that this does _not_ include evaluation in ‘*ielm*’
buffers, nor evaluation using ‘C-j’, ‘C-x C-e’, and similar
evaluation commands in ‘lisp-interaction-mode’.) The elements are
ordered most recent first.
(setq x 1)
⇒ 1
(list 'A (1+ 2) auto-save-default)
⇒ (A 3 t)
values
⇒ ((A 3 t) 1 ...)
This variable is useful for referring back to values of forms
recently evaluated. It is generally a bad idea to print the value
of ‘values’ itself, since this may be very long. Instead, examine
particular elements, like this:
;; Refer to the most recent evaluation result.
(nth 0 values)
⇒ (A 3 t)
;; That put a new element on,
;; so all elements move back one.
(nth 1 values)
⇒ (A 3 t)
;; This gets the element that was next-to-most-recent
;; before this example.
(nth 3 values)
⇒ 1
___
Although it doesn't apply to `C-x C-e', it does apply
to `M-:'.
next prev parent reply other threads:[~2021-08-26 16:52 UTC|newest]
Thread overview: 10+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-08-26 5:32 Does the command loop even look at the return values of commands executed? Marcin Borkowski
2021-08-26 12:51 ` Eli Zaretskii
2021-08-26 16:52 ` Drew Adams [this message]
2021-08-27 7:59 ` [External] : " Stephen Berman
2021-08-27 8:12 ` Emanuel Berg via Users list for the GNU Emacs text editor
2021-08-27 9:40 ` Stephen Berman
2021-08-27 9:47 ` Emanuel Berg via Users list for the GNU Emacs text editor
2021-08-27 11:38 ` Eli Zaretskii
2021-08-27 16:12 ` Drew Adams
2021-08-26 20:00 ` Marcin Borkowski
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=SJ0PR10MB54882409885FBB9552E1FB24F3C79@SJ0PR10MB5488.namprd10.prod.outlook.com \
--to=drew.adams@oracle.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.