WIP: org-remark

This commit is contained in:
Max Schlueter 2024-02-10 18:38:57 +01:00
parent ec3c516deb
commit 24f8d78e58
2 changed files with 101 additions and 8 deletions

View File

@ -59,7 +59,12 @@
(package! org-clock-convenience) (package! org-clock-convenience)
(package! org-super-agenda) (package! org-super-agenda)
(package! org-caldav) (package! org-caldav)
;;; Roam
;;
(package! org-transclusion) (package! org-transclusion)
(package! org-remark)
;; org-roam-ui keeps up with the latest features in org-roam ;; org-roam-ui keeps up with the latest features in org-roam
(unpin! org-roam) (unpin! org-roam)
@ -71,19 +76,13 @@
(package! jl-encrypt (package! jl-encrypt
:recipe (:host gitlab :repo "lechten/defaultencrypt")) :recipe (:host gitlab :repo "lechten/defaultencrypt"))
;; (package! mu4e-alert)
;; (package! clip2org) ;; (package! clip2org)
(package! centered-cursor-mode) (package! centered-cursor-mode)
;; (package! counsel-tramp) ;; (package! counsel-tramp)
;; (package! org-capture-pop-frame)
(package! org-caldav)
;; XXX https://github.com/alphapapa/org-protocol-capture-html/issues/40
;; (package! org-protocol-capture-html)
(package! ob-typescript) (package! ob-typescript)
(package! indium) (package! indium)
;; (package! mac-pseudo-daemon) ;; (package! mac-pseudo-daemon)
;; (package! nix-docbook-mode) ;; (package! nix-docbook-mode)
(package! base16-theme)
(package! pdf-tools :built-in 'prefer) (package! pdf-tools :built-in 'prefer)
(package! nov) (package! nov)
;; (package! org-gtd) ;; (package! org-gtd)
@ -96,5 +95,5 @@
:files (:defaults "bin"))) :files (:defaults "bin")))
;; https://github.com/doomemacs/doomemacs/issues/7196 ;; https://github.com/doomemacs/doomemacs/issues/7196
(unpin! evil-collection) ;; (unpin! evil-collection)
(package! evil-collection :recipe (:repo "emacs-evil/evil-collection" :branch "master")) ;; (package! evil-collection :recipe (:repo "emacs-evil/evil-collection" :branch "master"))

94
roam.el
View File

@ -102,5 +102,99 @@
:prefix "n" :prefix "n"
:desc "Org Transclusion Mode" "t" #'org-transclusion-mode)) :desc "Org Transclusion Mode" "t" #'org-transclusion-mode))
(defun my/org-remark-notes-file-name-function ()
(cond ((buffer-file-name)
(let ((source-filename (org-remark-source-find-file-name)))
(when (and (stringp source-filename)
(file-exists-p source-filename))
(concat (file-name-sans-extension
(file-name-nondirectory source-filename))
"-notes.org"))))
((eq major-mode 'eww-mode)
(my/org-remark-eww--create-capture-note eww-data))))
(defun my/org-remark-eww--create-capture-note (info)
"Open or create org-roam node from `eww-data'."
;; (let* ((title (plist-get eww-data :title))
;; (ref (plist-get eww-data :url)))
(org-roam-capture-
;; :keys (plist-get info :template)
:node (org-roam-node-create :title (plist-get info :title))
:info (list :ref (plist-get info :url))
;; :body (plist-get info :body))
:templates '(("r" "reference" plain "%?"
:target (file+head "${slug}.org"
"#+title: ${title}")
:immediate-finish t
:unnarrowed t))))
;; :templates org-roam-capture-ref-templates))
;; (apply 'org-roam-capture-
;; :info (setq infoplist
;; ;; Add notetitle in case someone wants to use it in their
;; ;; capture template.
;; (plist-put infoplist :note-title notetitle))
;; :info (list )
;; :node (org-roam-node-create :title title)
;; :props '(:finalize find-file)
;; (if templatekey
;; (list :keys templatekey)
;; (list
;; :templates
;; '(("r" "reference" plain "%?" :if-new
;; (file+head
;; "%(concat
;; (when citar-org-roam-subdir (concat citar-org-roam-subdir \"/\")) \"${citar-citekey}.org\")"
;; "#+title: ${note-title}\n")
;; :immediate-finish t
;; :unnarrowed t)))))
;; (org-roam-ref-add url)))
;; (org-roam-capture-
;; :keys (plist-get info :template)
;; :node (org-roam-node-create :title (plist-get info :title))
;; :info (list :ref (plist-get info :ref)
;; :body (plist-get info :body))
;; :templates org-roam-capture-ref-templates))
;; (use-package! org-remark
;; :after org
;; :init
;; (require 'org-remark-global-tracking)
;; (org-remark-global-tracking-mode +1)
;; (map! "C-c n m" #'org-remark-mark)
;; :config
;; (map! :map org-remark-mode-map
;; "C-c n o" #'org-remark-open
;; "C-c n ]" #'org-remark-view-next
;; "C-c n [" #'org-remark-view-prev
;; "C-c n R" #'org-remark-remove))
(use-package! org-remark
:bind (;; :bind keyword also implicitly defers org-remark itself.
;; Keybindings before :map is set for global-map.
("C-c n m" . org-remark-mark)
("C-c n l" . org-remark-mark-line)
:map org-remark-mode-map
("C-c n o" . org-remark-open)
("C-c n ]" . org-remark-view-next)
("C-c n [" . org-remark-view-prev)
("C-c n r" . org-remark-remove)
("C-c n d" . org-remark-delete))
;; Alternative way to enable `org-remark-global-tracking-mode' in
;; `after-init-hook'.
;; :hook (after-init . org-remark-global-tracking-mode)
:init
;; It is recommended that `org-remark-global-tracking-mode' be
;; enabled when Emacs initializes. Alternatively, you can put it to
;; `after-init-hook' as in the comment above
(org-remark-global-tracking-mode +1)
:config
(setq org-remark-notes-file-name #'my/org-remark-notes-file-name-function)
(use-package org-remark-info :after info :config (org-remark-info-mode +1))
(use-package org-remark-eww :after eww :config (org-remark-eww-mode +1))
(use-package org-remark-nov :after nov :config (org-remark-nov-mode +1)))
(after! org-roam-bibtex (after! org-roam-bibtex
(setq orb-insert-link-description 'citekey)) (setq orb-insert-link-description 'citekey))