emacs-elpa-diffs
[Top][All Lists]
Advanced

[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:
 



reply via email to

[Prev in Thread] Current Thread [Next in Thread]