Skip to content

Commit

Permalink
mode/annotate: Fix show-annotations-for-current-url.
Browse files Browse the repository at this point in the history
  • Loading branch information
Ambrevar committed Sep 13, 2022
1 parent 438f502 commit 3c750e0
Showing 1 changed file with 10 additions and 4 deletions.
14 changes: 10 additions & 4 deletions source/mode/annotate.lisp
Original file line number Diff line number Diff line change
Expand Up @@ -135,15 +135,21 @@ make-instance."
collect (:div (:raw (render annotation))
(:hr)))))

(define-internal-page-command-global show-annotations-for-current-url
(&key (source-buffer (current-buffer)))
(buffer "*Annotations*")
(define-internal-page show-annotations-for-current-url (&key (id (id (current-buffer))))
(:title "*Annotations*")
"Create a new buffer with the annotations of the current URL of BUFFER."
(let ((annotations (files:content (annotations-file buffer))))
(let ((source-buffer (nyxt::buffers-get id))
(annotations (files:content (annotations-file buffer))))
(let ((filtered-annotations (sera:filter (alex:curry #'url-equal (url source-buffer))
annotations :key #'url)))
(render-annotations filtered-annotations))))

(define-command-global show-annotations-for-current-url (&key (buffer (current-buffer)))
"Create a new buffer with the annotations of the current URL of BUFFER."
(set-current-buffer
(buffer-load (nyxt-url 'show-annotations-for-current-url :id (id buffer))
:buffer (ensure-internal-page-buffer 'show-annotations-for-current-url))))

(define-class annotation-source (prompter:source)
((prompter:name "Annotations")
(prompter:constructor (files:content (annotations-file (current-buffer))))
Expand Down

0 comments on commit 3c750e0

Please sign in to comment.