Skip to content

Commit

Permalink
adds hashtags to @-links.
Browse files Browse the repository at this point in the history
  • Loading branch information
jkitchin committed Sep 17, 2022
1 parent 928c8d6 commit 67efa7f
Showing 1 changed file with 15 additions and 0 deletions.
15 changes: 15 additions & 0 deletions scimax-@-links.el
Expand Up @@ -18,6 +18,7 @@
'(@-links-this-buffer
@-links-org-buffers
@-links-open-files
@-hashtags
@-links-stored-links
@-counsel-recentf-candidates
@-projectile-relevant-known-projects
Expand Down Expand Up @@ -115,12 +116,26 @@ A candidate is a list of (link function)."
candidates)))))
candidates))


(defun open-org-buffers ()
(-filter (lambda (b)
(-when-let (f (buffer-file-name b))
(f-ext? f "org")))
(buffer-list)))


(defun @-hashtags ()
"Get a list of candidate hashtags you have used before."
(let* ((tip (looking-at-hashtag))
(hashtag-data (emacsql org-db [:select [hashtag file-hashtags:begin files:filename]
:from hashtags
:left :join file-hashtags :on (= hashtags:rowid file-hashtags:hashtag-id)
:inner :join files
:on (= files:rowid file-hashtags:filename-id)])))
(-uniq (cl-loop for (hashtag begin fname) in hashtag-data
collect (concat "#" hashtag)))))


(defun @-links-org-buffers ()
"Return candidates in all open org-buffers.
These candidates are to headings by position and by *links."
Expand Down

0 comments on commit 67efa7f

Please sign in to comment.