+(defun elpher-menu-refresh-current ()
+ "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
+ (vector
+ (cond ((eq major-mode 'elpher-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 '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 'eww-mode)
+ (plist-get eww-data :title))))))
+
+(defun elpher-menu-refresh-history ()
+ "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."
+ (let ((separator (list (current-buffer)
+ (vector
+ "E"
+ (make-string 25 ?-)
+ (make-string 25 ?-)))))
+ (if (eq major-mode 'elpher-mode)
+ ;; every section starts with the current page and ends with
+ ;; the separator
+ (mapcar (lambda (page)
+ (if page
+ (list (current-buffer)
+ (vector
+ "E"
+ (or (elpher-address-to-url
+ (elpher-page-address page)) "none")
+ (or (elpher-page-display-string page) "?")))
+ separator))
+ (cons elpher-current-page elpher-history))
+ (nconc (mapcar (lambda (data)
+ (list (current-buffer)
+ (vector
+ "W"
+ (plist-get data :url)
+ (plist-get data :title))))
+ (cons eww-data eww-history))
+ (list separator)))))
+