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

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[nongnu] scratch/rfc-mode 8587416c21 40/52: Add prefix argument support


From: Stefan Monnier
Subject: [nongnu] scratch/rfc-mode 8587416c21 40/52: Add prefix argument support to rfc-mode-read
Date: Wed, 12 Oct 2022 16:29:20 -0400 (EDT)

branch: scratch/rfc-mode
commit 8587416c2123dd4dd1a7c2bc9207205e47e9b54a
Author: Daniel Martín <mardani29@yahoo.es>
Commit: Nicolas Martyanoff <khaelin@gmail.com>

    Add prefix argument support to rfc-mode-read
    
    It's common for Emacs commands that prompt for a numeric argument in
    the minibuffer to also support reading that numeric argument via a
    prefix argument. (See `goto-char`, for example.).
    
    * rfc-mode.el (rfc-mode-read): Read a prefix numeric argument and use
    it as the "number" argument; prompt in the minibuffer if no prefix
    argument was used.
    * changelog.org (Features): Advertise the change.
---
 changelog.org | 5 +++++
 rfc-mode.el   | 5 ++++-
 2 files changed, 9 insertions(+), 1 deletion(-)

diff --git a/changelog.org b/changelog.org
index d2199ad363..a4809a476c 100644
--- a/changelog.org
+++ b/changelog.org
@@ -2,6 +2,11 @@
 
 * Next Version
 
+** Features
+
+- ~rfc-mode-read~ now supports a numeric prefix argument, so you can
+  simply type ~C-u 1 2 3 4 M-x rfc-mode-read~ to read RFC number 1234.
+
 * 1.3.0
 This release improves navigation and introduce section detection, thanks to
 Daniel Martín.
diff --git a/rfc-mode.el b/rfc-mode.el
index 50d0030e5f..326dfe0761 100644
--- a/rfc-mode.el
+++ b/rfc-mode.el
@@ -199,7 +199,10 @@ Returns t if section is found, nil otherwise."
 ;;;###autoload
 (defun rfc-mode-read (number)
   "Read the RFC document NUMBER."
-  (interactive "nRFC number: ")
+  (interactive
+   (if (and current-prefix-arg (not (consp current-prefix-arg)))
+       (list (prefix-numeric-value current-prefix-arg))
+     (list (read-number "RFC number: "))))
   (display-buffer (rfc-mode--document-buffer number)))
 
 (defun rfc-mode-reload-index ()



reply via email to

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