[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[nongnu] scratch/rfc-mode 91bf9ff561 34/52: Avoid rfc-mode-read replacin
From: |
Stefan Monnier |
Subject: |
[nongnu] scratch/rfc-mode 91bf9ff561 34/52: Avoid rfc-mode-read replacing the current buffer |
Date: |
Wed, 12 Oct 2022 16:29:20 -0400 (EDT) |
branch: scratch/rfc-mode
commit 91bf9ff5618d72339f1467ac3afa52750f4a928a
Author: Daniel Martín <mardani29@yahoo.es>
Commit: Daniel Martín <mardani29@yahoo.es>
Avoid rfc-mode-read replacing the current buffer
This is a typical pattern in Emacs: Documentation commands like help
buffers, man pages, etc. display a buffer in a separate window and do
not make it active, so that users can keep their focus on the current
buffer.
---
rfc-mode.el | 12 ++++++------
1 file changed, 6 insertions(+), 6 deletions(-)
diff --git a/rfc-mode.el b/rfc-mode.el
index 616f0bb6df..67a5c9989a 100644
--- a/rfc-mode.el
+++ b/rfc-mode.el
@@ -166,7 +166,7 @@ Assume RFC documents are named as e.g. rfc21.txt,
rfc-index.txt."
(defun rfc-mode-read (number)
"Read the RFC document NUMBER."
(interactive "nRFC number: ")
- (switch-to-buffer (rfc-mode--document-buffer number)))
+ (display-buffer (rfc-mode--document-buffer number)))
(defun rfc-mode-reload-index ()
"Reload the RFC document index from its original file."
@@ -373,11 +373,11 @@ The buffer is created if it does not exist."
(let* ((buffer-name (rfc-mode--document-buffer-name number))
(document-path (rfc-mode--document-path number)))
(rfc-mode--fetch-document number document-path)
- (find-file document-path)
- (unless rfc-mode-use-original-buffer-names
- (rename-buffer buffer-name))
- (rfc-mode)
- (current-buffer)))
+ (with-current-buffer (find-file-noselect document-path)
+ (unless rfc-mode-use-original-buffer-names
+ (rename-buffer buffer-name))
+ (rfc-mode)
+ (current-buffer))))
;;; Misc utils:
- [nongnu] branch scratch/rfc-mode created (now a734721104), Stefan Monnier, 2022/10/12
- [nongnu] scratch/rfc-mode 5bda3310af 17/52: remove useless groups for custom variables, Stefan Monnier, 2022/10/12
- [nongnu] scratch/rfc-mode 91bf9ff561 34/52: Avoid rfc-mode-read replacing the current buffer,
Stefan Monnier <=
- [nongnu] scratch/rfc-mode b651eac96c 09/52: add repository link to group, Stefan Monnier, 2022/10/12
- [nongnu] scratch/rfc-mode 1ae16d2fb8 35/52: Implement a command to navigate to existing sections, Stefan Monnier, 2022/10/12
- [nongnu] scratch/rfc-mode ff1e3251e9 01/52: initial import, Stefan Monnier, 2022/10/12
- [nongnu] scratch/rfc-mode dc1a3a978f 02/52: improve the readme, Stefan Monnier, 2022/10/12
- [nongnu] scratch/rfc-mode 3719b9ce9f 20/52: derive rfc-mode from text-mode, Stefan Monnier, 2022/10/12
- [nongnu] scratch/rfc-mode 821a039ae6 18/52: autoload rfc-mode-read, Stefan Monnier, 2022/10/12
- [nongnu] scratch/rfc-mode 355f25ee2a 31/52: Add commands to move to the previous/next RFC section, Stefan Monnier, 2022/10/12
- [nongnu] scratch/rfc-mode a3a58e9883 15/52: better section title detection, Stefan Monnier, 2022/10/12
- [nongnu] scratch/rfc-mode 55c0c24f9b 28/52: Make rfc-mode inherit from special-mode, Stefan Monnier, 2022/10/12
- [nongnu] scratch/rfc-mode e037a7ce5c 33/52: Add Tab and S-Tab to navigate through RFC button links, Stefan Monnier, 2022/10/12