From 315bea54005e568f37e08a2f73fe34c8574c5421 Mon Sep 17 00:00:00 2001 From: Vedang Manerikar <ved.manerikar@gmail.com> Date: Thu, 12 Dec 2024 22:01:25 +0530 Subject: [PATCH] Create an unravel-study module For `pdf-tools`, `denote`, `org-remark` and `org-fc`. This is my study pack, without which I don't get anything done. --- .gitignore | 1 + init.el | 1 + unravel-emacs.org | 688 ++++++++++++++++++------------- unravel-modules/unravel-langs.el | 222 ---------- unravel-modules/unravel-org.el | 5 +- unravel-modules/unravel-study.el | 283 +++++++++++++ 6 files changed, 687 insertions(+), 513 deletions(-) create mode 100644 unravel-modules/unravel-study.el diff --git a/.gitignore b/.gitignore index 013765d..886f433 100644 --- a/.gitignore +++ b/.gitignore @@ -17,3 +17,4 @@ bookmarks url/ elpaca/ tree-sitter/ +.mc-lists.el diff --git a/init.el b/init.el index 2444747..4819444 100644 --- a/init.el +++ b/init.el @@ -120,6 +120,7 @@ making an abbreviation to a function." (require 'unravel-org) (require 'unravel-shell) (require 'unravel-langs) +(require 'unravel-study) ;;; Comment this next line if you don't want to use my personal ;;; settings (like specific directories or org variables) (require 'vedang-personal) diff --git a/unravel-emacs.org b/unravel-emacs.org index 891211b..6053e39 100644 --- a/unravel-emacs.org +++ b/unravel-emacs.org @@ -454,6 +454,7 @@ Now we are ready to load our per-module configuration files: (require 'unravel-org) (require 'unravel-shell) (require 'unravel-langs) + (require 'unravel-study) ;;; Comment this next line if you don't want to use my personal ;;; settings (like specific directories or org variables) (require 'vedang-personal) @@ -3766,8 +3767,9 @@ on how I use Org. (use-package org :ensure nil :init - (when (getenv "ORG_DIRECTORY") - (setq org-directory (expand-file-name (getenv "ORG_DIRECTORY")))) + (let ((dir (string-trim (shell-command-to-string "echo $ORG_DIRECTORY")))) + (when (not (string-empty-p dir)) + (setq org-directory (expand-file-name dir)))) (setq org-imenu-depth 7) (add-to-list 'safe-local-variable-values '(org-hide-leading-stars . t)) @@ -4946,292 +4948,6 @@ Use the entry point ~M-x dictionary-search~ dictionary-use-single-buffer t)) #+end_src -** The =unravel-langs.el= settings for ~denote~ (notes and file-naming) -:PROPERTIES: -:CUSTOM_ID: h:e86a66dc-7ef9-4f09-ad7e-946de2034e8d -:END: - -By default, Denote looks for files in the =~/Documents/notes/= directory. If you want to use a location other than the default localtion for your ~denote~ files, set the environment variable ~DENOTE_DIRECTORY~. - -#+begin_quote -This is another one of my packages and is extended by my -~consult-denote~ package ([[#h:ee82e629-fb05-4c75-9175-48a760a25691][The =unravel-langs.el= integration between Consult and Denote (~consult-denote~)]]). - -Denote is a simple note-taking tool for Emacs. It is based on the idea -that notes should follow a predictable and descriptive file-naming -scheme. The file name must offer a clear indication of what the note is -about, without reference to any other metadata. Denote basically -streamlines the creation of such files while providing facilities to -link between them. - -Denote's file-naming scheme is not limited to "notes". It can be used -for all types of file, including those that are not editable in Emacs, -such as videos. Naming files in a consistent way makes their -filtering and retrieval considerably easier. Denote provides relevant -facilities to rename files, regardless of file type. -#+end_quote - -Prot is the developer and maintainer of this package. - -+ Package name (GNU ELPA): ~denote~ -+ Official manual: <https://protesilaos.com/emacs/denote> -+ Change log: <https://protesilaos.com/emacs/denote-changelog> -+ Git repositories: - - GitHub: <https://github.com/protesilaos/denote> - - GitLab: <https://gitlab.com/protesilaos/denote> -+ Video demo: <https://protesilaos.com/codelog/2022-06-18-denote-demo/> -+ Backronyms: Denote Everything Neatly; Omit The Excesses. Don't Ever - Note Only The Epiphenomenal. - -#+begin_src emacs-lisp :tangle "unravel-modules/unravel-langs.el" - ;;; Denote (simple note-taking and file-naming) - - ;; Read the manual: <https://protesilaos.com/emacs/denote>. This does - ;; not include all the useful features of Denote. I have a separate - ;; private setup for those, as I need to test everything is in order. - (use-package denote - :ensure t - :hook - ;; If you use Markdown or plain text files you want to fontify links - ;; upon visiting the file (Org renders links as buttons right away). - ((text-mode . denote-fontify-links-mode-maybe) - - ;; Highlight Denote file names in Dired buffers. Below is the - ;; generic approach, which is great if you rename files Denote-style - ;; in lots of places as I do. - ;; - ;; If you only want the `denote-dired-mode' in select directories, - ;; then modify the variable `denote-dired-directories' and use the - ;; following instead: - ;; - ;; (dired-mode . denote-dired-mode-in-directories) - (dired-mode . denote-dired-mode)) - :bind - ;; Denote DOES NOT define any key bindings. This is for the user to - ;; decide. Here I only have a subset of what Denote offers. - ( :map global-map - ("C-c d n" . denote-create-note) - ("C-c d N" . denote-silo-extras-select-silo-then-command) - ("C-c d o" . denote-open-or-create) - ("C-c d O" . denote-silo-extras-open-or-create) - ("C-c d l" . denote-link-or-create) - ("C-c d L" . denote-link-after-creating-with-command) - ;; Note that `denote-rename-file' can work from any context, not - ;; just Dired buffers. That is why we bind it here to the - ;; `global-map'. - ;; - ;; Also see `denote-rename-file-using-front-matter' further below. - ("C-c d r" . denote-rename-file) - ;; If you intend to use Denote with a variety of file types, it is - ;; easier to bind the link-related commands to the `global-map', as - ;; shown here. Otherwise follow the same pattern for - ;; `org-mode-map', `markdown-mode-map', and/or `text-mode-map'. - ("C-c d j" . denote-journal-extras-new-entry) - ("C-c d s" . denote-sort-dired) - :map text-mode-map - ("C-c d B" . denote-backlinks) - ("C-c d b" . denote-find-backlink) - ;; Also see `denote-rename-file' further above. - ("C-c d R" . denote-rename-file-using-front-matter) - ("C-c d k" . denote-rename-file-keywords) - :map org-mode-map - ("C-c d h" . denote-org-extras-link-to-heading) - ("C-c d d l" . denote-org-extras-dblock-insert-links) - ("C-c d d b" . denote-org-extras-dblock-insert-backlinks) - ("C-c d d m" . denote-org-extras-dblock-insert-missing-links) - ;; Key bindings specifically for Dired. - :map dired-mode-map - ("C-c C-d C-i" . denote-dired-link-marked-notes) - ("C-c C-d C-r" . denote-dired-rename-marked-files) - ("C-c C-d C-k" . denote-dired-rename-marked-files-with-keywords) - ("C-c C-d C-A" . denote-dired-rename-marked-files-add-keywords) - ("C-c C-d C-K" . denote-dired-rename-marked-files-remove-keywords) - ("C-c C-d C-f" . denote-dired-rename-marked-files-using-front-matter)) - :config - (require 'denote-silo-extras) - (require 'denote-journal-extras) - (require 'denote-org-extras) - - ;; Remember to check the doc strings of those variables. - (when (getenv "DENOTE_DIRECTORY") - (setq denote-directory (expand-file-name (getenv "DENOTE_DIRECTORY")))) - (setq denote-infer-keywords t) - (setq denote-sort-keywords t) - (setq denote-excluded-directories-regexp "data") ; external data related to headings is stored in these directories (web archives) - (setq denote-date-format nil) ; read its doc string - (setq denote-date-prompt-use-org-read-date t) - (setq denote-prompts '(title keywords subdirectory signature)) - - (setq denote-rename-confirmations nil) ; CAREFUL with this if you are not familiar with Denote! - (setq denote-save-buffers t) - (setq denote-rename-buffer-format "[D] %s %t%b") - ;; Automatically rename Denote buffers when opening them so that - ;; instead of their long file name they have a literal "[D]" - ;; followed by the file's title. Read the doc string of - ;; `denote-rename-buffer-format' for how to modify this. - (denote-rename-buffer-mode 1) - - (setq denote-buffer-has-backlinks-string " (<--->)") - (setq denote-backlinks-show-context t) - (setq denote-org-store-link-to-heading t) - - ;; Journal settings - (setq denote-journal-extras-keyword "") - - ;; I use Yasnippet to expand these into a better template. - (add-to-list 'denote-templates '(reference-note . "reference")) - (add-to-list 'denote-templates '(morning . "morningpage")) - (add-to-list 'denote-templates '(emotion . "emotion")) - (add-to-list 'denote-templates '(insight . "insight")) - (add-to-list 'denote-templates '(weekly_intentions . "weekint")) - (add-to-list 'denote-templates '(weekly_report . "weekrpt")) - (add-to-list 'denote-templates '(sketch . "sketch")) - - ;; Front-matter for Org files - (setq denote-org-front-matter - ":PROPERTIES: - :ID: %4$s - :CREATED: %2$s - :END: - ,#+title: %1$s - ,#+filetags: %3$s - ,#+date: %2$s - ,#+identifier: %4$s - \n")) - - (defun vedang/denote-publishing-extras-new-blog-entry (&optional date) - "Create a new blog entry. - - With optional DATE as a prefix argument, prompt for a date. If - `denote-date-prompt-use-org-read-date' is non-nil, use the Org - date selection module. - - When called from Lisp DATE is a string and has the same format as - that covered in the documentation of the `denote' function. It - is internally processed by `denote-parse-date'." - (interactive (list (when current-prefix-arg (denote-date-prompt)))) - (let ((internal-date (denote-parse-date date)) - (denote-directory (file-name-as-directory (expand-file-name "published" denote-directory)))) - (denote - (denote-title-prompt) - '("draft") - nil nil date - ;; See YASnippet - "fullblog"))) - - (defun vedang/denote-publishing-extras-new-microblog-entry (&optional date) - "Create a new microblog entry. - Set the title of the new entry according to the value of the user option - `denote-journal-extras-title-format'. - - With optional DATE as a prefix argument, prompt for a date. If - `denote-date-prompt-use-org-read-date' is non-nil, use the Org - date selection module. - - When called from Lisp DATE is a string and has the same format as - that covered in the documentation of the `denote' function. It - is internally processed by `denote-parse-date'." - (interactive (list (when current-prefix-arg (denote-date-prompt)))) - (let ((internal-date (denote-parse-date date)) - (denote-directory (file-name-as-directory (expand-file-name "published" denote-directory)))) - (denote - (denote-journal-extras-daily--title-format internal-date) - '("draft" "microblog") - nil nil date - ;; See YASnippet - "microblog"))) - - (defun vedang/denote-link-ol-get-id () - "Get the CUSTOM_ID of the current entry. - - If the entry already has a CUSTOM_ID, return it as-is, else create a new - one. - - If we are creating a new ID, add a CREATED property with the current - timestamp as well. - - This function is based on `denote-link-ol-get-id', with minor - modifications." - (interactive) - (let* ((pos (point)) - (id (org-entry-get pos "CUSTOM_ID")) - (created (org-entry-get pos "CREATED"))) - (if (and (stringp id) (string-match-p "\\S-" id)) - id - (setq id (org-id-new "h")) - (org-entry-put pos "CUSTOM_ID" id)) - (when (not created) - (setq created (format-time-string (org-time-stamp-format t t) (current-time))) - (org-entry-put pos "CREATED" created)) - id)) - - (defun vedang/denote--split-luhman-sig (signature) - "Split numbers and letters in Luhmann-style SIGNATURE string." - (replace-regexp-in-string - "\\([a-zA-Z]+?\\)\\([0-9]\\)" "\\1=\\2" - (replace-regexp-in-string - "\\([0-9]+?\\)\\([a-zA-Z]\\)" "\\1=\\2" - signature))) - - (defun vedang/denote--pad-sig (signature) - "Create a new signature with padded spaces for all components" - (combine-and-quote-strings - (mapcar - (lambda (x) - (string-pad x 5 32 t)) - (split-string (vedang/denote--split-luhman-sig signature) "=" t)) - "=")) - - (defun vedang/denote-sort-for-signatures (sig1 sig2) - "Return non-nil if SIG1 is smaller that SIG2. - - Perform the comparison with `string<'." - (string< (vedang/denote--pad-sig sig1) (vedang/denote--pad-sig sig2))) - - (use-package denote - :ensure t - :bind - ( :map global-map - ;; Bindings to personal functions (defined above) - ("C-c d p m" . vedang/denote-publishing-extras-new-microblog-entry) - ("C-c d p b" . vedang/denote-publishing-extras-new-blog-entry)) - :config - (setq denote-sort-signature-comparison-function #'vedang/denote-sort-for-signatures)) -#+end_src - -*** The =unravel-langs.el= integration between Consult and Denote (~consult-denote~) -:PROPERTIES: -:CUSTOM_ID: h:ee82e629-fb05-4c75-9175-48a760a25691 -:END: - -#+begin_quote -This is another package of mine which extends my ~denote~ package -([[#h:e86a66dc-7ef9-4f09-ad7e-946de2034e8d][The =unravel-langs.el= settings for ~denote~ (notes and file-naming)]]). - -This is glue code to integrate ~denote~ with Daniel Mendler's -~consult~ ([[#h:22e97b4c-d88d-4deb-9ab3-f80631f9ff1d][The =unravel-completion.el= settings for ~consult~]]). The -idea is to enhance minibuffer interactions, such as by providing a -preview of the file-to-linked/opened and by adding more sources to the -~consult-buffer~ command. -#+end_quote - -Prot is the developer of this package. - -+ Package name (GNU ELPA): ~consult-denote~ -+ Official manual: not available yet. -+ Git repositories: - + GitHub: <https://github.com/protesilaos/consult-denote> - -#+begin_src emacs-lisp :tangle "unravel-modules/unravel-langs.el" - (use-package consult-denote - :ensure t - :bind - (("C-c d f" . consult-denote-find) - ("C-c d g" . consult-denote-grep)) - :config - (consult-denote-mode 1)) -#+end_src - ** The =unravel-langs.el= settings for ~paredit~ (paren matching) :PROPERTIES: :CUSTOM_ID: h:885F9DED-E9C9-4B5B-9FE0-1A33CBD23126 @@ -5454,6 +5170,400 @@ Clojure is my favorite programming language, and it has been my bread and butter (provide 'unravel-langs) #+end_src +* The =unravel-study.el= module +:PROPERTIES: +:CUSTOM_ID: h:FE49DE29-DF99-450C-B6E8-AD64D877C518 +:CREATED: [2024-12-12 Thu 21:27] +:END: + +This file contains configuration for everything I use to make Emacs my go-to place for studying anything. + +** The =unravel-study.el= section for ~denote~ (notes and file-naming) +:PROPERTIES: +:CUSTOM_ID: h:e86a66dc-7ef9-4f09-ad7e-946de2034e8d +:CREATED: [2024-12-12 Thu 21:33] +:END: + +Denote is my goto tool for any and all note-taking. This is what powers my brain forest, and where anything and everything I write starts from. + +By default, Denote looks for files in the =~/Documents/notes/= directory. If you want to use a location other than the default localtion for your ~denote~ files, set the environment variable ~DENOTE_DIRECTORY~. + +#+begin_quote +This is another one of my packages and is extended by my +~consult-denote~ package ([[#h:ee82e629-fb05-4c75-9175-48a760a25691][The =unravel-study.el= integration between Consult and Denote (~consult-denote~)]]). + +Denote is a simple note-taking tool for Emacs. It is based on the idea +that notes should follow a predictable and descriptive file-naming +scheme. The file name must offer a clear indication of what the note is +about, without reference to any other metadata. Denote basically +streamlines the creation of such files while providing facilities to +link between them. + +Denote's file-naming scheme is not limited to "notes". It can be used +for all types of file, including those that are not editable in Emacs, +such as videos. Naming files in a consistent way makes their +filtering and retrieval considerably easier. Denote provides relevant +facilities to rename files, regardless of file type. +#+end_quote + +Prot is the developer and maintainer of this package. + ++ Package name (GNU ELPA): ~denote~ ++ Official manual: <https://protesilaos.com/emacs/denote> ++ Change log: <https://protesilaos.com/emacs/denote-changelog> ++ Git repositories: + - GitHub: <https://github.com/protesilaos/denote> + - GitLab: <https://gitlab.com/protesilaos/denote> ++ Video demo: <https://protesilaos.com/codelog/2022-06-18-denote-demo/> ++ Backronyms: Denote Everything Neatly; Omit The Excesses. Don't Ever + Note Only The Epiphenomenal. + +#+begin_src emacs-lisp :tangle "unravel-modules/unravel-study.el" :mkdirp yes + ;;; Denote (simple note-taking and file-naming) + + ;; Read the manual: <https://protesilaos.com/emacs/denote>. This does + ;; not include all the useful features of Denote. I have a separate + ;; private setup for those, as I need to test everything is in order. + (use-package denote + :ensure t + :hook + ;; If you use Markdown or plain text files you want to fontify links + ;; upon visiting the file (Org renders links as buttons right away). + ((text-mode . denote-fontify-links-mode-maybe) + + ;; Highlight Denote file names in Dired buffers. Below is the + ;; generic approach, which is great if you rename files Denote-style + ;; in lots of places as I do. + ;; + ;; If you only want the `denote-dired-mode' in select directories, + ;; then modify the variable `denote-dired-directories' and use the + ;; following instead: + ;; + ;; (dired-mode . denote-dired-mode-in-directories) + (dired-mode . denote-dired-mode)) + :bind + ;; Denote DOES NOT define any key bindings. This is for the user to + ;; decide. Here I only have a subset of what Denote offers. + ( :map global-map + ("C-c d n" . denote-create-note) + ("C-c d N" . denote-silo-extras-select-silo-then-command) + ("C-c d o" . denote-open-or-create) + ("C-c d O" . denote-silo-extras-open-or-create) + ("C-c d l" . denote-link-or-create) + ("C-c d L" . denote-link-after-creating-with-command) + ;; Note that `denote-rename-file' can work from any context, not + ;; just Dired buffers. That is why we bind it here to the + ;; `global-map'. + ;; + ;; Also see `denote-rename-file-using-front-matter' further below. + ("C-c d r" . denote-rename-file) + ;; If you intend to use Denote with a variety of file types, it is + ;; easier to bind the link-related commands to the `global-map', as + ;; shown here. Otherwise follow the same pattern for + ;; `org-mode-map', `markdown-mode-map', and/or `text-mode-map'. + ("C-c d j" . denote-journal-extras-new-entry) + ("C-c d s" . denote-sort-dired) + :map text-mode-map + ("C-c d B" . denote-backlinks) + ("C-c d b" . denote-find-backlink) + ;; Also see `denote-rename-file' further above. + ("C-c d R" . denote-rename-file-using-front-matter) + ("C-c d k" . denote-rename-file-keywords) + :map org-mode-map + ("C-c d h" . denote-org-extras-link-to-heading) + ("C-c d d l" . denote-org-extras-dblock-insert-links) + ("C-c d d b" . denote-org-extras-dblock-insert-backlinks) + ("C-c d d m" . denote-org-extras-dblock-insert-missing-links) + ;; Key bindings specifically for Dired. + :map dired-mode-map + ("C-c C-d C-i" . denote-dired-link-marked-notes) + ("C-c C-d C-r" . denote-dired-rename-marked-files) + ("C-c C-d C-k" . denote-dired-rename-marked-files-with-keywords) + ("C-c C-d C-A" . denote-dired-rename-marked-files-add-keywords) + ("C-c C-d C-K" . denote-dired-rename-marked-files-remove-keywords) + ("C-c C-d C-f" . denote-dired-rename-marked-files-using-front-matter)) + :config + (require 'denote-silo-extras) + (require 'denote-journal-extras) + (require 'denote-org-extras) + + ;; Remember to check the doc strings of those variables. + (let ((dir (string-trim (shell-command-to-string "echo $DENOTE_DIRECTORY")))) + (when (not (string-empty-p dir)) + (setq denote-directory (expand-file-name dir)))) + (setq denote-infer-keywords t) + (setq denote-sort-keywords t) + (setq denote-excluded-directories-regexp "data") ; external data related to headings is stored in these directories (web archives) + (setq denote-date-format nil) ; read its doc string + (setq denote-date-prompt-use-org-read-date t) + (setq denote-prompts '(title keywords subdirectory signature)) + + (setq denote-rename-confirmations nil) ; CAREFUL with this if you are not familiar with Denote! + (setq denote-save-buffers t) + (setq denote-rename-buffer-format "[D] %s %t%b") + ;; Automatically rename Denote buffers when opening them so that + ;; instead of their long file name they have a literal "[D]" + ;; followed by the file's title. Read the doc string of + ;; `denote-rename-buffer-format' for how to modify this. + (denote-rename-buffer-mode 1) + + (setq denote-buffer-has-backlinks-string " (<--->)") + (setq denote-backlinks-show-context t) + (setq denote-org-store-link-to-heading t) + + ;; Journal settings + (setq denote-journal-extras-keyword "") + + ;; I use Yasnippet to expand these into a better template. + (add-to-list 'denote-templates '(reference-note . "reference")) + (add-to-list 'denote-templates '(morning . "morningpage")) + (add-to-list 'denote-templates '(emotion . "emotion")) + (add-to-list 'denote-templates '(insight . "insight")) + (add-to-list 'denote-templates '(weekly_intentions . "weekint")) + (add-to-list 'denote-templates '(weekly_report . "weekrpt")) + (add-to-list 'denote-templates '(sketch . "sketch")) + + ;; Front-matter for Org files + (setq denote-org-front-matter + ":PROPERTIES: + :ID: %4$s + :CREATED: %2$s + :END: + ,#+title: %1$s + ,#+filetags: %3$s + ,#+date: %2$s + ,#+identifier: %4$s + \n")) + + (defun vedang/denote-publishing-extras-new-blog-entry (&optional date) + "Create a new blog entry. + + With optional DATE as a prefix argument, prompt for a date. If + `denote-date-prompt-use-org-read-date' is non-nil, use the Org + date selection module. + + When called from Lisp DATE is a string and has the same format as + that covered in the documentation of the `denote' function. It + is internally processed by `denote-parse-date'." + (interactive (list (when current-prefix-arg (denote-date-prompt)))) + (let ((internal-date (denote-parse-date date)) + (denote-directory (file-name-as-directory (expand-file-name "published" denote-directory)))) + (denote + (denote-title-prompt) + '("draft") + nil nil date + ;; See YASnippet + "fullblog"))) + + (defun vedang/denote-publishing-extras-new-microblog-entry (&optional date) + "Create a new microblog entry. + Set the title of the new entry according to the value of the user option + `denote-journal-extras-title-format'. + + With optional DATE as a prefix argument, prompt for a date. If + `denote-date-prompt-use-org-read-date' is non-nil, use the Org + date selection module. + + When called from Lisp DATE is a string and has the same format as + that covered in the documentation of the `denote' function. It + is internally processed by `denote-parse-date'." + (interactive (list (when current-prefix-arg (denote-date-prompt)))) + (let ((internal-date (denote-parse-date date)) + (denote-directory (file-name-as-directory (expand-file-name "published" denote-directory)))) + (denote + (denote-journal-extras-daily--title-format internal-date) + '("draft" "microblog") + nil nil date + ;; See YASnippet + "microblog"))) + + (defun vedang/denote-link-ol-get-id () + "Get the CUSTOM_ID of the current entry. + + If the entry already has a CUSTOM_ID, return it as-is, else create a new + one. + + If we are creating a new ID, add a CREATED property with the current + timestamp as well. + + This function is based on `denote-link-ol-get-id', with minor + modifications." + (interactive) + (let* ((pos (point)) + (id (org-entry-get pos "CUSTOM_ID")) + (created (org-entry-get pos "CREATED"))) + (if (and (stringp id) (string-match-p "\\S-" id)) + id + (setq id (org-id-new "h")) + (org-entry-put pos "CUSTOM_ID" id)) + (when (not created) + (setq created (format-time-string (org-time-stamp-format t t) (current-time))) + (org-entry-put pos "CREATED" created)) + id)) + + (defun vedang/denote--split-luhman-sig (signature) + "Split numbers and letters in Luhmann-style SIGNATURE string." + (replace-regexp-in-string + "\\([a-zA-Z]+?\\)\\([0-9]\\)" "\\1=\\2" + (replace-regexp-in-string + "\\([0-9]+?\\)\\([a-zA-Z]\\)" "\\1=\\2" + signature))) + + (defun vedang/denote--pad-sig (signature) + "Create a new signature with padded spaces for all components" + (combine-and-quote-strings + (mapcar + (lambda (x) + (string-pad x 5 32 t)) + (split-string (vedang/denote--split-luhman-sig signature) "=" t)) + "=")) + + (defun vedang/denote-sort-for-signatures (sig1 sig2) + "Return non-nil if SIG1 is smaller that SIG2. + + Perform the comparison with `string<'." + (string< (vedang/denote--pad-sig sig1) (vedang/denote--pad-sig sig2))) + + (use-package denote + :ensure t + :bind + ( :map global-map + ;; Bindings to personal functions (defined above) + ("C-c d p m" . vedang/denote-publishing-extras-new-microblog-entry) + ("C-c d p b" . vedang/denote-publishing-extras-new-blog-entry)) + :config + (setq denote-sort-signature-comparison-function #'vedang/denote-sort-for-signatures)) +#+end_src + +*** The =unravel-study.el= integration between Consult and Denote (~consult-denote~) +:PROPERTIES: +:CUSTOM_ID: h:ee82e629-fb05-4c75-9175-48a760a25691 +:END: + +#+begin_quote +This is another package of mine which extends my ~denote~ package +([[#h:e86a66dc-7ef9-4f09-ad7e-946de2034e8d][The =unravel-study.el= settings for ~denote~ (notes and file-naming)]]). + +This is glue code to integrate ~denote~ with Daniel Mendler's +~consult~ ([[#h:22e97b4c-d88d-4deb-9ab3-f80631f9ff1d][The =unravel-completion.el= settings for ~consult~]]). The +idea is to enhance minibuffer interactions, such as by providing a +preview of the file-to-linked/opened and by adding more sources to the +~consult-buffer~ command. +#+end_quote + +Prot is the developer of this package. + ++ Package name (GNU ELPA): ~consult-denote~ ++ Official manual: not available yet. ++ Git repositories: + + GitHub: <https://github.com/protesilaos/consult-denote> + +#+begin_src emacs-lisp :tangle "unravel-modules/unravel-study.el" + (use-package consult-denote + :ensure t + :bind + (("C-c d f" . consult-denote-find) + ("C-c d g" . consult-denote-grep)) + :config + (consult-denote-mode 1)) +#+end_src + + +** The =unravel-study.el= section for ~pdf-tools~ (reading and annotation of PDFs) +:PROPERTIES: +:CUSTOM_ID: h:B662EABD-DC46-468A-BF59-E67AC48D2DDA +:CREATED: [2024-12-12 Thu 21:35] +:END: + +PDF Tools is an absolute powerhouse for reading and annotating PDF files. It is my goto tool for reading any academic papers. + +#+begin_src emacs-lisp :tangle "unravel-modules/unravel-study.el" + ;;; PDF Tools for reading and annotating PDF files + (use-package pdf-tools + :ensure (:host github :repo "vedang/pdf-tools" :branch "master") + :config + (pdf-tools-install)) +#+end_src + +** The =unravel-study.el= section for ~org-remark~ (annotation of org and eww files) +:PROPERTIES: +:CUSTOM_ID: h:814EC9C8-3182-4B86-ADD9-123096D144D4 +:CREATED: [2024-12-12 Thu 21:40] +:END: + +#+begin_src emacs-lisp :tangle "unravel-modules/unravel-study.el" + ;;; org-remark for annotating org and eww files + (use-package org-remark + :ensure t + :init + (setq org-remark-create-default-pen-set nil) + :bind + ( :map global-map + ("C-c r m" . org-remark-mark) + :map org-remark-mode-map + ("C-c r e" . org-remark-mark-review) + ("C-c r i" . org-remark-mark-important) + ("C-c r o" . org-remark-open) + ("C-c r n" . org-remark-view-next) + ("C-c r p" . org-remark-view-prev) + ("C-c r r" . org-remark-remove) + ("C-c r d" . org-remark-delete) + ("C-c r s" . org-remark-save) + ("C-c r t" . org-remark-toggle) + ("C-c r v" . org-remark-view)) + :config + (defun vm/org-remark-notes () + (expand-file-name "brain/marginalia.org" org-directory)) + (setq org-remark-notes-file-name #'vm/org-remark-notes) + ;; Create a pen set for specific kinds of highlights. NOTE: This + ;; pen-set has been made for dark themes. + + ;; Creates `org-remark-mark-review' + (org-remark-create "review" + ;; face: `dired-flagged' + '(:underline (:color "dark red" :style wave) :foreground "#f7143a") + '(CATEGORY "review" help-echo "Review this")) + + ;; Creates `org-remark-mark-important' + (org-remark-create "important" + ;; face: `dired-broken-symlink' + '(:underline "gold" :background "red1" :foreground "yellow1" :weight bold) + '(CATEGORY "important")) + + (set-face-bold 'org-remark-highlighter t) + + (with-eval-after-load 'eww + (org-remark-eww-mode +1)) + (with-eval-after-load 'info + (org-remark-info-mode +1)) + (with-eval-after-load 'nov + (org-remark-nov-mode +1))) +#+end_src + +** The =unravel-study.el= section for ~org-fc~ (flashcards) +:PROPERTIES: +:CUSTOM_ID: h:C63AE939-4082-4763-B0A4-A736869B7B41 +:CREATED: [2024-12-12 Thu 21:45] +:END: + +#+begin_src emacs-lisp :tangle "unravel-modules/unravel-study.el" + (use-package org-fc + :ensure (:host github :repo "l3kn/org-fc" :branch "main") + :ensure-system-package (gawk) + :config + (setq org-fc-directories `(,(concat org-directory "/notes/")))) +#+end_src + +** Finally, we provide the =unravel-study.el= module +:PROPERTIES: +:CUSTOM_ID: h:13AF346B-1721-47FC-87A9-16EEB7818521 +:CREATED: [2024-12-12 Thu 22:09] +:END: + +#+begin_src emacs-lisp :tangle "unravel-modules/unravel-study.el" + (provide 'unravel-study) +#+end_src + * Custom libraries ** The =prot-common.el= library :PROPERTIES: @@ -6655,7 +6765,7 @@ I use the incredible ledger-mode for all my personal finance tracking :ensure t) #+end_src -*** Finally, we provide the =unravel-langs.el= module +*** Finally, we provide the =vedang-personal.el= module :PROPERTIES: :CUSTOM_ID: h:29100A9B-3142-4458-8CE1-43798EB9AA13 :CREATED: [2024-12-05 Thu 16:47] diff --git a/unravel-modules/unravel-langs.el b/unravel-modules/unravel-langs.el index 03d6117..5eb78bc 100644 --- a/unravel-modules/unravel-langs.el +++ b/unravel-modules/unravel-langs.el @@ -127,228 +127,6 @@ dictionary-create-buttons nil dictionary-use-single-buffer t)) -;;; Denote (simple note-taking and file-naming) - -;; Read the manual: <https://protesilaos.com/emacs/denote>. This does -;; not include all the useful features of Denote. I have a separate -;; private setup for those, as I need to test everything is in order. -(use-package denote - :ensure t - :hook - ;; If you use Markdown or plain text files you want to fontify links - ;; upon visiting the file (Org renders links as buttons right away). - ((text-mode . denote-fontify-links-mode-maybe) - - ;; Highlight Denote file names in Dired buffers. Below is the - ;; generic approach, which is great if you rename files Denote-style - ;; in lots of places as I do. - ;; - ;; If you only want the `denote-dired-mode' in select directories, - ;; then modify the variable `denote-dired-directories' and use the - ;; following instead: - ;; - ;; (dired-mode . denote-dired-mode-in-directories) - (dired-mode . denote-dired-mode)) - :bind - ;; Denote DOES NOT define any key bindings. This is for the user to - ;; decide. Here I only have a subset of what Denote offers. - ( :map global-map - ("C-c d n" . denote-create-note) - ("C-c d N" . denote-silo-extras-select-silo-then-command) - ("C-c d o" . denote-open-or-create) - ("C-c d O" . denote-silo-extras-open-or-create) - ("C-c d l" . denote-link-or-create) - ("C-c d L" . denote-link-after-creating-with-command) - ;; Note that `denote-rename-file' can work from any context, not - ;; just Dired buffers. That is why we bind it here to the - ;; `global-map'. - ;; - ;; Also see `denote-rename-file-using-front-matter' further below. - ("C-c d r" . denote-rename-file) - ;; If you intend to use Denote with a variety of file types, it is - ;; easier to bind the link-related commands to the `global-map', as - ;; shown here. Otherwise follow the same pattern for - ;; `org-mode-map', `markdown-mode-map', and/or `text-mode-map'. - ("C-c d j" . denote-journal-extras-new-entry) - ("C-c d s" . denote-sort-dired) - :map text-mode-map - ("C-c d B" . denote-backlinks) - ("C-c d b" . denote-find-backlink) - ;; Also see `denote-rename-file' further above. - ("C-c d R" . denote-rename-file-using-front-matter) - ("C-c d k" . denote-rename-file-keywords) - :map org-mode-map - ("C-c d h" . denote-org-extras-link-to-heading) - ("C-c d d l" . denote-org-extras-dblock-insert-links) - ("C-c d d b" . denote-org-extras-dblock-insert-backlinks) - ("C-c d d m" . denote-org-extras-dblock-insert-missing-links) - ;; Key bindings specifically for Dired. - :map dired-mode-map - ("C-c C-d C-i" . denote-dired-link-marked-notes) - ("C-c C-d C-r" . denote-dired-rename-marked-files) - ("C-c C-d C-k" . denote-dired-rename-marked-files-with-keywords) - ("C-c C-d C-A" . denote-dired-rename-marked-files-add-keywords) - ("C-c C-d C-K" . denote-dired-rename-marked-files-remove-keywords) - ("C-c C-d C-f" . denote-dired-rename-marked-files-using-front-matter)) - :config - (require 'denote-silo-extras) - (require 'denote-journal-extras) - (require 'denote-org-extras) - - ;; Remember to check the doc strings of those variables. - (when (getenv "DENOTE_DIRECTORY") - (setq denote-directory (expand-file-name (getenv "DENOTE_DIRECTORY")))) - (setq denote-infer-keywords t) - (setq denote-sort-keywords t) - (setq denote-excluded-directories-regexp "data") ; external data related to headings is stored in these directories (web archives) - (setq denote-date-format nil) ; read its doc string - (setq denote-date-prompt-use-org-read-date t) - (setq denote-prompts '(title keywords subdirectory signature)) - - (setq denote-rename-confirmations nil) ; CAREFUL with this if you are not familiar with Denote! - (setq denote-save-buffers t) - (setq denote-rename-buffer-format "[D] %s %t%b") - ;; Automatically rename Denote buffers when opening them so that - ;; instead of their long file name they have a literal "[D]" - ;; followed by the file's title. Read the doc string of - ;; `denote-rename-buffer-format' for how to modify this. - (denote-rename-buffer-mode 1) - - (setq denote-buffer-has-backlinks-string " (<--->)") - (setq denote-backlinks-show-context t) - (setq denote-org-store-link-to-heading t) - - ;; Journal settings - (setq denote-journal-extras-keyword "") - - ;; I use Yasnippet to expand these into a better template. - (add-to-list 'denote-templates '(reference-note . "reference")) - (add-to-list 'denote-templates '(morning . "morningpage")) - (add-to-list 'denote-templates '(emotion . "emotion")) - (add-to-list 'denote-templates '(insight . "insight")) - (add-to-list 'denote-templates '(weekly_intentions . "weekint")) - (add-to-list 'denote-templates '(weekly_report . "weekrpt")) - (add-to-list 'denote-templates '(sketch . "sketch")) - - ;; Front-matter for Org files - (setq denote-org-front-matter - ":PROPERTIES: -:ID: %4$s -:CREATED: %2$s -:END: -#+title: %1$s -#+filetags: %3$s -#+date: %2$s -#+identifier: %4$s -\n")) - -(defun vedang/denote-publishing-extras-new-blog-entry (&optional date) - "Create a new blog entry. - - With optional DATE as a prefix argument, prompt for a date. If - `denote-date-prompt-use-org-read-date' is non-nil, use the Org - date selection module. - - When called from Lisp DATE is a string and has the same format as - that covered in the documentation of the `denote' function. It - is internally processed by `denote-parse-date'." - (interactive (list (when current-prefix-arg (denote-date-prompt)))) - (let ((internal-date (denote-parse-date date)) - (denote-directory (file-name-as-directory (expand-file-name "published" denote-directory)))) - (denote - (denote-title-prompt) - '("draft") - nil nil date - ;; See YASnippet - "fullblog"))) - -(defun vedang/denote-publishing-extras-new-microblog-entry (&optional date) - "Create a new microblog entry. - Set the title of the new entry according to the value of the user option - `denote-journal-extras-title-format'. - - With optional DATE as a prefix argument, prompt for a date. If - `denote-date-prompt-use-org-read-date' is non-nil, use the Org - date selection module. - - When called from Lisp DATE is a string and has the same format as - that covered in the documentation of the `denote' function. It - is internally processed by `denote-parse-date'." - (interactive (list (when current-prefix-arg (denote-date-prompt)))) - (let ((internal-date (denote-parse-date date)) - (denote-directory (file-name-as-directory (expand-file-name "published" denote-directory)))) - (denote - (denote-journal-extras-daily--title-format internal-date) - '("draft" "microblog") - nil nil date - ;; See YASnippet - "microblog"))) - -(defun vedang/denote-link-ol-get-id () - "Get the CUSTOM_ID of the current entry. - -If the entry already has a CUSTOM_ID, return it as-is, else create a new -one. - -If we are creating a new ID, add a CREATED property with the current -timestamp as well. - -This function is based on `denote-link-ol-get-id', with minor -modifications." - (interactive) - (let* ((pos (point)) - (id (org-entry-get pos "CUSTOM_ID")) - (created (org-entry-get pos "CREATED"))) - (if (and (stringp id) (string-match-p "\\S-" id)) - id - (setq id (org-id-new "h")) - (org-entry-put pos "CUSTOM_ID" id)) - (when (not created) - (setq created (format-time-string (org-time-stamp-format t t) (current-time))) - (org-entry-put pos "CREATED" created)) - id)) - -(defun vedang/denote--split-luhman-sig (signature) - "Split numbers and letters in Luhmann-style SIGNATURE string." - (replace-regexp-in-string - "\\([a-zA-Z]+?\\)\\([0-9]\\)" "\\1=\\2" - (replace-regexp-in-string - "\\([0-9]+?\\)\\([a-zA-Z]\\)" "\\1=\\2" - signature))) - -(defun vedang/denote--pad-sig (signature) - "Create a new signature with padded spaces for all components" - (combine-and-quote-strings - (mapcar - (lambda (x) - (string-pad x 5 32 t)) - (split-string (vedang/denote--split-luhman-sig signature) "=" t)) - "=")) - -(defun vedang/denote-sort-for-signatures (sig1 sig2) - "Return non-nil if SIG1 is smaller that SIG2. - - Perform the comparison with `string<'." - (string< (vedang/denote--pad-sig sig1) (vedang/denote--pad-sig sig2))) - -(use-package denote - :ensure t - :bind - ( :map global-map - ;; Bindings to personal functions (defined above) - ("C-c d p m" . vedang/denote-publishing-extras-new-microblog-entry) - ("C-c d p b" . vedang/denote-publishing-extras-new-blog-entry)) - :config - (setq denote-sort-signature-comparison-function #'vedang/denote-sort-for-signatures)) - -(use-package consult-denote - :ensure t - :bind - (("C-c d f" . consult-denote-find) - ("C-c d g" . consult-denote-grep)) - :config - (consult-denote-mode 1)) - (use-package paredit :ensure t :bind ( :map paredit-mode-map diff --git a/unravel-modules/unravel-org.el b/unravel-modules/unravel-org.el index e132c78..29ac1ef 100644 --- a/unravel-modules/unravel-org.el +++ b/unravel-modules/unravel-org.el @@ -49,8 +49,9 @@ (use-package org :ensure nil :init - (when (getenv "ORG_DIRECTORY") - (setq org-directory (expand-file-name (getenv "ORG_DIRECTORY")))) + (let ((dir (string-trim (shell-command-to-string "echo $ORG_DIRECTORY")))) + (when (not (string-empty-p dir)) + (setq org-directory (expand-file-name dir)))) (setq org-imenu-depth 7) (add-to-list 'safe-local-variable-values '(org-hide-leading-stars . t)) diff --git a/unravel-modules/unravel-study.el b/unravel-modules/unravel-study.el new file mode 100644 index 0000000..1594921 --- /dev/null +++ b/unravel-modules/unravel-study.el @@ -0,0 +1,283 @@ +;;; Denote (simple note-taking and file-naming) + +;; Read the manual: <https://protesilaos.com/emacs/denote>. This does +;; not include all the useful features of Denote. I have a separate +;; private setup for those, as I need to test everything is in order. +(use-package denote + :ensure t + :hook + ;; If you use Markdown or plain text files you want to fontify links + ;; upon visiting the file (Org renders links as buttons right away). + ((text-mode . denote-fontify-links-mode-maybe) + + ;; Highlight Denote file names in Dired buffers. Below is the + ;; generic approach, which is great if you rename files Denote-style + ;; in lots of places as I do. + ;; + ;; If you only want the `denote-dired-mode' in select directories, + ;; then modify the variable `denote-dired-directories' and use the + ;; following instead: + ;; + ;; (dired-mode . denote-dired-mode-in-directories) + (dired-mode . denote-dired-mode)) + :bind + ;; Denote DOES NOT define any key bindings. This is for the user to + ;; decide. Here I only have a subset of what Denote offers. + ( :map global-map + ("C-c d n" . denote-create-note) + ("C-c d N" . denote-silo-extras-select-silo-then-command) + ("C-c d o" . denote-open-or-create) + ("C-c d O" . denote-silo-extras-open-or-create) + ("C-c d l" . denote-link-or-create) + ("C-c d L" . denote-link-after-creating-with-command) + ;; Note that `denote-rename-file' can work from any context, not + ;; just Dired buffers. That is why we bind it here to the + ;; `global-map'. + ;; + ;; Also see `denote-rename-file-using-front-matter' further below. + ("C-c d r" . denote-rename-file) + ;; If you intend to use Denote with a variety of file types, it is + ;; easier to bind the link-related commands to the `global-map', as + ;; shown here. Otherwise follow the same pattern for + ;; `org-mode-map', `markdown-mode-map', and/or `text-mode-map'. + ("C-c d j" . denote-journal-extras-new-entry) + ("C-c d s" . denote-sort-dired) + :map text-mode-map + ("C-c d B" . denote-backlinks) + ("C-c d b" . denote-find-backlink) + ;; Also see `denote-rename-file' further above. + ("C-c d R" . denote-rename-file-using-front-matter) + ("C-c d k" . denote-rename-file-keywords) + :map org-mode-map + ("C-c d h" . denote-org-extras-link-to-heading) + ("C-c d d l" . denote-org-extras-dblock-insert-links) + ("C-c d d b" . denote-org-extras-dblock-insert-backlinks) + ("C-c d d m" . denote-org-extras-dblock-insert-missing-links) + ;; Key bindings specifically for Dired. + :map dired-mode-map + ("C-c C-d C-i" . denote-dired-link-marked-notes) + ("C-c C-d C-r" . denote-dired-rename-marked-files) + ("C-c C-d C-k" . denote-dired-rename-marked-files-with-keywords) + ("C-c C-d C-A" . denote-dired-rename-marked-files-add-keywords) + ("C-c C-d C-K" . denote-dired-rename-marked-files-remove-keywords) + ("C-c C-d C-f" . denote-dired-rename-marked-files-using-front-matter)) + :config + (require 'denote-silo-extras) + (require 'denote-journal-extras) + (require 'denote-org-extras) + + ;; Remember to check the doc strings of those variables. + (let ((dir (string-trim (shell-command-to-string "echo $DENOTE_DIRECTORY")))) + (when (not (string-empty-p dir)) + (setq denote-directory (expand-file-name dir)))) + (setq denote-infer-keywords t) + (setq denote-sort-keywords t) + (setq denote-excluded-directories-regexp "data") ; external data related to headings is stored in these directories (web archives) + (setq denote-date-format nil) ; read its doc string + (setq denote-date-prompt-use-org-read-date t) + (setq denote-prompts '(title keywords subdirectory signature)) + + (setq denote-rename-confirmations nil) ; CAREFUL with this if you are not familiar with Denote! + (setq denote-save-buffers t) + (setq denote-rename-buffer-format "[D] %s %t%b") + ;; Automatically rename Denote buffers when opening them so that + ;; instead of their long file name they have a literal "[D]" + ;; followed by the file's title. Read the doc string of + ;; `denote-rename-buffer-format' for how to modify this. + (denote-rename-buffer-mode 1) + + (setq denote-buffer-has-backlinks-string " (<--->)") + (setq denote-backlinks-show-context t) + (setq denote-org-store-link-to-heading t) + + ;; Journal settings + (setq denote-journal-extras-keyword "") + + ;; I use Yasnippet to expand these into a better template. + (add-to-list 'denote-templates '(reference-note . "reference")) + (add-to-list 'denote-templates '(morning . "morningpage")) + (add-to-list 'denote-templates '(emotion . "emotion")) + (add-to-list 'denote-templates '(insight . "insight")) + (add-to-list 'denote-templates '(weekly_intentions . "weekint")) + (add-to-list 'denote-templates '(weekly_report . "weekrpt")) + (add-to-list 'denote-templates '(sketch . "sketch")) + + ;; Front-matter for Org files + (setq denote-org-front-matter + ":PROPERTIES: +:ID: %4$s +:CREATED: %2$s +:END: +#+title: %1$s +#+filetags: %3$s +#+date: %2$s +#+identifier: %4$s +\n")) + +(defun vedang/denote-publishing-extras-new-blog-entry (&optional date) + "Create a new blog entry. + + With optional DATE as a prefix argument, prompt for a date. If + `denote-date-prompt-use-org-read-date' is non-nil, use the Org + date selection module. + + When called from Lisp DATE is a string and has the same format as + that covered in the documentation of the `denote' function. It + is internally processed by `denote-parse-date'." + (interactive (list (when current-prefix-arg (denote-date-prompt)))) + (let ((internal-date (denote-parse-date date)) + (denote-directory (file-name-as-directory (expand-file-name "published" denote-directory)))) + (denote + (denote-title-prompt) + '("draft") + nil nil date + ;; See YASnippet + "fullblog"))) + +(defun vedang/denote-publishing-extras-new-microblog-entry (&optional date) + "Create a new microblog entry. + Set the title of the new entry according to the value of the user option + `denote-journal-extras-title-format'. + + With optional DATE as a prefix argument, prompt for a date. If + `denote-date-prompt-use-org-read-date' is non-nil, use the Org + date selection module. + + When called from Lisp DATE is a string and has the same format as + that covered in the documentation of the `denote' function. It + is internally processed by `denote-parse-date'." + (interactive (list (when current-prefix-arg (denote-date-prompt)))) + (let ((internal-date (denote-parse-date date)) + (denote-directory (file-name-as-directory (expand-file-name "published" denote-directory)))) + (denote + (denote-journal-extras-daily--title-format internal-date) + '("draft" "microblog") + nil nil date + ;; See YASnippet + "microblog"))) + +(defun vedang/denote-link-ol-get-id () + "Get the CUSTOM_ID of the current entry. + +If the entry already has a CUSTOM_ID, return it as-is, else create a new +one. + +If we are creating a new ID, add a CREATED property with the current +timestamp as well. + +This function is based on `denote-link-ol-get-id', with minor +modifications." + (interactive) + (let* ((pos (point)) + (id (org-entry-get pos "CUSTOM_ID")) + (created (org-entry-get pos "CREATED"))) + (if (and (stringp id) (string-match-p "\\S-" id)) + id + (setq id (org-id-new "h")) + (org-entry-put pos "CUSTOM_ID" id)) + (when (not created) + (setq created (format-time-string (org-time-stamp-format t t) (current-time))) + (org-entry-put pos "CREATED" created)) + id)) + +(defun vedang/denote--split-luhman-sig (signature) + "Split numbers and letters in Luhmann-style SIGNATURE string." + (replace-regexp-in-string + "\\([a-zA-Z]+?\\)\\([0-9]\\)" "\\1=\\2" + (replace-regexp-in-string + "\\([0-9]+?\\)\\([a-zA-Z]\\)" "\\1=\\2" + signature))) + +(defun vedang/denote--pad-sig (signature) + "Create a new signature with padded spaces for all components" + (combine-and-quote-strings + (mapcar + (lambda (x) + (string-pad x 5 32 t)) + (split-string (vedang/denote--split-luhman-sig signature) "=" t)) + "=")) + +(defun vedang/denote-sort-for-signatures (sig1 sig2) + "Return non-nil if SIG1 is smaller that SIG2. + + Perform the comparison with `string<'." + (string< (vedang/denote--pad-sig sig1) (vedang/denote--pad-sig sig2))) + +(use-package denote + :ensure t + :bind + ( :map global-map + ;; Bindings to personal functions (defined above) + ("C-c d p m" . vedang/denote-publishing-extras-new-microblog-entry) + ("C-c d p b" . vedang/denote-publishing-extras-new-blog-entry)) + :config + (setq denote-sort-signature-comparison-function #'vedang/denote-sort-for-signatures)) + +(use-package consult-denote + :ensure t + :bind + (("C-c d f" . consult-denote-find) + ("C-c d g" . consult-denote-grep)) + :config + (consult-denote-mode 1)) + +;;; PDF Tools for reading and annotating PDF files +(use-package pdf-tools + :ensure (:host github :repo "vedang/pdf-tools" :branch "master") + :config + (pdf-tools-install)) + +;;; org-remark for annotating org and eww files +(use-package org-remark + :ensure t + :init + (setq org-remark-create-default-pen-set nil) + :bind + ( :map global-map + ("C-c r m" . org-remark-mark) + :map org-remark-mode-map + ("C-c r e" . org-remark-mark-review) + ("C-c r i" . org-remark-mark-important) + ("C-c r o" . org-remark-open) + ("C-c r n" . org-remark-view-next) + ("C-c r p" . org-remark-view-prev) + ("C-c r r" . org-remark-remove) + ("C-c r d" . org-remark-delete) + ("C-c r s" . org-remark-save) + ("C-c r t" . org-remark-toggle) + ("C-c r v" . org-remark-view)) + :config + (defun vm/org-remark-notes () + (expand-file-name "brain/marginalia.org" org-directory)) + (setq org-remark-notes-file-name #'vm/org-remark-notes) + ;; Create a pen set for specific kinds of highlights. NOTE: This + ;; pen-set has been made for dark themes. + + ;; Creates `org-remark-mark-review' + (org-remark-create "review" + ;; face: `dired-flagged' + '(:underline (:color "dark red" :style wave) :foreground "#f7143a") + '(CATEGORY "review" help-echo "Review this")) + + ;; Creates `org-remark-mark-important' + (org-remark-create "important" + ;; face: `dired-broken-symlink' + '(:underline "gold" :background "red1" :foreground "yellow1" :weight bold) + '(CATEGORY "important")) + + (set-face-bold 'org-remark-highlighter t) + + (with-eval-after-load 'eww + (org-remark-eww-mode +1)) + (with-eval-after-load 'info + (org-remark-info-mode +1)) + (with-eval-after-load 'nov + (org-remark-nov-mode +1))) + +(use-package org-fc + :ensure (:host github :repo "l3kn/org-fc" :branch "main") + :ensure-system-package (gawk) + :config + (setq org-fc-directories `(,(concat org-directory "/notes/")))) + +(provide 'unravel-study)