Add Gemini Mode to the menu
[elpher.git] / elpher.el
index 943b569..dc83212 100644 (file)
--- a/elpher.el
+++ b/elpher.el
@@ -2008,7 +2008,7 @@ functions which initialize the gopher client, namely
 (defun elpher-menu (&optional arg)
   "Show a list of all your `elpher' buffers.
 With an optional argument, add all the history items, too."
-  (interactive)
+  (interactive "P")
   (switch-to-buffer (get-buffer-create "*Elpher Menu*"))
   (elpher-menu-mode)
   (elpher-menu-refresh arg)
@@ -2158,12 +2158,10 @@ With an optional argument, add all the history items, too."
     (let (entries)
       (dolist (buf (buffer-list))
        (with-current-buffer buf
-         (when (memq major-mode '(elpher-mode eww-mode))
-           (setq entries
-                 (nconc (if arg
-                            (elpher-menu-refresh-current)
-                          (elpher-menu-refresh-history))
-                        entries)))))
+         (when (memq major-mode '(elpher-mode eww-mode gemini-mode))
+           (if arg
+               (setq entries (nconc (elpher-menu-refresh-history) entries))
+             (push (elpher-menu-refresh-current) entries)))))
       (setq tabulated-list-entries (nreverse entries)))
     (tabulated-list-init-header))
 
@@ -2171,19 +2169,27 @@ With an optional argument, add all the history items, too."
   "Return current entries for `elpher-menu-refresh'.
 If we're only interested in the current entries, then this
 function can only return a list of a single item per buffer."
-  (list buf
+  (list (current-buffer)
        (vector
-        (cond ((eq major-mode 'elpher-mode) "E")
+        (cond ((eq major-mode 'elpher-mode) "G")
+              ((eq major-mode 'gemini-mode) "E")
               ((eq major-mode 'eww-mode) "W"))
         (cond ((eq major-mode 'elpher-mode)
                (or (elpher-address-to-url
                     (elpher-page-address elpher-current-page))
                    "none"))
+              ((eq major-mode 'gemini-mode)
+               (or (elpher-address-to-url
+                    (elpher-page-address elpher-current-page))
+                   "none"))
               ((eq major-mode 'eww-mode)
                (eww-current-url)))
         (cond ((eq major-mode 'elpher-mode)
                (or (elpher-find-title)
                    (elpher-page-display-string elpher-current-page)))
+              ((eq major-mode 'gemini-mode)
+               (or (elpher-page-display-string elpher-current-page)
+                   (buffer-name)))
               ((eq major-mode 'eww-mode)
                (plist-get eww-data :title))))))