remove denote
This commit is contained in:
parent
af51a6f39b
commit
0e8ba5b408
4 changed files with 7 additions and 541 deletions
320
nebkor-emacs.org
320
nebkor-emacs.org
|
@ -61,7 +61,6 @@
|
||||||
- [[#the-nebkor-essentialsel-section-about-using-tree-sitter-for-marking-expreg][The =nebkor-essentials.el= section about using tree-sitter for marking (~expreg~)]]
|
- [[#the-nebkor-essentialsel-section-about-using-tree-sitter-for-marking-expreg][The =nebkor-essentials.el= section about using tree-sitter for marking (~expreg~)]]
|
||||||
- [[#the-nebkor-essentialsel-section-for-osx-changes][The =nebkor-essentials.el= section for OSX changes]]
|
- [[#the-nebkor-essentialsel-section-for-osx-changes][The =nebkor-essentials.el= section for OSX changes]]
|
||||||
- [[#the-nebkor-essentialsel-section-for-simpleel-changes][The =nebkor-essentials.el= section for ~simple.el~ changes]]
|
- [[#the-nebkor-essentialsel-section-for-simpleel-changes][The =nebkor-essentials.el= section for ~simple.el~ changes]]
|
||||||
- [[#the-nebkor-essentialsel-section-for-better-help-helpful][The =nebkor-essentials.el= section for better help (~helpful~)]]
|
|
||||||
- [[#the-nebkor-essentials-section-for-indent-tools][The =nebkor-essentials= section for ~indent-tools~]]
|
- [[#the-nebkor-essentials-section-for-indent-tools][The =nebkor-essentials= section for ~indent-tools~]]
|
||||||
- [[#the-nebkor-essentials-section-for-undo-tree][The =nebkor-essentials= section for ~undo-tree~]]
|
- [[#the-nebkor-essentials-section-for-undo-tree][The =nebkor-essentials= section for ~undo-tree~]]
|
||||||
- [[#the-nebkor-essentials-section-for-fancy-keyboard-shortcuts-key-chord][The =nebkor-essentials= section for fancy keyboard shortcuts (~key-chord~)]]
|
- [[#the-nebkor-essentials-section-for-fancy-keyboard-shortcuts-key-chord][The =nebkor-essentials= section for fancy keyboard shortcuts (~key-chord~)]]
|
||||||
|
@ -160,7 +159,6 @@
|
||||||
- [[#the-nebkor-langsel-section-for-emacs-lisp][The =nebkor-langs.el= section for Emacs Lisp]]
|
- [[#the-nebkor-langsel-section-for-emacs-lisp][The =nebkor-langs.el= section for Emacs Lisp]]
|
||||||
- [[#finally-we-provide-the-nebkor-langsel-module][Finally, we provide the =nebkor-langs.el= module]]
|
- [[#finally-we-provide-the-nebkor-langsel-module][Finally, we provide the =nebkor-langs.el= module]]
|
||||||
- [[#the-nebkor-studyel-module][The =nebkor-study.el= module]]
|
- [[#the-nebkor-studyel-module][The =nebkor-study.el= module]]
|
||||||
- [[#the-nebkor-studyel-section-for-notes-and-file-naming-denote][The =nebkor-study.el= section for notes and file-naming (~denote~)]]
|
|
||||||
- [[#the-nebkor-studyel-section-for-reading-and-annotation-of-pdfs-pdf-tools][The =nebkor-study.el= section for reading and annotation of PDFs (~pdf-tools~)]]
|
- [[#the-nebkor-studyel-section-for-reading-and-annotation-of-pdfs-pdf-tools][The =nebkor-study.el= section for reading and annotation of PDFs (~pdf-tools~)]]
|
||||||
- [[#the-nebkor-studyel-section-for-annotation-of-org-and-eww-files-org-remark][The =nebkor-study.el= section for annotation of org and eww files (~org-remark~)]]
|
- [[#the-nebkor-studyel-section-for-annotation-of-org-and-eww-files-org-remark][The =nebkor-study.el= section for annotation of org and eww files (~org-remark~)]]
|
||||||
- [[#the-nebkor-studyel-section-for-flashcards-org-fc][The =nebkor-study.el= section for flashcards (~org-fc~)]]
|
- [[#the-nebkor-studyel-section-for-flashcards-org-fc][The =nebkor-study.el= section for flashcards (~org-fc~)]]
|
||||||
|
@ -1394,22 +1392,6 @@ These are modifications to basic configuration I use on my Mac OSX machine.
|
||||||
(setq column-number-mode t))
|
(setq column-number-mode t))
|
||||||
#+end_src
|
#+end_src
|
||||||
|
|
||||||
** The =nebkor-essentials.el= section for better help (~helpful~)
|
|
||||||
:PROPERTIES:
|
|
||||||
:CUSTOM_ID: h:ECAF81D8-4111-4C71-AB77-3C3D322B235F
|
|
||||||
:CREATED: [2024-12-02 Mon 09:50]
|
|
||||||
:ID: 01JGD333ED000CFWD9GWED35XD
|
|
||||||
:END:
|
|
||||||
|
|
||||||
Helpful is a package that improves the default Emacs *Help* buffer. I don't want to replace what
|
|
||||||
Emacs provides with default, and I find myself using Helpful only as an Avy action ([[#h:4E8593F7-C065-4DFA-B513-98602EC2BA1A][The
|
|
||||||
=nebkor-search.el= settings for ~avy~ (jumping)]]). However, it's really useful in that context.
|
|
||||||
|
|
||||||
#+begin_src emacs-lisp :tangle "nebkor-modules/nebkor-essentials.el"
|
|
||||||
(use-package helpful
|
|
||||||
:ensure t)
|
|
||||||
#+end_src
|
|
||||||
|
|
||||||
** The =nebkor-essentials= section for ~indent-tools~
|
** The =nebkor-essentials= section for ~indent-tools~
|
||||||
:PROPERTIES:
|
:PROPERTIES:
|
||||||
:ID: 01JGD1ASTX0008J83XRB4TZW77
|
:ID: 01JGD1ASTX0008J83XRB4TZW77
|
||||||
|
@ -4731,12 +4713,12 @@ of packaging. I use it whenever I work on my numerous Emacs packages.
|
||||||
(use-package flymake
|
(use-package flymake
|
||||||
:ensure nil
|
:ensure nil
|
||||||
:bind
|
:bind
|
||||||
( :map flymake-mode-map
|
(:map flymake-mode-map
|
||||||
("C-c ! s" . flymake-start)
|
("C-c ! s" . flymake-start)
|
||||||
("C-c ! l" . flymake-show-buffer-diagnostics) ; Emacs28
|
("C-c ! l" . flymake-show-buffer-diagnostics) ; Emacs28
|
||||||
("C-c ! L" . flymake-show-project-diagnostics) ; Emacs28
|
("C-c ! L" . flymake-show-project-diagnostics) ; Emacs28
|
||||||
("C-c ! n" . flymake-goto-next-error)
|
("M-g n" . flymake-goto-next-error)
|
||||||
("C-c ! p" . flymake-goto-prev-error))
|
("M-g p" . flymake-goto-prev-error))
|
||||||
:hook
|
:hook
|
||||||
(prog-mode . turn-on-flymake)
|
(prog-mode . turn-on-flymake)
|
||||||
:config
|
:config
|
||||||
|
@ -5267,300 +5249,6 @@ for this to continue.
|
||||||
This file contains configuration for everything I use to make Emacs my
|
This file contains configuration for everything I use to make Emacs my
|
||||||
go-to place for studying anything.
|
go-to place for studying anything.
|
||||||
|
|
||||||
** The =nebkor-study.el= section for notes and file-naming (~denote~)
|
|
||||||
:PROPERTIES:
|
|
||||||
:CUSTOM_ID: h:e86a66dc-7ef9-4f09-ad7e-946de2034e8d
|
|
||||||
:CREATED: [2024-12-12 Thu 21:33]
|
|
||||||
:ID: 01JGD334B4000DNEXGHP7T9FSS
|
|
||||||
: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 =nebkor-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 "nebkor-modules/nebkor-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)
|
|
||||||
;; Bindings to personal functions (defined below)
|
|
||||||
("C-c d p m" . vedang/denote-publishing-extras-new-microblog-entry)
|
|
||||||
("C-c d p b" . vedang/denote-publishing-extras-new-blog-entry)
|
|
||||||
: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-journal-extras-directory (expand-file-name "journal" 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)))
|
|
||||||
|
|
||||||
(setq denote-sort-signature-comparison-function #'vedang/denote-sort-for-signatures))
|
|
||||||
|
|
||||||
#+end_src
|
|
||||||
|
|
||||||
*** The =nebkor-study.el= integration between Consult and Denote (~consult-denote~)
|
|
||||||
:PROPERTIES:
|
|
||||||
:CUSTOM_ID: h:ee82e629-fb05-4c75-9175-48a760a25691
|
|
||||||
:ID: 01JGD334BB000DF3EBFKMP10F4
|
|
||||||
:END:
|
|
||||||
|
|
||||||
#+begin_quote
|
|
||||||
This is another package of mine which extends my ~denote~ package
|
|
||||||
([[#h:e86a66dc-7ef9-4f09-ad7e-946de2034e8d][The =nebkor-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 =nebkor-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 "nebkor-modules/nebkor-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 =nebkor-study.el= section for reading and annotation of PDFs (~pdf-tools~)
|
** The =nebkor-study.el= section for reading and annotation of PDFs (~pdf-tools~)
|
||||||
:PROPERTIES:
|
:PROPERTIES:
|
||||||
|
@ -5572,7 +5260,7 @@ Prot is the developer of this package.
|
||||||
PDF Tools is an absolute powerhouse for reading and annotating PDF
|
PDF Tools is an absolute powerhouse for reading and annotating PDF
|
||||||
files. It is my goto tool for reading any academic papers.
|
files. It is my goto tool for reading any academic papers.
|
||||||
|
|
||||||
#+begin_src emacs-lisp :tangle "nebkor-modules/nebkor-study.el"
|
#+begin_src emacs-lisp :tangle "nebkor-modules/nebkor-study.el" :mkdirp yes
|
||||||
;;; PDF Tools for reading and annotating PDF files
|
;;; PDF Tools for reading and annotating PDF files
|
||||||
(use-package pdf-tools
|
(use-package pdf-tools
|
||||||
:ensure (:host github :repo "vedang/pdf-tools" :branch "master")
|
:ensure (:host github :repo "vedang/pdf-tools" :branch "master")
|
||||||
|
|
|
@ -202,9 +202,6 @@ If the region is selected, retain the original behaviour, otherwise call
|
||||||
:config
|
:config
|
||||||
(setq column-number-mode t))
|
(setq column-number-mode t))
|
||||||
|
|
||||||
(use-package helpful
|
|
||||||
:ensure t)
|
|
||||||
|
|
||||||
(use-package indent-tools
|
(use-package indent-tools
|
||||||
:ensure t)
|
:ensure t)
|
||||||
|
|
||||||
|
|
|
@ -77,12 +77,12 @@
|
||||||
(use-package flymake
|
(use-package flymake
|
||||||
:ensure nil
|
:ensure nil
|
||||||
:bind
|
:bind
|
||||||
( :map flymake-mode-map
|
(:map flymake-mode-map
|
||||||
("C-c ! s" . flymake-start)
|
("C-c ! s" . flymake-start)
|
||||||
("C-c ! l" . flymake-show-buffer-diagnostics) ; Emacs28
|
("C-c ! l" . flymake-show-buffer-diagnostics) ; Emacs28
|
||||||
("C-c ! L" . flymake-show-project-diagnostics) ; Emacs28
|
("C-c ! L" . flymake-show-project-diagnostics) ; Emacs28
|
||||||
("C-c ! n" . flymake-goto-next-error)
|
("M-g n" . flymake-goto-next-error)
|
||||||
("C-c ! p" . flymake-goto-prev-error))
|
("M-g p" . flymake-goto-prev-error))
|
||||||
:hook
|
:hook
|
||||||
(prog-mode . turn-on-flymake)
|
(prog-mode . turn-on-flymake)
|
||||||
:config
|
:config
|
||||||
|
|
|
@ -1,222 +1,3 @@
|
||||||
;;; 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)
|
|
||||||
;; Bindings to personal functions (defined below)
|
|
||||||
("C-c d p m" . vedang/denote-publishing-extras-new-microblog-entry)
|
|
||||||
("C-c d p b" . vedang/denote-publishing-extras-new-blog-entry)
|
|
||||||
: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-journal-extras-directory (expand-file-name "journal" 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)))
|
|
||||||
|
|
||||||
(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
|
;;; PDF Tools for reading and annotating PDF files
|
||||||
(use-package pdf-tools
|
(use-package pdf-tools
|
||||||
:ensure (:host github :repo "vedang/pdf-tools" :branch "master")
|
:ensure (:host github :repo "vedang/pdf-tools" :branch "master")
|
||||||
|
|
Loading…
Reference in a new issue