branch: elpa/rfc-mode
commit 2d3dcd649e291eeb93091560b504f96162371c32
Author: AndrĂªs <[email protected]>
Commit: Nicolas Martyanoff <[email protected]>

    Add command to manually update RFC index
    
    This introduces `rfc-mode-update-index`, allowing users to
    explicitly re-download the RFC index file.
---
 rfc-mode.el | 19 +++++++++++++++++++
 1 file changed, 19 insertions(+)

diff --git a/rfc-mode.el b/rfc-mode.el
index 8c60f40c729..4798101ebfb 100644
--- a/rfc-mode.el
+++ b/rfc-mode.el
@@ -240,6 +240,16 @@ Offer the number at point as default."
   (interactive)
   (setq rfc-mode-index-entries nil))
 
+;;;###autoload
+(defun rfc-mode-update-index ()
+  "Force download and rebuild of the RFC index."
+  (interactive)
+  (message "Updating RFC index...")
+  (let ((file (rfc-mode--download-index)))
+    (setq rfc-mode-index-entries
+          (rfc-mode-read-index-file file)))
+  (message "RFC index updated successfully."))
+
 (defun rfc-mode--index-entries ()
   (or rfc-mode-index-entries
       (let ((file (rfc-mode--document-file "-index")))
@@ -411,6 +421,15 @@ ENTRY is a RFC index entry in the browser."
 
 ;;; Index utils:
 
+
+(defun rfc-mode--download-index ()
+  "Download the RFC index file and return its local filename."
+  (let ((file (rfc-mode--document-file "-index")))
+    ;; Force re-download by deleting existing file first
+    (when (file-exists-p file)
+      (delete-file file))
+    (rfc-mode--document-file "-index")))
+
 (defun rfc-mode-read-index-file (filename)
   "Read an RFC index file at FILENAME and return a list of entries."
   (with-temp-buffer

Reply via email to