[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[elpa] externals/denote d4cbb974a5 157/355: Rewrite node on multi file t
From: |
ELPA Syncer |
Subject: |
[elpa] externals/denote d4cbb974a5 157/355: Rewrite node on multi file types (due to b42f68c) |
Date: |
Sun, 26 Jun 2022 23:58:18 -0400 (EDT) |
branch: externals/denote
commit d4cbb974a51c1a64ddc3f350a0be819ab27fd099
Author: Protesilaos Stavrou <info@protesilaos.com>
Commit: Protesilaos Stavrou <info@protesilaos.com>
Rewrite node on multi file types (due to b42f68c)
---
README.org | 63 ++++++++++++++++++++++++++++++++++----------------------------
1 file changed, 35 insertions(+), 28 deletions(-)
diff --git a/README.org b/README.org
index 206a5e4294..78097c9fdf 100644
--- a/README.org
+++ b/README.org
@@ -679,52 +679,56 @@ workflow the user wishes to follow nor does it expect a
specific file
type. It is entirely possible to store notes in a variety of formats
across multiple directories and Denote will still be able to work with
them, provided they follow the file-naming scheme and have an identifier
-in their front matter (where relevant). Here we show how to create new
-notes that deviate from the default value of ~denote-file-type~ and
-specify their own ~denote-directory~.
+in their front matter, where relevant. Here we show how to create new
+notes that take the example of the ~denote-type~ command and take it one
+step further.
-Suppose you want to conform with the default of creating notes with the
-=.org= extension but, for whatever reason, wish to have a way to quickly
-produce a file with the =.md= extension and TOML-compliant front matter.
+Suppose you want to use the ~denote~ command to store some notes in
+Markdown, others in Org, and others still in plain text. Maybe you also
+want to place each of those in its own directory. Using the
+~denote-type~ command is not sufficient, as it only operates on the
+value of the user option ~denote-directory~. You need some small
+wrapper functions.
-#+begin_src emacs-lisp
-(setq denote-file-type nil)
-
-(defun my-denote-markdown-toml ()
- (interactive)
- (let ((denote-file-type 'markdown-toml))
- (call-interactively #'denote)))
-#+end_src
+For example:
-With the above, =M-x my-denote-markdown-toml= produces Markdown+TOML
-notes while =M-x denote= uses Org.
++ =~/Documents/notes/= is your default and contains Org files.
++ =~/Documents/blog/= holds the files of your blog.
++ =~/Documents/random/= is where you scribble thoughts in plain text.
-This principle can be taken a step further by ~let~ binding a second
-directory for those alternative notes. Maybe your standard notes are
-located in =~/Documents/notes/= but you plan to store the other ones in
-=~/blog/= ([[#h:337f9cf0-9f66-45af-b73f-f6370472fb51][Fontification in
Dired]]).
+Why would you do that? It does not matter. This is for didactic
+purposes. All you need to do is write functions that ~let~ bind the
+~denote-directory~ and to the desired value.
#+begin_src emacs-lisp
-(setq denote-file-type nil)
-(setq denote-directory (expand-file-name "~/Documents/notes/"))
-
(defun my-denote-markdown-toml ()
+ "Create Markdown+TOML note in ~/Documents/blog/."
(interactive)
(let ((denote-file-type 'markdown-toml)
- (denote-directory "~/blog/"))
+ (denote-directory "~/Documents/blog/"))
+ (call-interactively #'denote)))
+
+(defun my-denote-plain-text ()
+ "Create plain text note in ~/Documents/random/."
+ (interactive)
+ (let ((denote-file-type 'text)
+ (denote-directory "~/Documents/random/"))
(call-interactively #'denote)))
#+end_src
+You do not need a third command for the Org files, as those would be the
+default used by regular ~denote~.
+
Given Denote's composable code, you can tweak the output however you
like, including the contents of the file
([[#h:f69371d5-1843-493d-9ff5-c1ab3b43024e][Tweaking the front matter]]).
If you do place different types of notes in their own directories,
consider introducing directory-local variables to keep things working
seamlessly. An obvious candidate for such a local variable is the
-~denote-directory~: you want notes in =~/blog/= to treat their directory
-as the canonical one; while those in =~/Documents/notes/= to do the same
-for that path. Write a =.dir-locals.el= file with the following
-contents and place it in each of those directories:
+~denote-directory~: you want notes in =~/Documents/blog/= to treat their
+directory as the canonical one; while those in =~/Documents/random/= to
+do the same for that path. Write a =.dir-locals.el= file with the
+following contents and place it in each of those directories:
#+begin_src emacs-lisp
;;; Directory Local Variables
@@ -735,6 +739,9 @@ contents and place it in each of those directories:
This will allow things to work smoothly (e.g. ~denote-infer-keywords~).
+Your default ~denote-directory~ does not need this, as it already is the
+normal target that Denote uses.
+
Have more ideas? Something does not work quite right? Areas you wish
were more abstract in the code? Please participate in the development
process.
- [elpa] externals/denote c9926a528e 133/355: perf: Stop searching for the title or identifier after the 1st match, (continued)
- [elpa] externals/denote c9926a528e 133/355: perf: Stop searching for the title or identifier after the 1st match, ELPA Syncer, 2022/06/27
- [elpa] externals/denote f55dee06b1 143/355: Add documentation about our minibuffer histories, ELPA Syncer, 2022/06/27
- [elpa] externals/denote 97e8c30bcf 153/355: Rewrite the package Overview, ELPA Syncer, 2022/06/27
- [elpa] externals/denote 171b873cb5 142/355: Require denote-retrieve (0e83bee) in denote-link, ELPA Syncer, 2022/06/27
- [elpa] externals/denote 6a286c97f8 154/355: Rephrase statement for clarity, ELPA Syncer, 2022/06/27
- [elpa] externals/denote 0e83bee5b7 141/355: Add denote-retrieve for internal purposes, ELPA Syncer, 2022/06/27
- [elpa] externals/denote b42f68c8e8 156/355: Add denote-type command, ELPA Syncer, 2022/06/27
- [elpa] externals/denote e841a51ca7 155/355: Fix typo, ELPA Syncer, 2022/06/27
- [elpa] externals/denote bc93a8ecda 137/355: Update the manual on the matter of backlinks, ELPA Syncer, 2022/06/27
- [elpa] externals/denote 45bea4166a 158/355: Update Acknowledgements, ELPA Syncer, 2022/06/27
- [elpa] externals/denote d4cbb974a5 157/355: Rewrite node on multi file types (due to b42f68c),
ELPA Syncer <=
- [elpa] externals/denote 479899d973 162/355: Clarify wording about journal/diary extras, ELPA Syncer, 2022/06/27
- [elpa] externals/denote e9bc790675 167/355: Clarify that auto-backlinks may be removed, ELPA Syncer, 2022/06/27
- [elpa] externals/denote 4bc7aa4dfd 166/355: Remove outdated doc string from private function, ELPA Syncer, 2022/06/27
- [elpa] externals/denote d9f439e47f 173/355: Add helper function to prepare completion table, ELPA Syncer, 2022/06/27
- [elpa] externals/denote 91090d42c6 180/355: Fix regexp match for backlinks, ELPA Syncer, 2022/06/27
- [elpa] externals/denote 768372281f 177/355: Fix formatting typo, ELPA Syncer, 2022/06/27
- [elpa] externals/denote a47f32ec71 184/355: Implement new backlink facility, ELPA Syncer, 2022/06/27
- [elpa] externals/denote 7674c6f854 170/355: Retrieve identifier from filename alone, ELPA Syncer, 2022/06/27
- [elpa] externals/denote e783662363 159/355: Tweak sample configuration, ELPA Syncer, 2022/06/27
- [elpa] externals/denote fc9f909061 179/355: Change denote--id to denote--id-format, ELPA Syncer, 2022/06/27