Discussion:
Buffer stuff
(too old to reply)
Dieter Britz
2020-06-11 09:28:48 UTC
Permalink
Sometimes in an emacs session, my thick fingers type
something wrong, and I go into this state:

;; This buffer is for text that is not saved, and for Lisp evaluation.
;; To create a file, visit it with C-x C-f and enter text in its buffer.

How do I get out of that and back into my editing session?
--
Dieter Britz
Michael Heerdegen
2020-06-11 09:50:12 UTC
Permalink
Post by Dieter Britz
Sometimes in an emacs session, my thick fingers type
;; This buffer is for text that is not saved, and for Lisp evaluation.
;; To create a file, visit it with C-x C-f and enter text in its buffer.
How do I get out of that and back into my editing session?
You've just switched to the *scratch* buffer. You want to switch back
to your previous buffer.

The easiest way is C-x b. You are prompted for a buffer name. The
default should be the buffer you want in your case, so you can just
confirm with RET.

You can also use a buffer menu (C-x C-b, or M-x ibuffer).

`winner-mode' also comes handy, then you can switch to the previous
window config with one key, similar to `undo', when you have enabled the
mode.

Michael.
N. Jackson
2020-06-11 11:59:22 UTC
Permalink
Post by Michael Heerdegen
Post by Dieter Britz
Sometimes in an emacs session, my thick fingers type
;; This buffer is for text that is not saved, and for Lisp evaluation.
;; To create a file, visit it with C-x C-f and enter text in its buffer.
How do I get out of that and back into my editing session?
You've just switched to the *scratch* buffer. You want to
switch back to your previous buffer.
The easiest way is C-x b. You are prompted for a buffer name.
The default should be the buffer you want in your case, so you
can just confirm with RET.
You can also use a buffer menu (C-x C-b, or M-x ibuffer).
`winner-mode' also comes handy, then you can switch to the
previous window config with one key, similar to `undo', when you
have enabled the mode.
Also, you can use the "Buffers" menu in the menu bar. From here
you can switch to any buffer.

(Navigating your buffers from the menu is not as powerful as
`switch-buffer' (C-x b) and `list-buffers' (C-x C-b) (suggested by
Michael) but it might be easier to remember, and if you only have
one buffer (or three, maybe, counting *scratch* and *Messages*),
it should be sufficient.)

Also from the "Buffers" menu in the menu bar, you can run
`next-buffer' and `previous-buffer' to cycle through your
buffers. By default they are bound to C-x <right> and C-x <left>.

Perhaps you are inadvertently using C-x <right> or C-x <left> when
you accidentally switch buffers? To find out, the next time this
happens you can look at your most recent keystrokes ("lossage")
with C-h l.

N.
Ralf Fassel
2020-06-11 13:44:48 UTC
Permalink
* Michael Heerdegen <***@web.de>
| Dieter Britz <***@gmail.com> writes:
| > Sometimes in an emacs session, my thick fingers type
| > something wrong, and I go into this state:
| >
| > ;; This buffer is for text that is not saved, and for Lisp evaluation.
| > ;; To create a file, visit it with C-x C-f and enter text in its buffer.
| >
| > How do I get out of that and back into my editing session?
| You've just switched to the *scratch* buffer. You want to switch back
| to your previous buffer.
| The easiest way is C-x b. You are prompted for a buffer name. The
| default should be the buffer you want in your case, so you can just
| confirm with RET.

M-x bury-buffer does that in one step (I have it bound on C-x y), and
also gets the *scratch* buffer "out of the way" (which would otherwise
be the default on the next C-x b).

R'
Dmitry Alexandrov
2020-06-12 13:48:18 UTC
Permalink
M-x bury-buffer does that in one step (I have it bound on C-x y), and also gets the *scratch* buffer "out of the way" (which would otherwise be the default on the next C-x b).
FWIW, I found M-x quit-window be more useful to be bound on some keyseq (namely, C-x q). In most cases itÊŒs the same as M-x bury-buffer, but it also closes some ‘pop-up’ windows, such as *Help*.
Loading...