bug#3757: 23.0.95; can you explain why C-u make it appear not in minibuffer

Stephen Berman <[email protected]>
Newsgroups gmane.emacs.bugs,gmane.emacs.pretest.bugs
Message-ID <[email protected]>
On Sun, 5 Jul 2009 12:25:00 +0800 waterloo <[email protected]> wrote:

> in 11.1.2 An Example: `print-elements-of-list' of `Instruction to
> emacs lisp' , why C-u make the output not in minubuffer.
> C-u is 4 by definition .
> I can not understant why in the context.
> can you explain more details or give some link ?

I assume you are referring to this (in node
(eintr)print-elements-of-list of the Introduction to Programming in
Emacs Lisp):

"Be sure to evaluate the last expression, `(print-elements-of-list
animals)', by typing `C-u C-x C-e', that is, by giving an argument to
`eval-last-sexp'.  This will cause the result of the evaluation to be
printed in the `*scratch*' buffer instead of being printed in the echo
area."

That is, C-u is not a prefix argument of `print-elements-of-list' but of
`eval-last-sexp', and its meaning is explained in the doc string of
`eval-last-sexp', which you can read by typing `C-h f eval-last-sexp':

,----
| eval-last-sexp is an interactive compiled Lisp function in `lisp-mode.el'.
| 
| It is bound to C-x C-e.
| 
| (eval-last-sexp eval-last-sexp-arg-internal)
| 
| Evaluate sexp before point; print value in minibuffer.
| Interactively, with prefix argument, print output into current buffer.
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
| Truncates long output according to the value of the variables
| `eval-expression-print-length' and `eval-expression-print-level'.
`----

You need to use `eval-last-sexp' (or another evaluation method) because
`print-elements-of-list' is not a command, i.e. an interactive function,
since it lacks `(interactive)' in its definition.  So you cannot call it
by typing `M-x print-elements-of-list' but have to explicitly evaluate
it.

Steve Berman
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.