[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
master 7b235b1: Allow storing buffer names in registers
From: |
Lars Ingebrigtsen |
Subject: |
master 7b235b1: Allow storing buffer names in registers |
Date: |
Tue, 30 Nov 2021 09:17:44 -0500 (EST) |
branch: master
commit 7b235b1ec05c48d70ea44982f04b7b5f4052fa05
Author: Lars Ingebrigtsen <larsi@gnus.org>
Commit: Lars Ingebrigtsen <larsi@gnus.org>
Allow storing buffer names in registers
* doc/emacs/regs.texi (File and Buffer Registers): Rename and add
doc for `buffer' version.
* lisp/register.el (register-val-jump-to, register-val-describe):
Add support for (buffer . ...) registers (bug#33033).
---
doc/emacs/emacs.texi | 16 ++++++++--------
doc/emacs/regs.texi | 30 ++++++++++++++++++++----------
etc/NEWS | 9 +++++++++
lisp/register.el | 7 +++++++
4 files changed, 44 insertions(+), 18 deletions(-)
diff --git a/doc/emacs/emacs.texi b/doc/emacs/emacs.texi
index ce92435..dff42c7 100644
--- a/doc/emacs/emacs.texi
+++ b/doc/emacs/emacs.texi
@@ -345,14 +345,14 @@ Cut and Paste Operations on Graphical Displays
Registers
-* Position Registers:: Saving positions in registers.
-* Text Registers:: Saving text in registers.
-* Rectangle Registers:: Saving rectangles in registers.
-* Configuration Registers:: Saving window configurations in registers.
-* Number Registers:: Numbers in registers.
-* File Registers:: File names in registers.
-* Keyboard Macro Registers:: Keyboard macros in registers.
-* Bookmarks:: Bookmarks are like registers, but persistent.
+* Position Registers:: Saving positions in registers.
+* Text Registers:: Saving text in registers.
+* Rectangle Registers:: Saving rectangles in registers.
+* Configuration Registers:: Saving window configurations in registers.
+* Number Registers:: Numbers in registers.
+* File and Buffer Registers:: File and buffer names in registers.
+* Keyboard Macro Registers:: Keyboard macros in registers.
+* Bookmarks:: Bookmarks are like registers, but persistent.
Controlling the Display
diff --git a/doc/emacs/regs.texi b/doc/emacs/regs.texi
index 59fa0ff..df1eec0 100644
--- a/doc/emacs/regs.texi
+++ b/doc/emacs/regs.texi
@@ -47,14 +47,14 @@ are similar in spirit to registers, so they are also
documented in
this chapter.
@menu
-* Position Registers:: Saving positions in registers.
-* Text Registers:: Saving text in registers.
-* Rectangle Registers:: Saving rectangles in registers.
-* Configuration Registers:: Saving window configurations in registers.
-* Number Registers:: Numbers in registers.
-* File Registers:: File names in registers.
-* Keyboard Macro Registers:: Keyboard macros in registers.
-* Bookmarks:: Bookmarks are like registers, but persistent.
+* Position Registers:: Saving positions in registers.
+* Text Registers:: Saving text in registers.
+* Rectangle Registers:: Saving rectangles in registers.
+* Configuration Registers:: Saving window configurations in registers.
+* Number Registers:: Numbers in registers.
+* File and Buffer Registers:: File and buffer names in registers.
+* Keyboard Macro Registers:: Keyboard macros in registers.
+* Bookmarks:: Bookmarks are like registers, but persistent.
@end menu
@node Position Registers
@@ -238,9 +238,10 @@ register contents into the buffer. @kbd{C-x r +} with no
numeric
argument increments the register value by 1; @kbd{C-x r n} with no
numeric argument stores zero in the register.
-@node File Registers
-@section Keeping File Names in Registers
+@node File and Buffer Registers
+@section Keeping File and Buffer Names in Registers
@cindex saving file name in a register
+@cindex saving buffer name in a register
If you visit certain file names frequently, you can visit them more
conveniently if you put their names in registers. Here's the Lisp code
@@ -265,6 +266,15 @@ puts the file name shown in register @samp{z}.
@var{r}}. (This is the same command used to jump to a position or
restore a frame configuration.)
+ Similarly, if there's certain buffers you visit frequently, you
+can put their names in registers. For instance, if you visit the
+@samp{*Messages*} buffer often, you can use the following snippet to
+put that buffer into the @samp{m} register:
+
+@smallexample
+(set-register ?m '(buffer . "*Messages*"))
+@end smallexample
+
@node Keyboard Macro Registers
@section Keyboard Macro Registers
@cindex saving keyboard macro in a register
diff --git a/etc/NEWS b/etc/NEWS
index 1ca5c86..dba5ed9 100644
--- a/etc/NEWS
+++ b/etc/NEWS
@@ -295,6 +295,15 @@ received.
* Changes in Specialized Modes and Packages in Emacs 29.1
+** Registers
+
++++
+*** Buffer names can now be stored in registers.
+For instance, to enable jumping to the *Messages* buffer with
+`C-x r j m':
+
+ (set-register ?m '(buffer . "*Messages*"))
+
** pixel-fill
*** This is a new package that deals with filling variable-pitch text.
diff --git a/lisp/register.el b/lisp/register.el
index e48a09f..38ee87c 100644
--- a/lisp/register.el
+++ b/lisp/register.el
@@ -279,6 +279,8 @@ ARG is the value of the prefix argument or nil."
(goto-char (cadr val)))
((eq (car val) 'file)
(find-file (cdr val)))
+ ((eq (car val) 'buffer)
+ (switch-to-buffer (cdr val)))
((eq (car val) 'file-query)
(or (find-buffer-visiting (nth 1 val))
(y-or-n-p (format "Visit file %s again? " (nth 1 val)))
@@ -417,6 +419,11 @@ Interactively, reads the register using
`register-read-with-preview'."
(prin1 (cdr val))
(princ "."))
+ ((eq (car val) 'buffer)
+ (princ "the buffer ")
+ (prin1 (cdr val))
+ (princ "."))
+
((eq (car val) 'file-query)
(princ "a file-query reference:\n file ")
(prin1 (car (cdr val)))
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- master 7b235b1: Allow storing buffer names in registers,
Lars Ingebrigtsen <=