emacs-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

*scratch* buffer documentation


From: Jean-Christophe Helary
Subject: *scratch* buffer documentation
Date: Wed, 25 Dec 2019 08:58:45 +0900

I am not seeing anything in the Emacs manual that says a modified *scratch* 
buffer does not trigger a "buffer modified. Kill anyway ?" message when 
quitting.

The first reference to the *scratch* buffer is in "5 Entering Emacs" and it 
implicitly refers to the "Lisp Interaction" section to know more. After 
checking other instances of *scratch* in the manual, it seems that the "Lisp 
Interaction" section is the place where most of the information about the 
*scratch* buffer is gathered. It reads:

-------
When Emacs starts up, it contains a buffer named ‘*scratch*’, which is
provided for evaluating Emacs Lisp expressions interactively.  Its major
mode is Lisp Interaction mode.  You can also enable Lisp Interaction
mode by typing ‘M-x lisp-interaction-mode’.

   In the ‘*scratch*’ buffer, and other Lisp Interaction mode buffers,
‘C-j’ (‘eval-print-last-sexp’) evaluates the Lisp expression before
point, and inserts the value at point.  Thus, as you type expressions
into the buffer followed by ‘C-j’ after each expression, the buffer
records a transcript of the evaluated expressions and their values.  All
other commands in Lisp Interaction mode are the same as in Emacs Lisp
mode.

   At startup, the ‘*scratch*’ buffer contains a short message, in the
form of a Lisp comment, that explains what it is for.  This message is
controlled by the variable ‘initial-scratch-message’, which should be
either a documentation string, or ‘nil’ (which means to suppress the
message).

   An alternative way of evaluating Emacs Lisp expressions interactively
is to use Inferior Emacs Lisp mode, which provides an interface rather
like Shell mode (*note Shell Mode::) for evaluating Emacs Lisp
expressions.  Type ‘M-x ielm’ to create an ‘*ielm*’ buffer which uses
this mode.  For more information, see that command’s documentation.
-------


I'd like to propose to modify it this way:

-------
The *scratch* buffer

When Emacs starts up, it contains a buffer named ‘*scratch*’, which is
provided for evaluating Emacs Lisp expressions interactively.  Its major
mode is Lisp Interaction mode.

   At startup, the ‘*scratch*’ buffer contains a short message, in the
form of a Lisp comment, that explains what it is for.  This message is
controlled by the variable ‘initial-scratch-message’, which should be
either a documentation string, or ‘nil’ (which means to suppress the
message).

   If you kill the ‘*scratch*’ buffer after a modification, Emacs will not ask 
you to confirm the kill and the contents of the ‘*scratch*’ buffer will be 
lost.  This behavior is not customizable.

Lisp Interaction mode

   You can enable Lisp Interaction mode in other buffers by typing ‘M-x 
lisp-interaction-mode’.

   In Lisp Interaction mode buffers, including the ‘*scratch*’ buffer,
‘C-j’ (‘eval-print-last-sexp’) evaluates the Lisp expression before
point, and inserts the value at point.  Thus, as you type expressions
into the buffer followed by ‘C-j’ after each expression, the buffer
records a transcript of the evaluated expressions and their values.  All
other commands in Lisp Interaction mode are the same as in Emacs Lisp
mode.

   An alternative way of evaluating Emacs Lisp expressions interactively
is to use Inferior Emacs Lisp mode, which provides an interface rather
like Shell mode (*note Shell Mode::) for evaluating Emacs Lisp
expressions.  Type ‘M-x ielm’ to create an ‘*ielm*’ buffer which uses
this mode.  For more information, see that command’s documentation.
-------


Jean-Christophe Helary
-----------------------------------------------
http://mac4translators.blogspot.com @brandelune





reply via email to

[Prev in Thread] Current Thread [Next in Thread]