1
0
mirror of https://git.savannah.gnu.org/git/emacs.git synced 2025-01-27 19:31:38 +00:00

Add more commands to the new `C-x x' keymap

* doc/emacs/killing.texi (Accumulating Text):
* doc/emacs/display.texi (Line Truncation):
* doc/emacs/buffers.texi (Misc Buffer): Document it.

* lisp/bindings.el (ctl-x-x-map): Add new bindings for
rename-buffer, rename-uniquely, insert-buffer and
toggle-truncate-lines.
This commit is contained in:
Lars Ingebrigtsen 2021-02-07 13:53:44 +01:00
parent a6a5d6a27a
commit e0c9399454
5 changed files with 39 additions and 31 deletions

View File

@ -232,9 +232,9 @@ unless they visit files: such buffers are used internally by Emacs.
@table @kbd
@item C-x C-q
Toggle read-only status of buffer (@code{read-only-mode}).
@item M-x rename-buffer @key{RET} @var{buffer} @key{RET}
@item C-x x r @key{RET} @var{buffer} @key{RET}
Change the name of the current buffer.
@item M-x rename-uniquely
@item C-x x u
Rename the current buffer by adding @samp{<@var{number}>} to the end.
@item M-x view-buffer @key{RET} @var{buffer} @key{RET}
Scroll through buffer @var{buffer}. @xref{View Mode}.
@ -263,28 +263,28 @@ non-@code{nil} value, making the buffer read-only with @kbd{C-x C-q}
also enables View mode in the buffer (@pxref{View Mode}).
@findex rename-buffer
@kbd{M-x rename-buffer} changes the name of the current buffer. You
specify the new name as a minibuffer argument; there is no default.
If you specify a name that is in use for some other buffer, an error
happens and no renaming is done.
@kbd{C-x x r} (@code{rename-buffer} changes the name of the current
buffer. You specify the new name as a minibuffer argument; there is
no default. If you specify a name that is in use for some other
buffer, an error happens and no renaming is done.
@findex rename-uniquely
@kbd{M-x rename-uniquely} renames the current buffer to a similar
name with a numeric suffix added to make it both different and unique.
This command does not need an argument. It is useful for creating
multiple shell buffers: if you rename the @file{*shell*} buffer, then
do @kbd{M-x shell} again, it makes a new shell buffer named
@file{*shell*}; meanwhile, the old shell buffer continues to exist
under its new name. This method is also good for mail buffers,
@kbd{C-x x u} (@code{rename-uniquely}) renames the current buffer to
a similar name with a numeric suffix added to make it both different
and unique. This command does not need an argument. It is useful for
creating multiple shell buffers: if you rename the @file{*shell*}
buffer, then do @kbd{M-x shell} again, it makes a new shell buffer
named @file{*shell*}; meanwhile, the old shell buffer continues to
exist under its new name. This method is also good for mail buffers,
compilation buffers, and most Emacs features that create special
buffers with particular names. (With some of these features, such as
@kbd{M-x compile}, @kbd{M-x grep}, you need to switch to some other
buffer before using the command again, otherwise it will reuse the
current buffer despite the name change.)
The commands @kbd{M-x append-to-buffer} and @kbd{M-x insert-buffer}
can also be used to copy text from one buffer to another.
@xref{Accumulating Text}.
The commands @kbd{M-x append-to-buffer} and @kbd{C-x x i}
(@code{insert-buffer}) can also be used to copy text from one buffer
to another. @xref{Accumulating Text}.
@node Kill Buffer
@section Killing Buffers

View File

@ -1755,13 +1755,13 @@ and/or leftmost columns.
@findex toggle-truncate-lines
Horizontal scrolling automatically causes line truncation
(@pxref{Horizontal Scrolling}). You can explicitly enable line
truncation for a particular buffer with the command @kbd{M-x
toggle-truncate-lines}. This works by locally changing the variable
@code{truncate-lines}. If that variable is non-@code{nil}, long lines
are truncated; if it is @code{nil}, they are continued onto multiple
screen lines. Setting the variable @code{truncate-lines} in any way
makes it local to the current buffer; until that time, the default
value, which is normally @code{nil}, is in effect.
truncation for a particular buffer with the command @kbd{C-x x t}
(@code{toggle-truncate-lines}). This works by locally changing the
variable @code{truncate-lines}. If that variable is non-@code{nil},
long lines are truncated; if it is @code{nil}, they are continued onto
multiple screen lines. Setting the variable @code{truncate-lines} in
any way makes it local to the current buffer; until that time, the
default value, which is normally @code{nil}, is in effect.
If a split window becomes too narrow, Emacs may automatically enable
line truncation. @xref{Split Window}, for the variable

View File

@ -703,13 +703,13 @@ copy-to-buffer} is similar, except that any existing text in the other
buffer is deleted, so the buffer is left containing just the text newly
copied into it.
The command @kbd{M-x insert-buffer} can be used to retrieve the
accumulated text from another buffer. This prompts for the name of a
buffer, and inserts a copy of all the text in that buffer into the
current buffer at point, leaving point at the beginning of the
inserted text. It also adds the position of the end of the inserted
text to the mark ring, without activating the mark. @xref{Buffers},
for background information on buffers.
The command @kbd{C-x x i} (@code{insert-buffer}) can be used to
retrieve the accumulated text from another buffer. This prompts for
the name of a buffer, and inserts a copy of all the text in that
buffer into the current buffer at point, leaving point at the
beginning of the inserted text. It also adds the position of the end
of the inserted text to the mark ring, without activating the mark.
@xref{Buffers}, for background information on buffers.
Instead of accumulating text in a buffer, you can append text
directly into a file with @kbd{M-x append-to-file}. This prompts for

View File

@ -234,7 +234,11 @@ still applies for shorter search strings, which avoids flicker in the
search buffer due to too many matches being highlighted.
+++
** 'revert-buffer' is now bound to 'C-x x g' globally.
** A new keymap for buffer actions has been added.
The 'C-x x' keymap now holds keystrokes for various buffer-oriented
commands. The new keystrokes are 'C-x x g' ('revert-buffer'),
'C-x x r' ('rename-buffer'), 'C-x x u' ('rename-uniquely'),
'C-x x i' ('insert-buffer') and 'C-x x t' ('toggle-truncate-lines').
* Editing Changes in Emacs 28.1

View File

@ -1416,6 +1416,10 @@ if `inhibit-field-text-motion' is non-nil."
(defvar ctl-x-x-map
(let ((map (make-sparse-keymap)))
(define-key map "g" #'revert-buffer)
(define-key map "r" #'rename-buffer)
(define-key map "u" #'rename-uniquely)
(define-key map "i" #'insert-buffer)
(define-key map "t" #'toggle-truncate-lines)
map)
"Keymap for subcommands of C-x x.")
(define-key ctl-x-map "x" ctl-x-x-map)