aboutsummaryrefslogtreecommitdiffstats
path: root/doc
diff options
context:
space:
mode:
authorBarra Ó Catháin2024-09-24 14:19:55 +0100
committerEli Zaretskii2024-10-05 13:06:49 +0300
commit048e72a403e22dc394b265c6ff290b8d40e806a5 (patch)
treec622c02f37ba60369766b0f9c6f0c59b49ab8a6e /doc
parent364801fcd66d8e93a900fd750a998f4590d85397 (diff)
downloademacs-048e72a403e22dc394b265c6ff290b8d40e806a5.tar.gz
emacs-048e72a403e22dc394b265c6ff290b8d40e806a5.zip
Add file/buffer-to-register (Bug#73308)
* doc/emacs/regs.texi (File and Buffer Registers): Update documentation to refer to 'file-to-register' and 'buffer-to-register'. * etc/NEWS: Announce the new commands. * lisp/bindings.el (ctl-x-r-map): Map new commands into the register keymap. * lisp/register.el (register-command-info): Register new commands. (jump-to-register): Remove docstring line referring to using set-register instead of new commands. (file-to-register): Add function for storing files in registers. (buffer-to-register): Add function for storing buffers in registers. (register-buffer-to-file-query): Add function for converting buffer registers to file-query registers on killing a buffer.
Diffstat (limited to 'doc')
-rw-r--r--doc/emacs/regs.texi65
1 files changed, 32 insertions, 33 deletions
diff --git a/doc/emacs/regs.texi b/doc/emacs/regs.texi
index 734d704a272..df3c22742b6 100644
--- a/doc/emacs/regs.texi
+++ b/doc/emacs/regs.texi
@@ -290,40 +290,39 @@ numeric argument stores zero in the register.
290@cindex saving file name in a register 290@cindex saving file name in a register
291@cindex saving buffer name in a register 291@cindex saving buffer name in a register
292 292
293 If you visit certain file names frequently, you can visit them more 293@table @kbd
294conveniently if you put their names in registers. Here's the Lisp code 294@item C-x r F @var{r}
295used to put a file @var{name} into register @var{r}: 295Store the currently visited file or directory in register
296 296@var{r} (@code{file-to-register}).
297@smallexample 297@item C-x r B @var{r}
298(set-register @var{r} '(file . @var{name})) 298Store the currently visited buffer in register
299@end smallexample 299@var{r} (@code{buffer-to-register}).
300 300@end table
301@need 3000
302@noindent
303For example,
304
305@smallexample
306(set-register ?z '(file . "/gd/gnu/emacs/19.0/src/ChangeLog"))
307@end smallexample
308
309@noindent
310puts the file name shown in register @samp{z}.
311
312 To visit the file whose name is in register @var{r}, type @kbd{C-x r j
313@var{r}}. (This is the same command used to jump to a position or
314restore a frame configuration.)
315
316 Similarly, if there are certain buffers you visit frequently, you
317can put their names in registers. For instance, if you visit the
318@samp{*Messages*} buffer often, you can use the following snippet to
319put that buffer into the @samp{m} register:
320
321@smallexample
322(set-register ?m '(buffer . "*Messages*"))
323@end smallexample
324 301
325 To switch to the buffer whose name is in register @var{r}, type 302If you visit certain files or buffers frequently, you can visit them
326@kbd{C-x r j @var{r}}. 303more conveniently if you put their names in registers.
304
305@kindex C-x r F
306@findex file-to-register
307 Typing @kbd{C-x r F} (@code{file-to-register}), followed by a
308character @kbd{@var{r}}, saves a reference to the currently visited file
309in register @var{r}. You can then visit the file using
310@code{jump-to-register} by typing @kbd{C-x r j} @var{r}. With a prefix
311argument, @code{file-to-register} prompts for a file name to store in
312the register.
313
314@kindex C-x r B
315@findex buffer-to-register
316 Typing @kbd{C-x r B} (@code{buffer-to-register}), followed by a
317character @kbd{@var{r}}, saves a reference to the currently visited buffer
318in register @var{r}. You can then revisit the buffer using
319@code{jump-to-register}. With a prefix argument, @code{buffer-to-register}
320prompts for a buffer name to store in the register.
321
322 If you store a buffer name which is visiting a file in a
323register, and the buffer is then closed, the register is automatically
324converted to a file reference, allowing you to quickly re-open the
325closed file.
327 326
328@node Keyboard Macro Registers 327@node Keyboard Macro Registers
329@section Keyboard Macro Registers 328@section Keyboard Macro Registers