diff options
| author | Augusto Stoffel <arstoffel@gmail.com> | 2025-10-12 16:37:30 +0200 |
|---|---|---|
| committer | Augusto Stoffel <arstoffel@gmail.com> | 2025-10-12 16:37:30 +0200 |
| commit | a0a40cc7b0a4ed37bd146cd03737fb426863787c (patch) | |
| tree | 1b18686786ea8b97e5b7ce017a99e9a682212735 | |
| parent | 87102d9f20b442a0e36b6af9e0207500b903cad5 (diff) | |
Simplify definition of bookmarks entries
Also, make handler a named function due to Emacs bug#79618.
| -rw-r--r-- | devdocs.el | 30 |
1 files changed, 18 insertions, 12 deletions
@@ -495,20 +495,26 @@ Interactively, read a page name with completion." :active (car devdocs--forward-stack) :help "Return from a previously displayed documentation entry"])) +(defun devdocs--bookmark-handler (bm) + "Display DevDocs location of bookmark BM." + (declare-function bookmark-prop-get "bookmark") + (pop-to-buffer + (devdocs-goto-page + (bookmark-prop-get bm 'devdocs-doc) + (bookmark-prop-get bm 'devdocs-path)))) + (defun devdocs--make-bookmark () "This implements the `bookmark-make-record-function' type for a devdocs page." - (let-alist (or (car devdocs--stack) (user-error "Not in a DevDocs buffer")) - (let* ((title (concat .doc.slug "/" .path))) - (cons (concat "devdocs/" title) - `((defaults . (,title)) - (devdocs-doc . ,.doc) - (devdocs-path . ,.path) - (buf . "*devdocs*") - (handler . ,(lambda (bmk) - (pop-to-buffer - (devdocs-goto-page - (bookmark-prop-get bmk 'devdocs-doc) - (bookmark-prop-get bmk 'devdocs-path)))))))))) + (let-alist (or (car devdocs--stack) + (user-error "Not in a DevDocs buffer")) + `((defaults ,(concat .doc.slug "/" .path)) + (devdocs-doc . ,.doc) + (devdocs-path . ,.path) + (filename . ,(format-mode-line devdocs-header-line + nil nil + (current-buffer))) + (buf . "*devdocs*") + (handler . devdocs--bookmark-handler)))) ;;; HTML rendering |
