dotemacs

My Emacs configuration
git clone git://git.entf.net/dotemacs
Log | Files | Refs | LICENSE

README-elpa (251670B)


      1            ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
      2                  DENOTE: SIMPLE NOTES WITH AN EFFICIENT
      3                            FILE-NAMING SCHEME
      4 
      5                           Protesilaos Stavrou
      6                           info@protesilaos.com
      7            ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
      8 
      9 
     10 This manual, written by Protesilaos Stavrou, describes the customization
     11 options for the Emacs package called `denote' (or `denote.el'), and
     12 provides every other piece of information pertinent to it.
     13 
     14 The documentation furnished herein corresponds to stable version 2.3.0,
     15 released on 2024-03-24.  Any reference to a newer feature which does not
     16 yet form part of the latest tagged commit, is explicitly marked as such.
     17 
     18 Current development target is 3.0.0-dev.
     19 
     20 ⁃ Package name (GNU ELPA): `denote'
     21 ⁃ Official manual: <https://protesilaos.com/emacs/denote>
     22 ⁃ Change log: <https://protesilaos.com/emacs/denote-changelog>
     23 ⁃ Git repositories:
     24   ⁃ GitHub: <https://github.com/protesilaos/denote>
     25   ⁃ GitLab: <https://gitlab.com/protesilaos/denote>
     26 ⁃ Video demo: <https://protesilaos.com/codelog/2022-06-18-denote-demo/>
     27 ⁃ Backronyms: Denote Everything Neatly; Omit The Excesses.  Don’t Ever
     28   Note Only The Epiphenomenal.
     29 
     30 If you are viewing the README.org version of this file, please note that
     31 the GNU ELPA machinery automatically generates an Info manual out of it.
     32 
     33 Table of Contents
     34 ─────────────────
     35 
     36 1. COPYING
     37 2. Overview
     38 3. Points of entry
     39 .. 1. Standard note creation
     40 ..... 1. The `denote-prompts' option
     41 ..... 2. The `denote-history-completion-in-prompts' option
     42 ..... 3. The `denote-templates' option
     43 ..... 4. Convenience commands for note creation
     44 ..... 5. The `denote-save-buffer-after-creation' option
     45 ..... 6. The `denote-date-prompt-use-org-read-date' option
     46 .. 2. Create a note from the current Org subtree
     47 .. 3. Create note using Org capture
     48 .. 4. Create note with specific prompts using Org capture
     49 .. 5. Create a note with the region’s contents
     50 .. 6. Open an existing note or create it if missing
     51 .. 7. Maintain separate directory silos for notes
     52 ..... 1. Use custom commands to select a silo
     53 ..... 2. The `denote-silo-extras.el'
     54 .. 8. Exclude certain directories from all operations
     55 .. 9. Exclude certain keywords from being inferred
     56 .. 10. Use Denote commands from the menu bar or context menu
     57 4. Renaming files
     58 .. 1. Rename a single file
     59 ..... 1. The `denote-rename-no-confirm' option
     60 .. 2. Rename a single file based on its front matter
     61 .. 3. Rename multiple files interactively
     62 .. 4. Rename multiple files at once by asking only for keywords
     63 .. 5. Rename multiple files based on their front matter
     64 .. 6. Rename a file by changing only its file type
     65 .. 7. Rename a file by adding or removing keywords interactively
     66 .. 8. Rename a file by adding or removing a signature interactively
     67 .. 9. Faces used by rename commands
     68 5. The file-naming scheme
     69 .. 1. Sluggification of file name components
     70 .. 2. User-defined sluggification of file name components
     71 .. 3. Features of the file-naming scheme for searching or filtering
     72 6. Front matter
     73 .. 1. Change the front matter format
     74 .. 2. Regenerate front matter
     75 7. Linking notes
     76 .. 1. Adding a single link
     77 .. 2. The `denote-org-store-link-to-heading' user option
     78 .. 3. Insert link to an Org file with a further pointer to a heading
     79 .. 4. Insert links matching a regexp
     80 .. 5. Insert link to file with signature
     81 .. 6. Insert links from marked files in Dired
     82 .. 7. Link to an existing note or create a new one
     83 .. 8. The backlinks’ buffer
     84 .. 9. Writing metanotes
     85 .. 10. Visiting linked files via the minibuffer
     86 .. 11. Convert `denote:' links to `file:' links
     87 .. 12. Miscellaneous information about links
     88 ..... 1. Aliases for the linking commands
     89 ..... 2. The `denote-link-description-function' to format links
     90 8. Choose which commands to prompt for
     91 9. Fontification in Dired
     92 10. Automatically rename Denote buffers
     93 .. 1. The `denote-rename-buffer-format' option
     94 11. Use Org dynamic blocks
     95 .. 1. Org dynamic blocks to insert links or backlinks
     96 .. 2. Org dynamic block to insert file contents
     97 12. Sort files by component
     98 13. Keep a journal or diary
     99 .. 1. Journaling with a timer
    100 14. Minibuffer histories
    101 15. Extending Denote
    102 .. 1. Create a new note in any directory
    103 .. 2. Narrow the list of files in Dired
    104 .. 3. Use `dired-virtual-mode' for arbitrary file listings
    105 .. 4. Use Embark to collect minibuffer candidates
    106 .. 5. Search file contents
    107 .. 6. Bookmark the directory with the notes
    108 .. 7. Use the `denote-explore' package to explore your notes
    109 .. 8. Use the `citar-denote' package for bibliography notes
    110 .. 9. Use the `consult-notes' package
    111 .. 10. Use the `denote-menu' package
    112 .. 11. Treat your notes as a project
    113 .. 12. Use the tree-based file prompt for select commands
    114 .. 13. Rename files with Denote in the Image Dired thumbnails buffer
    115 .. 14. Rename files with Denote using `dired-preview'
    116 .. 15. Avoid duplicate identifiers when exporting Denote notes
    117 ..... 1. Export Denote notes with Org Mode
    118 ..... 2. Export Denote notes with Markdown
    119 16. Installation
    120 .. 1. GNU ELPA package
    121 .. 2. Manual installation
    122 17. Sample configuration
    123 18. For developers or advanced users
    124 19. Troubleshoot Denote in a pristine environment
    125 20. Contributing
    126 .. 1. Wishlist of what we can do to extend Denote
    127 21. Publications about Denote
    128 22. Alternatives to Denote
    129 .. 1. Alternative implementations and further reading
    130 23. Frequently Asked Questions
    131 .. 1. Why develop Denote when PACKAGE already exists?
    132 .. 2. Why not rely exclusively on Org?
    133 .. 3. Why care about Unix tools when you use Emacs?
    134 .. 4. Why many small files instead of few large ones?
    135 .. 5. Does Denote perform well at scale?
    136 .. 6. I add TODOs to my notes; will many files slow down the Org agenda?
    137 .. 7. I want to sort by last modified in Dired, why won’t Denote let me?
    138 .. 8. How do you handle the last modified case?
    139 .. 9. Speed up backlinks’ buffer creation?
    140 .. 10. Why do I get “Search failed with status 1” when I search for backlinks?
    141 .. 11. Why do I get a double `#+title' in Doom Emacs?
    142 24. Acknowledgements
    143 25. GNU Free Documentation License
    144 26. Indices
    145 .. 1. Function index
    146 .. 2. Variable index
    147 .. 3. Concept index
    148 
    149 
    150 1 COPYING
    151 ═════════
    152 
    153   Copyright (C) 2022-2024 Free Software Foundation, Inc.
    154 
    155         Permission is granted to copy, distribute and/or modify
    156         this document under the terms of the GNU Free
    157         Documentation License, Version 1.3 or any later version
    158         published by the Free Software Foundation; with no
    159         Invariant Sections, with the Front-Cover Texts being “A
    160         GNU Manual,” and with the Back-Cover Texts as in (a)
    161         below.  A copy of the license is included in the section
    162         entitled “GNU Free Documentation License.”
    163 
    164         (a) The FSF’s Back-Cover Text is: “You have the freedom to
    165         copy and modify this GNU manual.”
    166 
    167 
    168 2 Overview
    169 ══════════
    170 
    171   Denote aims to be a simple-to-use, focused-in-scope, and effective
    172   note-taking and file-naming tool for Emacs.
    173 
    174   Denote is based on the idea that files should follow a predictable and
    175   descriptive file-naming scheme.  The file name must offer a clear
    176   indication of what the contents are about, without reference to any
    177   other metadata.  Denote basically streamlines the creation of such
    178   files or file names while providing facilities to link between them
    179   (where those files are editable).
    180 
    181   Denote’s file-naming scheme is not limited to “notes”.  It can be used
    182   for all types of file, including those that are not editable in Emacs,
    183   such as videos.  Naming files in a consistent way makes their
    184   filtering and retrieval considerably easier.  Denote provides relevant
    185   facilities to rename files, regardless of file type.
    186 
    187   Denote is based on the following core design principles:
    188 
    189   Predictability
    190         File names must follow a consistent and descriptive naming
    191         convention ([The file-naming scheme]).  The file name alone
    192         should offer a clear indication of what the contents are,
    193         without reference to any other metadatum.  This convention is
    194         not specific to note-taking, as it is pertinent to any form of
    195         file that is part of the user’s long-term storage ([Renaming
    196         files]).
    197 
    198   Composability
    199         Be a good Emacs citizen, by integrating with other packages or
    200         built-in functionality instead of re-inventing functions such as
    201         for filtering or greping.  The author of Denote (Protesilaos,
    202         aka “Prot”) writes ordinary notes in plain text (`.txt'),
    203         switching on demand to an Org file only when its expanded set of
    204         functionality is required for the task at hand ([Points of
    205         entry]).
    206 
    207   Portability
    208         Notes are plain text and should remain portable.  The way Denote
    209         writes file names, the front matter it includes in the note’s
    210         header, and the links it establishes must all be adequately
    211         usable with standard Unix tools.  No need for a database or some
    212         specialised software.  As Denote develops and this manual is
    213         fully fleshed out, there will be concrete examples on how to do
    214         the Denote-equivalent on the command-line.
    215 
    216   Flexibility
    217         Do not assume the user’s preference for a note-taking
    218         methodology.  Denote is conceptually similar to the Zettelkasten
    219         Method, which you can learn more about in this detailed
    220         introduction: <https://zettelkasten.de/introduction/>.  Notes
    221         are atomic (one file per note) and have a unique identifier.
    222         However, Denote does not enforce a particular methodology for
    223         knowledge management, such as a restricted vocabulary or
    224         mutually exclusive sets of keywords.  Denote also does not check
    225         if the user writes thematically atomic notes.  It is up to the
    226         user to apply the requisite rigor and/or creativity in pursuit
    227         of their preferred workflow ([Writing metanotes]).
    228 
    229   Hackability
    230         Denote’s code base consists of small and reusable functions.
    231         They all have documentation strings.  The idea is to make it
    232         easier for users of varying levels of expertise to understand
    233         what is going on and make surgical interventions where necessary
    234         (e.g. to tweak some formatting).  In this manual, we provide
    235         concrete examples on such user-level configurations ([Keep a
    236         journal or diary]).
    237 
    238   Now the important part…  “Denote” is the familiar word, though it also
    239   is a play on the “note” concept.  Plus, we can come up with acronyms,
    240   recursive or otherwise, of increasingly dubious utility like:
    241 
    242   ⁃ Don’t Ever Note Only The Epiphenomenal
    243   ⁃ Denote Everything Neatly; Omit The Excesses
    244 
    245   But we’ll let you get back to work.  Don’t Eschew or Neglect your
    246   Obligations, Tasks, and Engagements.
    247 
    248 
    249 [The file-naming scheme] See section 5
    250 
    251 [Renaming files] See section 4
    252 
    253 [Points of entry] See section 3
    254 
    255 [Writing metanotes] See section 7.9
    256 
    257 [Keep a journal or diary] See section 13
    258 
    259 
    260 3 Points of entry
    261 ═════════════════
    262 
    263   There are five main ways to write a note with Denote: invoke the
    264   `denote', `denote-type', `denote-date', `denote-subdirectory',
    265   `denote-template', `denote-signature' commands, or leverage the
    266   `org-capture-templates' by setting up a template which calls the
    267   function `denote-org-capture'.  We explain all of those in the
    268   subsequent sections.  Other more specialised commands exist as well,
    269   which one shall learn about as they read through this manual.  We do
    270   not want to overwhelm the user with options at this stage.
    271 
    272 
    273 3.1 Standard note creation
    274 ──────────────────────────
    275 
    276   The `denote' command will prompt for a title.  If a region is active,
    277   the text of the region becomes the default at the minibuffer prompt
    278   (meaning that typing `RET' without any input will use the default
    279   value).  Once the title is supplied, the `denote' command will then
    280   ask for keywords.  The resulting note will have a file name as already
    281   explained: [The file naming scheme]
    282 
    283   The `denote' command runs the hook `denote-after-new-note-hook' after
    284   creating the new note.
    285 
    286   The file type of the new note is determined by the user option
    287   `denote-file-type' ([Front matter]).
    288 
    289   The keywords’ prompt supports minibuffer completion.  Available
    290   candidates are those defined in the user option
    291   `denote-known-keywords'.  More candidates can be inferred from the
    292   names of existing notes, by setting `denote-infer-keywords' to non-nil
    293   (which is the case by default).
    294 
    295   Multiple keywords can be inserted by separating them with a comma (or
    296   whatever the value of the `crm-separator' is—which should be a comma).
    297   When the user option `denote-sort-keywords' is non-nil (the default),
    298   keywords are sorted alphabetically (technically, the sorting is done
    299   with `string-lessp').
    300 
    301   The interactive behaviour of the `denote' command is influenced by the
    302   user option `denote-prompts' ([The denote-prompts option]).
    303 
    304   The `denote' command can also be called from Lisp.  Read its doc
    305   string for the technicalities.
    306 
    307   In the interest of discoverability, `denote' is also available under
    308   the alias `denote-create-note'.
    309 
    310 
    311 [The file naming scheme] See section 5
    312 
    313 [Front matter] See section 6
    314 
    315 [The denote-prompts option] See section 3.1.1
    316 
    317 3.1.1 The `denote-prompts' option
    318 ╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌
    319 
    320   The user option `denote-prompts' determines how the `denote' command
    321   will behave interactively ([Standard note creation]).
    322 
    323   Commands that prompt for user input to construct a Denote file name
    324   include, but are not limited to: `denote', `denote-signature',
    325   `denote-type', `denote-date', `denote-subdirectory',
    326   `denote-rename-file', `denote-dired-rename-files'.
    327 
    328   • [Convenience commands for note creation].
    329   • [Renaming files].
    330 
    331   The value of this user option is a list of symbols, which includes any
    332   of the following:
    333 
    334   • `title': Prompt for the title of the new note ([The
    335     `denote-history-completion-in-prompts' option]).
    336 
    337   • `keywords': Prompts with completion for the keywords of the new
    338     note.  Available candidates are those specified in the user option
    339     `denote-known-keywords'.  If the user option `denote-infer-keywords'
    340     is non-nil, keywords in existing note file names are included in the
    341     list of candidates.  The `keywords' prompt uses
    342     `completing-read-multiple', meaning that it can accept multiple
    343     keywords separated by a comma (or whatever the value of
    344     `crm-separator' is).
    345 
    346   • `file-type': Prompts with completion for the file type of the new
    347     note.  Available candidates are those specified in the user option
    348     `denote-file-type'.  Without this prompt, `denote' uses the value of
    349     `denote-file-type'.
    350 
    351   • `subdirectory': Prompts with completion for a subdirectory in which
    352     to create the note.  Available candidates are the value of the user
    353     option `denote-directory' and all of its subdirectories.  Any
    354     subdirectory must already exist: Denote will not create it.
    355 
    356   • `date': Prompts for the date of the new note.  It will expect an
    357     input like 2022-06-16 or a date plus time: 2022-06-16 14:30.
    358     Without the `date' prompt, the `denote' command uses the
    359     `current-time'.
    360 
    361     [The denote-date-prompt-use-org-read-date option].
    362 
    363   • `template': Prompts for a KEY among the `denote-templates'.  The
    364     value of that KEY is used to populate the new note with content,
    365     which is added after the front matter ([The denote-templates
    366     option]).
    367 
    368   • `signature': - Prompts for an arbitrary string that can be used to
    369     establish a sequential relationship between files (e.g. 1, 1a, 1b,
    370     1b1, 1b2, …).  Signatures have no strictly defined function and are
    371     up to the user to apply as they see fit.  One use-case is to
    372     implement Niklas Luhmann’s Zettelkasten system for a sequence of
    373     notes (Folgezettel).  Signatures are not included in a file’s front
    374     matter.  They are reserved solely for creating a sequence in a file
    375     listing, at least for the time being.  To insert a link that
    376     includes the signature, use the command `denote-link-with-signature'
    377     ([Insert link to file with signature]).
    378 
    379   The prompts occur in the given order.
    380 
    381   If the value of this user option is nil, no prompts are used.  The
    382   resulting file name will consist of an identifier (i.e. the date and
    383   time) and a supported file type extension (per `denote-file-type').
    384 
    385   Recall that Denote’s standard file-naming scheme is defined as follows
    386   ([The file-naming scheme]):
    387 
    388   ┌────
    389   │ DATE--TITLE__KEYWORDS.EXT
    390   └────
    391 
    392 
    393   If either or both of the `title' and `keywords' prompts are not
    394   included in the value of this variable, file names will be any of
    395   those permutations:
    396 
    397   ┌────
    398   │ DATE.EXT
    399   │ DATE--TITLE.EXT
    400   │ DATE__KEYWORDS.EXT
    401   └────
    402 
    403 
    404   When in doubt, always include the `title' and `keywords' prompts.
    405 
    406   Finally, this user option only affects the interactive use of the
    407   `denote' or other relevant commands (advanced users can call it from
    408   Lisp). In Lisp usage, the behaviour is always what the caller
    409   specifies, based on the supplied arguments.
    410 
    411 
    412 [Standard note creation] See section 3.1
    413 
    414 [Convenience commands for note creation] See section 3.1.4
    415 
    416 [Renaming files] See section 4
    417 
    418 [The `denote-history-completion-in-prompts' option] See section 3.1.2
    419 
    420 [The denote-date-prompt-use-org-read-date option] See section 3.1.6
    421 
    422 [The denote-templates option] See section 3.1.3
    423 
    424 [Insert link to file with signature] See section 7.5
    425 
    426 [The file-naming scheme] See section 5
    427 
    428 
    429 3.1.2 The `denote-history-completion-in-prompts' option
    430 ╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌
    431 
    432   The user option `denote-history-completion-in-prompts' toggles history
    433   completion in all `denote-prompts-with-history-as-completion'.
    434 
    435   When this user option is set to a non-nil value, Denote will use
    436   minibuffer history entries as completion candidates in all of the
    437   `denote-prompts-with-history-as-completion'. Those will show previous
    438   inputs from their respective history as possible values to select,
    439   either to (i) re-insert them verbatim or (ii) with the intent to edit
    440   them further (depending on the minibuffer user interface, one can
    441   select a candidate with `TAB' without exiting the minibuffer, as
    442   opposed to what `RET' normally does by selecting and exiting).
    443 
    444   When this user option is set to a nil value, all of the
    445   `denote-prompts-with-history-as-completion' will not use minibuffer
    446   completion: they will just prompt for a string of characters. Their
    447   history is still available through all the standard ways of retrieving
    448   minibuffer history, such as with the command
    449   `previous-history-element'.
    450 
    451   History completion still allows arbitrary values to be provided as
    452   input: they do not have to match the available minibuffer completion
    453   candidates.
    454 
    455   Note that some prompts, like `denote-keywords-prompt', always use
    456   minibuffer completion, due to the specifics of their data.
    457 
    458   [ Consider enabling the built-in `savehist-mode' to persist minibuffer
    459     histories between sessions.]
    460 
    461 
    462 3.1.3 The `denote-templates' option
    463 ╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌
    464 
    465   The user option `denote-templates' is an alist of content templates
    466   for new notes.  A template is arbitrary text that Denote will add to a
    467   newly created note right below the front matter.
    468 
    469   Templates are expressed as a `(KEY . STRING)' association.
    470 
    471   • The `KEY' is the name which identifies the template.  It is an
    472     arbitrary symbol, such as `report', `memo', `statement'.
    473 
    474   • The `STRING' is ordinary text that Denote will insert as-is.  It can
    475     contain newline characters to add spacing.  Below we show some
    476     concrete examples.
    477 
    478   The user can choose a template either by invoking the command
    479   `denote-template' or by changing the user option `denote-prompts' to
    480   always prompt for a template when calling the `denote' command.
    481 
    482   [The denote-prompts option].
    483 
    484   [Convenience commands for note creation].
    485 
    486   Templates can be written directly as one large string.  For example
    487   (the `\n' character is read as a newline):
    488 
    489   ┌────
    490   │ (setq denote-templates
    491   │       '((report . "* Some heading\n\n* Another heading")
    492   │ 	(memo . "* Some heading
    493    494   │ * Another heading
    495    496   │ ")))
    497   └────
    498 
    499   Long strings may be easier to type but interpret indentation
    500   literally.  Also, they do not scale well.  A better way is to use some
    501   Elisp code to construct the string.  This would typically be the
    502   `concat' function, which joins multiple strings into one.  The
    503   following is the same as the previous example:
    504 
    505   ┌────
    506   │ (setq denote-templates
    507   │       `((report . "* Some heading\n\n* Another heading")
    508   │ 	(memo . ,(concat "* Some heading"
    509   │ 			 "\n\n"
    510   │ 			 "* Another heading"
    511   │ 			 "\n\n"))))
    512   └────
    513 
    514   Notice that to evaluate a function inside of an alist we use the
    515   backtick to quote the alist (NOT the straight quote) and then prepend
    516   a comma to the expression that should be evaluated.  The `concat' form
    517   here is not sensitive to indentation, so it is easier to adjust for
    518   legibility.
    519 
    520   DEV NOTE: We do not provide more examples at this point, though feel
    521   welcome to ask for help if the information provided herein is not
    522   sufficient.  We shall expand the manual accordingly.
    523 
    524 
    525 [The denote-prompts option] See section 3.1.1
    526 
    527 [Convenience commands for note creation] See section 3.1.4
    528 
    529 
    530 3.1.4 Convenience commands for note creation
    531 ╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌
    532 
    533   Sometimes the user needs to create a note that has different
    534   requirements from those of `denote' ([Standard note creation]).  While
    535   this can be achieved globally by changing the `denote-prompts' user
    536   option, there are cases where an ad-hoc method is the appropriate one
    537   ([The denote-prompts option]).
    538 
    539   To this end, Denote provides the following interactive convenience
    540   commands for note creation. They all work by appending a new prompt to
    541   the existing `denote-prompts'.
    542 
    543   Create note by specifying file type
    544         The `denote-type' command creates a note while prompting for a
    545         file type.
    546 
    547         This is the equivalent of calling `denote' when `denote-prompts'
    548         has the `file-type' prompt appended to its existing prompts. In
    549         practical terms, this lets you produce, say, a note in Markdown
    550         even though you normally write in Org ([Standard note
    551         creation]).
    552 
    553         The `denote-create-note-using-type' is an alias of
    554         `denote-type'.
    555 
    556   Create note using a date
    557         Normally, Denote reads the current date and time to construct
    558         the unique identifier of a newly created note ([Standard note
    559         creation]).  Sometimes, however, the user needs to set an
    560         explicit date+time value.
    561 
    562         This is where the `denote-date' command comes in.  It creates a
    563         note while prompting for a date.  The date can be in
    564         YEAR-MONTH-DAY notation like `2022-06-30' or that plus the time:
    565         `2022-06-16 14:30'.
    566 
    567         [The denote-date-prompt-use-org-read-date option].
    568 
    569         This is the equivalent of calling `denote' when `denote-prompts'
    570         has the `date' prompt appended to its existing prompts.
    571 
    572         The `denote-create-note-using-date' is an alias of
    573         `denote-date'.
    574 
    575   Create note in a specific directory
    576         The `denote-subdirectory' command creates a note while prompting
    577         for a subdirectory.  Available candidates include the value of
    578         the variable `denote-directory' and any subdirectory thereof
    579         (Denote does not create subdirectories).
    580 
    581         This is the equivalent of calling `denote' when `denote-prompts'
    582         has the `subdirectory' prompt appended to its existing prompts.
    583 
    584         The `denote-create-note-in-subdirectory' is a more descriptive
    585         alias of `denote-subdirectory'.
    586 
    587   Create note and add a template
    588         The `denote-template' command creates a new note and inserts the
    589         specified template below the front matter ([The denote-templates
    590         option]).  Available candidates for templates are specified in
    591         the user option `denote-templates'.
    592 
    593         This is the equivalent of calling `denote' when `denote-prompts'
    594         has the `template' prompt appended to its existing prompts.
    595 
    596         The `denote-create-note-with-template' is an alias of the
    597         command `denote-template', meant to help with discoverability.
    598 
    599   Create note with a signature
    600         The `denote-signature' command first prompts for an arbitrary
    601         string to use in the optional `SIGNATURE' field of the file name
    602         and then asks for a title and keywords.  Signatures are
    603         arbitrary strings of alphanumeric characters which can be used
    604         to establish sequential relations between file at the level of
    605         their file name (e.g. 1, 1a, 1b, 1b1, 1b2, …).
    606 
    607         This is the equivalent of calling `denote' when `denote-prompts'
    608         has the `signature' prompt appended to its existing prompts.
    609 
    610         The `denote-create-note-using-signature' is an alias of the
    611         command `denote-signature' intended to make the functionality
    612         more discoverable.
    613 
    614 
    615 [Standard note creation] See section 3.1
    616 
    617 [The denote-prompts option] See section 3.1.1
    618 
    619 [The denote-date-prompt-use-org-read-date option] See section 3.1.6
    620 
    621 [The denote-templates option] See section 3.1.3
    622 
    623 ◊ 3.1.4.1 Write your own convenience commands
    624 
    625   The convenience commands we provide only cover some basic use-cases
    626   ([Convenience commands for note creation]).  The user may require
    627   combinations that are not covered, such as to prompt for a template
    628   and for a subdirectory, instead of only one of the two.  To this end,
    629   we show how to follow the code we use in Denote to write your own
    630   variants of those commands.
    631 
    632   First let’s take a look at the definition of one of those commands.
    633   They all look the same, but we use `denote-subdirectory' for this
    634   example:
    635 
    636   ┌────
    637   │ (defun denote-subdirectory ()
    638   │   "Create note while prompting for a subdirectory.
    639    640   │ Available candidates include the value of the variable
    641   │ `denote-directory' and any subdirectory thereof.
    642    643   │ This is equivalent to calling `denote' when `denote-prompts' is
    644   │ set to '(subdirectory title keywords)."
    645   │   (declare (interactive-only t))
    646   │   (interactive)
    647   │   (let ((denote-prompts '(subdirectory title keywords)))
    648   │     (call-interactively #'denote)))
    649   └────
    650 
    651   The hyphenated word after `defun' is the name of the function.  It has
    652   to be unique.  Then we have the documentation string (or “doc string”)
    653   which is for the user’s convenience.
    654 
    655   This function is `interactive', meaning that it can be called via
    656   `M-x' or be assigned to a key binding.  Then we have the local binding
    657   of the `denote-prompts' to the desired combination (“local” means
    658   specific to this function without affecting other contexts).  Lastly,
    659   it calls the standard `denote' command interactively, so it uses all
    660   the prompts in their specified order.
    661 
    662   Now let’s say we want to have a command that (i) asks for a template
    663   and (ii) for a subdirectory ([The denote-templates option]).  All we
    664   need to do is tweak the `let' bound value of `denote-prompts' and give
    665   our command a unique name:
    666 
    667   ┌────
    668   │ ;; Like `denote-subdirectory' but also ask for a template
    669   │ (defun denote-subdirectory-with-template ()
    670   │   "Create note while also prompting for a template and subdirectory.
    671    672   │ This is equivalent to calling `denote' when `denote-prompts' is
    673   │ set to '(template subdirectory title keywords)."
    674   │   (declare (interactive-only t))
    675   │   (interactive)
    676   │   (let ((denote-prompts '(template subdirectory title keywords)))
    677   │     (call-interactively #'denote)))
    678   └────
    679 
    680   The tweaks to `denote-prompts' determine how the command will behave
    681   ([The denote-prompts option]). Use this paradigm to write your own
    682   variants which you can then assign to keys, invoke with `M-x', or add
    683   to the list of commands available at the `denote-command-prompt'
    684   ([Choose which commands to prompt for]).
    685 
    686 
    687   [Convenience commands for note creation] See section 3.1.4
    688 
    689   [The denote-templates option] See section 3.1.3
    690 
    691   [The denote-prompts option] See section 3.1.1
    692 
    693   [Choose which commands to prompt for] See section 8
    694 
    695 
    696 3.1.5 The `denote-save-buffer-after-creation' option
    697 ╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌
    698 
    699   The user option `denote-save-buffer-after-creation' controls whether
    700   commands that creeate new notes save their buffer outright.
    701 
    702   The default behaviour of commands such as `denote' (or related) is to
    703   not save the buffer they create ([Points of entry]). This gives the
    704   user the chance to review the text before writing it to a file. The
    705   user may choose to delete the unsaved buffer, thus not creating a new
    706   note ([The `denote-save-buffer-after-creation' option]).
    707 
    708   If `denote-save-buffer-after-creation' is set to a non-nil value, such
    709   buffers are saved automatically.
    710 
    711 
    712 [Points of entry] See section 3
    713 
    714 [The `denote-save-buffer-after-creation' option] See section 3.1.5
    715 
    716 
    717 3.1.6 The `denote-date-prompt-use-org-read-date' option
    718 ╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌
    719 
    720   By default, Denote uses its own simple prompt for date or date+time
    721   input ([The denote-prompts option]).  This is done when the
    722   `denote-prompts' option includes a `date' symbol and/or when the user
    723   invokes the `denote-date' command.
    724 
    725   Users who want to benefit from the more advanced date selection method
    726   that is common in interactions with Org mode, can set the user option
    727   `denote-date-prompt-use-org-read-date' to a non-nil value.
    728 
    729 
    730 [The denote-prompts option] See section 3.1.1
    731 
    732 
    733 3.2 Create a note from the current Org subtree
    734 ──────────────────────────────────────────────
    735 
    736   In Org parlance, an entry with all its subheadings and other contents
    737   is a “subtree”. Denote can operate on the subtree to extract it from
    738   the current file and create a new file out of it. One such workflow is
    739   to collect thoughts in a single document and produce longer standalone
    740   notes out of them upon review.
    741 
    742   The command `denote-org-extras-extract-org-subtree' (part of the
    743   optional `denote-org-extras.el' extension) is used for this purpose.
    744   It creates a new Denote note using the current Org subtree. In doing
    745   so, it removes the subtree from its current file and moves its
    746   contents into a new file.
    747 
    748   The text of the subtree’s heading becomes the `#+title' of the new
    749   note. Everything else is inserted as-is.
    750 
    751   If the heading has any tags, they are used as the keywords of the new
    752   note. If the Org file has any `#+filetags' they are taken as well
    753   (Org’s `#+filetags' are inherited by the headings). If none of these
    754   are true and the user option `denote-prompts' includes an entry for
    755   keywords, then `denote-org-extras-extract-org-subtree' prompts for
    756   keywords. Else the new note has no keywords ([Add or remove keywords
    757   interactively]).
    758 
    759   If the heading has a `PROPERTIES' drawer, it is retained for further
    760   review.
    761 
    762   If the heading’s `PROPERTIES' drawer includes a `DATE' or `CREATED'
    763   property, or there exists a `CLOSED' statement with a timestamp value,
    764   use that to derive the date (or date and time) of the new note (if
    765   there is only a date, the time is taken as 00:00). If more than one of
    766   these is present, the order of preference is `DATE', then `CREATED',
    767   then `CLOSED'. If none of these is present, the current time is used.
    768   If the `denote-prompts' includes an entry for a date, then the command
    769   prompts for a date at this stage (also see
    770   `denote-date-prompt-use-org-read-date').
    771 
    772   For the rest, it consults the value of the user option
    773   `denote-prompts' in the following scenaria:
    774 
    775   • To optionally prompt for a subdirectory, otherwise it produces the
    776     new note in the `denote-directory'.
    777   • To optionally prompt for a file signature, otherwise to not use any.
    778 
    779   The new note is an Org file regardless of the user option
    780   `denote-file-type'.
    781 
    782 
    783 [Add or remove keywords interactively] See section 4.7
    784 
    785 
    786 3.3 Create note using Org capture
    787 ─────────────────────────────────
    788 
    789   For integration with `org-capture', the user must first add the
    790   relevant template.  Such as:
    791 
    792   ┌────
    793   │ (with-eval-after-load 'org-capture
    794   │   (add-to-list 'org-capture-templates
    795   │ 	       '("n" "New note (with Denote)" plain
    796   │ 		 (file denote-last-path)
    797   │ 		 #'denote-org-capture
    798   │ 		 :no-save t
    799   │ 		 :immediate-finish nil
    800   │ 		 :kill-buffer t
    801   │ 		 :jump-to-captured t)))
    802   └────
    803 
    804   [ In the future, we might develop Denote in ways which do not require
    805     such manual intervention.  More user feedback is required to
    806     identify the relevant workflows. ]
    807 
    808   Once the template is added, it is accessed from the specified key.
    809   If, for instance, `org-capture' is bound to `C-c c', then the note
    810   creation is initiated with `C-c c n', per the above snippet.  After
    811   that, the process is the same as with invoking `denote' directly,
    812   namely: a prompt for a title followed by a prompt for keywords
    813   ([Standard note creation]).
    814 
    815   Users may prefer to leverage `org-capture' in order to extend file
    816   creation with the specifiers described in the `org-capture-templates'
    817   documentation (such as to capture the active region and/or create a
    818   hyperlink pointing to the given context).
    819 
    820   IMPORTANT.  Due to the particular file-naming scheme of Denote, which
    821   is derived dynamically, such specifiers or other arbitrary text cannot
    822   be written directly in the template.  Instead, they have to be
    823   assigned to the user option `denote-org-capture-specifiers', which is
    824   interpreted by the function `denote-org-capture'.  Example with our
    825   default value:
    826 
    827   ┌────
    828   │ (setq denote-org-capture-specifiers "%l\n%i\n%?")
    829   └────
    830 
    831   Note that `denote-org-capture' ignores the `denote-file-type': it
    832   always sets the Org file extension for the created note to ensure that
    833   the capture process works as intended, especially for the desired
    834   output of the `denote-org-capture-specifiers'.
    835 
    836 
    837 [Standard note creation] See section 3.1
    838 
    839 
    840 3.4 Create note with specific prompts using Org capture
    841 ───────────────────────────────────────────────────────
    842 
    843   This section assumes knowledge of how Denote+org-capture work, as
    844   explained in the previous section ([Create note using Org capture]).
    845 
    846   The previous section shows how to define an Org capture template that
    847   always prompts for a title and keywords.  There are, however, cases
    848   where the user wants more control over what kind of input Denote will
    849   prompt for.  To this end, we provide the function
    850   `denote-org-capture-with-prompts'.  Below we explain it and then show
    851   some examples of how to use it.
    852 
    853   The `denote-org-capture-with-prompts' is like `denote-org-capture' but
    854   with optional prompt parameters.
    855 
    856   When called without arguments, it does not prompt for anything.  It
    857   just returns the front matter with title and keyword fields empty and
    858   the date and identifier fields specified.  It also makes the file name
    859   consist of only the identifier plus the Org file name extension.
    860 
    861   [The file-naming scheme].
    862 
    863   Otherwise, it produces a minibuffer prompt for every non-nil value
    864   that corresponds to the `TITLE', `KEYWORDS', `SUBDIRECTORY', `DATE',
    865   and `TEMPLATE' arguments.  The prompts are those used by the standard
    866   `denote' command and all of its utility commands.
    867 
    868   [Points of entry].
    869 
    870   When returning the contents that fill in the Org capture template, the
    871   sequence is as follows: front matter, `TEMPLATE', and then the value
    872   of the user option `denote-org-capture-specifiers'.
    873 
    874   Important note: in the case of `SUBDIRECTORY' actual subdirectories
    875   must exist—Denote does not create them.  Same principle for `TEMPLATE'
    876   as templates must exist and are specified in the user option
    877   `denote-templates'.
    878 
    879   This is how one can incorporate `denote-org-capture-with-prompts' in
    880   their Org capture templates.  Instead of passing a generic `t' which
    881   makes it hard to remember what the argument means, we use semantic
    882   keywords like `:title' for our convenience (internally this does not
    883   matter as the value still counts as non-nil, so `:foo' for `TITLE' is
    884   treated the same as `:title' or `t').
    885 
    886   ┌────
    887   │ ;; This prompts for TITLE, KEYWORDS, and SUBDIRECTORY
    888   │ (add-to-list 'org-capture-templates
    889   │ 	     '("N" "New note with prompts (with denote.el)" plain
    890   │ 	       (file denote-last-path)
    891   │ 	       (function
    892   │ 		(lambda ()
    893   │ 		  (denote-org-capture-with-prompts :title :keywords :subdirectory)))
    894   │ 	       :no-save t
    895   │ 	       :immediate-finish nil
    896   │ 	       :kill-buffer t
    897   │ 	       :jump-to-captured t))
    898    899   │ ;; This prompts only for SUBDIRECTORY
    900   │ (add-to-list 'org-capture-templates
    901   │ 	     '("N" "New note with prompts (with denote.el)" plain
    902   │ 	       (file denote-last-path)
    903   │ 	       (function
    904   │ 		(lambda ()
    905   │ 		  (denote-org-capture-with-prompts nil nil :subdirectory)))
    906   │ 	       :no-save t
    907   │ 	       :immediate-finish nil
    908   │ 	       :kill-buffer t
    909   │ 	       :jump-to-captured t))
    910    911   │ ;; This prompts for TITLE and SUBDIRECTORY
    912   │ (add-to-list 'org-capture-templates
    913   │ 	     '("N" "New note with prompts (with denote.el)" plain
    914   │ 	       (file denote-last-path)
    915   │ 	       (function
    916   │ 		(lambda ()
    917   │ 		  (denote-org-capture-with-prompts :title nil :subdirectory)))
    918   │ 	       :no-save t
    919   │ 	       :immediate-finish nil
    920   │ 	       :kill-buffer t
    921   │ 	       :jump-to-captured t))
    922   └────
    923 
    924 
    925 [Create note using Org capture] See section 3.3
    926 
    927 [The file-naming scheme] See section 5
    928 
    929 [Points of entry] See section 3
    930 
    931 
    932 3.5 Create a note with the region’s contents
    933 ────────────────────────────────────────────
    934 
    935   The command `denote-region' takes the contents of the active region
    936   and then calls the `denote' command.  Once a new note is created, it
    937   inserts the contents of the region therein.  This is useful to quickly
    938   elaborate on some snippet of text or capture it for future reference.
    939 
    940   When the `denote-region' command is called with an active region, it
    941   finalises its work by calling
    942   `denote-region-after-new-note-functions'.  This is an abnormal hook,
    943   meaning that the functions added to it are called with arguments.  The
    944   arguments are two, representing the beginning and end positions of the
    945   newly inserted text.
    946 
    947   A common use-case for Org mode users is to call the command
    948   `org-insert-structure-template' after a region is inserted.  Emacs
    949   will thus prompt for a structure template, such as the one
    950   corresponding to a source block.  In this case the function added to
    951   `denote-region-after-new-note-functions' does not actually need
    952   aforementioned arguments: it can simply declare those as ignored by
    953   prefixing the argument names with an underscore (an underscore is
    954   enough, but it is better to include a name for clarity).  For example,
    955   the following will prompt for a structure template as soon as
    956   `denote-region' is done:
    957 
    958   ┌────
    959   │ (defun my-denote-region-org-structure-template (_beg _end)
    960   │   (when (derived-mode-p 'org-mode)
    961   │     (activate-mark)
    962   │     (call-interactively 'org-insert-structure-template)))
    963    964   │ (add-hook 'denote-region-after-new-note-functions #'my-denote-region-org-structure-template)
    965   └────
    966 
    967   Remember that `denote-region-after-new-note-functions' are not called
    968   if `denote-region' is used without an active region.
    969 
    970 
    971 3.6 Open an existing note or create it if missing
    972 ─────────────────────────────────────────────────
    973 
    974   Sometimes it is necessary to briefly interrupt the ongoing writing
    975   session to open an existing note or, if that is missing, to create it.
    976   This happens when a new tangential thought occurs and the user wants
    977   to confirm that an entry for it is in place.  To this end, Denote
    978   provides the command `denote-open-or-create' as well as its more
    979   flexible counterpart `denote-open-or-create-with-command'.
    980 
    981   The `denote-open-or-create' prompts to visit a file in the
    982   `denote-directory'.  At this point, the user must type in search terms
    983   that match a file name.  If the input does not return any matches and
    984   the user confirms their choice to proceed (usually by typing RET
    985   twice, depending on the minibuffer settings), `denote-open-or-create'
    986   will call the `denote' command interactively to create a new note.  It
    987   will then use whatever prompts `denote' normally has, per the user
    988   option `denote-prompts' ([Standard note creation]).  If the title
    989   prompt is involved (the default behaviour), the
    990   `denote-open-or-create' sets up this prompt to have the previous input
    991   as the default title of the note to-be-created.  This means that the
    992   user can type RET at the empty prompt to re-use what they typed in
    993   previously.  Commands to use previous inputs from the history are also
    994   available (`M-p' or `M-n' in the minibuffer, which call
    995   `previous-history-element' and `next-history-element' by default).
    996   Accessing the history is helpful to, for example, make further edits
    997   to the available text.
    998 
    999   The `denote-open-or-create-with-command' is like the above, except
   1000   when it is about to create the new note it first prompts for the
   1001   specific file-creating command to use ([Points of entry]).  For
   1002   example, the user may want to specify a signature for this new file,
   1003   so they can select the `denote-signature' command.
   1004 
   1005   Denote provides similar functionality for linking to an existing note
   1006   or creating a new one ([Link to a note or create it if missing]).
   1007 
   1008 
   1009 [Standard note creation] See section 3.1
   1010 
   1011 [Points of entry] See section 3
   1012 
   1013 [Link to a note or create it if missing] See section 7.7
   1014 
   1015 
   1016 3.7 Maintain separate directory silos for notes
   1017 ───────────────────────────────────────────────
   1018 
   1019   The user option `denote-directory' accepts a value that represents the
   1020   path to a directory, such as `~/Documents/notes'.  Normally, the user
   1021   will have one place where they store all their notes, in which case
   1022   this arrangement shall suffice.
   1023 
   1024   There is, however, the possibility to maintain separate directories of
   1025   notes.  By “separate”, we mean that they do not communicate with each
   1026   other: no linking between them, no common keywords, nothing.  Think of
   1027   the scenario where one set of notes is for private use and another is
   1028   for an employer.  We call these separate directories “silos”.
   1029 
   1030   To create silos, the user must specify a local variable at the root of
   1031   the desired directory.  This is done by creating a `.dir-locals.el'
   1032   file, with the following contents:
   1033 
   1034   ┌────
   1035   │ ;;; Directory Local Variables.  For more information evaluate:
   1036   │ ;;;
   1037   │ ;;;     (info "(emacs) Directory Variables")
   1038   1039   │ ((nil . ((denote-directory . "/path/to/silo/"))))
   1040   └────
   1041 
   1042   When inside the directory that contains this `.dir-locals.el' file,
   1043   all Denote commands/functions for note creation, linking, the
   1044   inference of available keywords, et cetera will use the silo as their
   1045   point of reference.  They will not read the global value of
   1046   `denote-directory'.  The global value of `denote-directory' is read
   1047   everywhere else except the silos.
   1048 
   1049   [Use custom commands to select a silo].
   1050 
   1051   In concrete terms, this is a representation of the directory
   1052   structures (notice the `.dir-locals.el' file is needed only for the
   1053   silos):
   1054 
   1055   ┌────
   1056   │ ;; This is the global value of 'denote-directory' (no need for a .dir-locals.el)
   1057   │ ~/Documents/notes
   1058   │ |-- 20210303T120534--this-is-a-test__journal_philosophy.txt
   1059   │ |-- 20220303T120534--another-sample__journal_testing.md
   1060   │ `-- 20220620T181255--the-third-test__keyword.org
   1061   1062   │ ;; A silo with notes for the employer
   1063   │ ~/different/path/to/notes-for-employer
   1064   │ |-- .dir-locals.el
   1065   │ |-- 20210303T120534--this-is-a-test__conference.txt
   1066   │ |-- 20220303T120534--another-sample__meeting.md
   1067   │ `-- 20220620T181255--the-third-test__keyword.org
   1068   1069   │ ;; Another silo with notes for my volunteering
   1070   │ ~/different/path/to/notes-for-volunteering
   1071   │ |-- .dir-locals.el
   1072   │ |-- 20210303T120534--this-is-a-test__activism.txt
   1073   │ |-- 20220303T120534--another-sample__teambuilding.md
   1074   │ `-- 20220620T181255--the-third-test__keyword.org
   1075   └────
   1076 
   1077   It is possible to configure other user options of Denote to have a
   1078   silo-specific value.  For example, this one changes the
   1079   `denote-known-keywords' only for this particular silo:
   1080 
   1081   ┌────
   1082   │ ;;; Directory Local Variables.  For more information evaluate:
   1083   │ ;;;
   1084   │ ;;;     (info "(emacs) Directory Variables")
   1085   1086   │ ((nil . ((denote-directory . "/path/to/silo/")
   1087   │ 	 (denote-known-keywords . ("food" "drink")))))
   1088   └────
   1089 
   1090   This one is like the above, but also disables `denote-infer-keywords':
   1091 
   1092   ┌────
   1093   │ ;;; Directory Local Variables.  For more information evaluate:
   1094   │ ;;;
   1095   │ ;;;     (info "(emacs) Directory Variables")
   1096   1097   │ ((nil . ((denote-directory . "/path/to/silo/")
   1098   │ 	 (denote-known-keywords . ("food" "drink"))
   1099   │ 	 (denote-infer-keywords . nil))))
   1100   └────
   1101 
   1102   To expand the list of local variables to, say, cover specific major
   1103   modes, we can do something like this:
   1104 
   1105   ┌────
   1106   │ ;;; Directory Local Variables.  For more information evaluate:
   1107   │ ;;;
   1108   │ ;;;     (info "(emacs) Directory Variables")
   1109   1110   │ ((nil . ((denote-directory . "/path/to/silo/")
   1111   │ 	 (denote-known-keywords . ("food" "drink"))
   1112   │ 	 (denote-infer-keywords . nil)))
   1113   │  (org-mode . ((org-hide-emphasis-markers . t)
   1114   │ 	      (org-hide-macro-markers . t)
   1115   │ 	      (org-hide-leading-stars . t))))
   1116   └────
   1117 
   1118   As not all user options have a “safe” local value, Emacs will ask the
   1119   user to confirm their choice and to store it in the Custom code
   1120   snippet that is normally appended to init file (or added to the file
   1121   specified by the user option `custom-file').
   1122 
   1123   Finally, it is possible to have a `.dir-locals.el' for subdirectories
   1124   of any `denote-directory'.  Perhaps to specify a different set of
   1125   known keywords, while not making the subdirectory a silo in its own
   1126   right.  We shall not expand on such an example, as we trust the user
   1127   to experiment with the best setup for their workflow.
   1128 
   1129   Feel welcome to ask for help if the information provided herein is not
   1130   sufficient.  The manual shall be expanded accordingly.
   1131 
   1132 
   1133 [Use custom commands to select a silo] See section 3.7.1
   1134 
   1135 3.7.1 Use custom commands to select a silo
   1136 ╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌
   1137 
   1138   [ As part of version 2.1.0, the contents of this section are formally
   1139     provided in the file `denote-silo-extras.el'.  We keep this here for
   1140     existing users.  Otherwise consult the new entry in the manual ([The
   1141     `denote-silo-extras.el']). ]
   1142 
   1143   We implement silos as directory-local values of the user option
   1144   `denote-directory'.  This means that all Denote commands read from the
   1145   local value if they are invoked from that context.  For example, if
   1146   `~/Videos/recordings' is a silo and `~/Documents/notes' is the
   1147   default/global value of `denote-directory' all Denote commands will
   1148   read the video’s path when called from there (e.g. by using Emacs’
   1149   `dired'); any other context reads the global value.
   1150 
   1151   [Maintain separate directory silos for notes].
   1152 
   1153   There are cases where the user (i) wants to maintain multiple silos
   1154   and (ii) prefers an interactive way to switch between them without
   1155   going through Dired.  Since this is specific to the user’s workflow,
   1156   it is easier to have some custom code for it.  The following should be
   1157   added to the user’s Denote configuration:
   1158 
   1159   ┌────
   1160   │ (defvar my-denote-silo-directories
   1161   │   `("/home/prot/Videos/recordings"
   1162   │     "/home/prot/Documents/books"
   1163   │     ;; You don't actually need to include the `denote-directory' here
   1164   │     ;; if you use the regular commands in their global context.  I am
   1165   │     ;; including it for completeness.
   1166   │     ,denote-directory)
   1167   │   "List of file paths pointing to my Denote silos.
   1168   │   This is a list of strings.")
   1169   1170   │ (defvar my-denote-commands-for-silos
   1171   │   '(denote
   1172   │     denote-date
   1173   │     denote-subdirectory
   1174   │     denote-template
   1175   │     denote-type)
   1176   │   "List of Denote commands to call after selecting a silo.
   1177   │   This is a list of symbols that specify the note-creating
   1178   │   interactive functions that Denote provides.")
   1179   1180   │ (defun my-denote-pick-silo-then-command (silo command)
   1181   │   "Select SILO and run Denote COMMAND in it.
   1182   │   SILO is a file path from `my-denote-silo-directories', while
   1183   │   COMMAND is one among `my-denote-commands-for-silos'."
   1184   │   (interactive
   1185   │    (list (completing-read "Select a silo: " my-denote-silo-directories nil t)
   1186   │ 	 (intern (completing-read
   1187   │ 		  "Run command in silo: "
   1188   │ 		  my-denote-commands-for-silos nil t))))
   1189   │   (let ((denote-directory silo))
   1190   │     (call-interactively command)))
   1191   └────
   1192 
   1193   With this in place, `M-x my-denote-pick-silo-then-command' will use
   1194   minibuffer completion to select a silo among the predefined options
   1195   and then ask for the command to run in that context.
   1196 
   1197   Note that `let' binding `denote-directory' can be used in custom
   1198   commands and other wrapper functions to override the global default
   1199   value of `denote-directory' to select silos.
   1200 
   1201   To see another example of a wrapper function that `let' binds
   1202   `denote-directory', see:
   1203 
   1204   [Extending Denote: Split an Org subtree into its own note].
   1205 
   1206 
   1207 [The `denote-silo-extras.el'] See section 3.7.2
   1208 
   1209 [Maintain separate directory silos for notes] See section 3.7
   1210 
   1211 [Extending Denote: Split an Org subtree into its own note] See section
   1212 3.2
   1213 
   1214 
   1215 3.7.2 The `denote-silo-extras.el'
   1216 ╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌
   1217 
   1218   The `denote-silo-extras.el' provides optional convenience functions
   1219   for working with silos ([Maintain separate directory silos for
   1220   notes]).  Start by loading the relevant library:
   1221 
   1222   ┌────
   1223   │ (require 'denote-silo-extras)
   1224   └────
   1225 
   1226   The user option `denote-silo-extras-directories' specifies a list of
   1227   directories that the user has set up as `denote-directory' silos.
   1228 
   1229   The command `denote-silo-extras-create-note' prompts for a directory
   1230   among `denote-silo-extras-directories' and runs the `denote' command
   1231   from there.
   1232 
   1233   Similar to the above, the command `denote-silo-extras-open-or-create'
   1234   prompts for a directory among `denote-silo-extras-directories' and
   1235   runs the `denote-open-or-create' command from there.
   1236 
   1237   The command `denote-silo-extras-select-silo-then-command' prompts with
   1238   minibuffer completion for a directory among
   1239   `denote-silo-extras-directories'.  Once the user selects a silo, a
   1240   second prompt asks for a Denote note-creation command to call from
   1241   inside that silo ([Points of entry]).
   1242 
   1243 
   1244 [Maintain separate directory silos for notes] See section 3.7
   1245 
   1246 [Points of entry] See section 3
   1247 
   1248 
   1249 3.8 Exclude certain directories from all operations
   1250 ───────────────────────────────────────────────────
   1251 
   1252   The user option `denote-excluded-directories-regexp' instructs all
   1253   Denote functions that read or check file/directory names to omit
   1254   directories that match the given regular expression.  The regexp needs
   1255   to match only the name of the directory, not its full path.
   1256 
   1257   Affected operations include file prompts and functions that return the
   1258   available files in the value of the user option `denote-directory'
   1259   ([Maintain separate directory silos for notes]).
   1260 
   1261   File prompts are used by several commands, such as `denote-link' and
   1262   `denote-subdirectory'.
   1263 
   1264   Functions that check for files include `denote-directory-files' and
   1265   `denote-directory-subdirectories'.
   1266 
   1267   The match is performed with `string-match-p'.
   1268 
   1269   [For developers or advanced users].
   1270 
   1271 
   1272 [Maintain separate directory silos for notes] See section 3.7
   1273 
   1274 [For developers or advanced users] See section 18
   1275 
   1276 
   1277 3.9 Exclude certain keywords from being inferred
   1278 ────────────────────────────────────────────────
   1279 
   1280   The user option `denote-excluded-keywords-regexp' omits keywords that
   1281   match a regular expression from the list of inferred keywords.
   1282 
   1283   Keywords are inferred from file names and provided at relevant prompts
   1284   as completion candidates when the user option `denote-infer-keywords'
   1285   is non-nil.
   1286 
   1287   The match is performed with `string-match-p'.
   1288 
   1289 
   1290 3.10 Use Denote commands from the menu bar or context menu
   1291 ──────────────────────────────────────────────────────────
   1292 
   1293   Denote registers a submenu for the `menu-bar-mode'.  Users will find
   1294   the entry called “Denote”.  From there they can use their pointer to
   1295   select a command.  For a sample of how this looks, read the
   1296   development log:
   1297   <https://protesilaos.com/codelog/2023-03-31-emacs-denote-menu/>.
   1298 
   1299   The command `denote-menu-bar-mode' toggles the presentation of the
   1300   menu. It is enabled by default.
   1301 
   1302   Emacs also provides support for operations through a context menu.
   1303   This is typically the set of actions that are made available via a
   1304   right mouse click.  Users who enable `context-menu-mode' can register
   1305   the Denote entry for it by adding the following to their configuration
   1306   file:
   1307 
   1308   ┌────
   1309   │ (add-hook 'context-menu-functions #'denote-context-menu)
   1310   └────
   1311 
   1312 
   1313 4 Renaming files
   1314 ════════════════
   1315 
   1316   Denote provides commands to rename files and update their front matter
   1317   where relevant.  For Denote to work, only the file name needs to be in
   1318   order, by following our naming conventions ([The file-naming scheme]).
   1319   The linking mechanism, in particular, needs just the identifier in the
   1320   file name ([Linking notes]).
   1321 
   1322   We write front matter in notes for the user’s convenience and for
   1323   other tools to make use of that information (e.g. Org’s export
   1324   mechanism).  The renaming mechanism takes care to keep this data in
   1325   sync with the file name, when the user performs a change.
   1326 
   1327   Renaming is useful for managing existing files created with Denote,
   1328   but also for converting older text files to Denote notes.  Denote’s
   1329   file-naming scheme is not specific to notes or text files: it is
   1330   relevant for all sorts of items, such as multimedia and PDFs that form
   1331   part of the user’s longer-term storage.  While Denote does not manage
   1332   such files (e.g. doesn’t create links to them), it already has all the
   1333   mechanisms to facilitate the task of renaming them.
   1334 
   1335   All renaming commands run the `denote-after-rename-file-hook' after a
   1336   succesful operation.
   1337 
   1338   Apart from renaming files, Denote can also rename only the buffer.
   1339   The idea is that the underlying file name is correct but it can be
   1340   easier to use shorter buffer names when displaying them on the mode
   1341   line or switching between then with commands like `switch-to-buffer'.
   1342 
   1343   [Automatically rename Denote buffers].
   1344 
   1345 
   1346 [The file-naming scheme] See section 5
   1347 
   1348 [Linking notes] See section 7
   1349 
   1350 [Automatically rename Denote buffers] See section 10
   1351 
   1352 4.1 Rename a single file
   1353 ────────────────────────
   1354 
   1355   The `denote-rename-file' command renames a file and updates existing
   1356   front matter if appropriate. It is possible to do the same with
   1357   multiple files ([Rename multiple files interactively]).
   1358 
   1359   It always renames the file where it is located in the file system: it
   1360   never moves it to another directory.
   1361 
   1362   If in Dired, it considers `FILE' to be the one at point, else it
   1363   prompts with minibuffer completion for one. When called from Lisp,
   1364   `FILE' is a file system path represented as a string.
   1365 
   1366   If `FILE' has a Denote-compliant identifier, it retains it while
   1367   updating components of the file name referenced by the user option
   1368   `denote-prompts' ([The `denote-prompts' option]). By default, these
   1369   are the `TITLE' and `KEYWORDS'. The `SIGNATURE' is another one. When
   1370   called from Lisp, `TITLE' and `SIGNATURE' are strings, while
   1371   `KEYWORDS' is a list of strings.
   1372 
   1373   If there is no identifier, `denote-rename-file' creates an identifier
   1374   based on the following conditions:
   1375 
   1376   1. If the `denote-prompts' includes an entry for date prompts, then it
   1377      prompts for `DATE' and takes its input to produce a new
   1378      identifier. For use in Lisp, `DATE' must conform with
   1379      `denote-valid-date-p'.
   1380 
   1381   2. If `DATE' is nil (e.g. when `denote-prompts' does not include a
   1382      date entry), it uses the file attributes to determine the last
   1383      modified date of `FILE' and formats it as an identifier.
   1384 
   1385   3. As a fallback, it derives an identifier from the current date and
   1386      time.
   1387 
   1388   4. At any rate, if the resulting identifier is not unique among the
   1389      files in the variable `denote-directory', it increments it such
   1390      that it becomes unique.
   1391 
   1392   In interactive use, and assuming `denote-prompts' includes a title
   1393   entry, the `denote-rename-file' makes the `TITLE' prompt have
   1394   prefilled text in the minibuffer that consists of the current title of
   1395   `FILE'. The current title is either retrieved from the front matter
   1396   (such as the `#+title' in Org) or from the file name.
   1397 
   1398   The command does the same for the `SIGNATURE' prompt, subject to
   1399   `denote-prompts', by prefilling the minibuffer with the current
   1400   signature of `FILE', if any.
   1401 
   1402   Same principle for the `KEYWORDS' prompt: it converts the keywords in
   1403   the file name into a comma-separated string and prefills the
   1404   minibuffer with it (the `KEYWORDS' prompt accepts more than one
   1405   keywords, each separated by a comma, else the `crm-separator').
   1406 
   1407   For all prompts, the `denote-rename-file' interprets an empty input as
   1408   an instruction to remove that file name component. For example, if a
   1409   `TITLE' prompt is available and `FILE' is
   1410   `20240211T093531--some-title__keyword1.org' then it renames `FILE' to
   1411   `20240211T093531__keyword1.org'. If a file name component is present,
   1412   but there is no entry for it in `denote-prompts', keep it as-is.
   1413 
   1414   [ NOTE: Please check with your minibuffer user interface how to
   1415     provide an empty input. The Emacs default setup accepts the empty
   1416     minibuffer contents as they are, though popular packages like
   1417     `vertico' use the first available completion candidate instead. For
   1418     `vertico', the user must either move one up to select the prompt and
   1419     then type `RET' there with empty contents, or use the command
   1420     `vertico-exit-input' with empty contents. That Vertico command is
   1421     bound to `M-RET' as of this writing on 2024-02-13 08:08 +0200. ]
   1422 
   1423   When renaming `FILE', the command reads its file type extension (like
   1424   `.org') and preserves it through the renaming process. Files that have
   1425   no extension are left without one.
   1426 
   1427   As a final step, it asks for confirmation, showing the difference
   1428   between old and new file names. It does not ask for confirmation if
   1429   the user option `denote-rename-no-confirm' is set to a non-nil value
   1430   ([The `denote-rename-no-confirm' option]).
   1431 
   1432   If `FILE' has front matter for `TITLE' and `KEYWORDS',
   1433   `denote-rename-file' asks to rewrite their values in order to reflect
   1434   the new input, unless `denote-rename-no-confirm' is non-nil. When the
   1435   `denote-rename-no-confirm' is nil (the default), the underlying buffer
   1436   is not saved, giving the user the change to invoking
   1437   `diff-buffer-with-file' to double-check the effect. The rewrite of the
   1438   `TITLE' and `KEYWORDS' in the front matter should not affect the rest
   1439   of the front matter.
   1440 
   1441   If the file does not have front matter but is among the supported file
   1442   types (per `denote-file-type'), the `denote-rename-file' adds front
   1443   matter to the top of it and leaves the buffer unsaved for further
   1444   inspection. It actually saves the buffer if `denote-rename-no-confirm'
   1445   is non-nil ([Front matter]).
   1446 
   1447   This command is intended to (i) rename Denote files, (ii) convert
   1448   existing supported file types to Denote notes, and (ii) rename
   1449   non-note files (e.g. `PDF') that can benefit from Denote’s file-naming
   1450   scheme.
   1451 
   1452   For a version of this command that works with multiple files
   1453   one-by-one, use `denote-dired-rename-files' ([Rename multiple files
   1454   interactively]).
   1455 
   1456 
   1457 [Rename multiple files interactively] See section 4.3
   1458 
   1459 [The `denote-prompts' option] See section 3.1.1
   1460 
   1461 [The `denote-rename-no-confirm' option] See section 4.1.1
   1462 
   1463 [Front matter] See section 6
   1464 
   1465 4.1.1 The `denote-rename-no-confirm' option
   1466 ╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌
   1467 
   1468   The user option `denote-rename-no-confirm' makes all commands that
   1469   rename files not prompt for confirmation and save buffers outright
   1470   ([Renaming files]).
   1471 
   1472   This affects the behaviour of the commands `denote-rename-file',
   1473   `denote-dired-rename-files', `denote-rename-file-using-front-matter',
   1474   `denote-dired-rename-marked-files-with-keywords',
   1475   `denote-dired-rename-marked-files-using-front-matter',
   1476   `denote-keywords-add', `denote-keywords-remove', and any other command
   1477   that builds on top of them.
   1478 
   1479   The default behaviour of the `denote-rename-file' command (and others
   1480   like it) is to ask for an affirmative answer as a final step before
   1481   changing the file name and, where relevant, inserting or updating the
   1482   corresponding front matter. It also does not save the affected file’s
   1483   buffer to let the user inspect and confirm the changes (such as by
   1484   invoking the command `diff-buffer-with-file').
   1485 
   1486   With this user option bound to a non-nil value, buffers are saved as
   1487   well. The assumption is that the user who opts in to this feature is
   1488   familiar with the `denote-rename-file' (or related) operation and
   1489   knows it is reliable.
   1490 
   1491   Specialised commands that build on top of `denote-rename-file' (or
   1492   related) may internally bind this user option to a non-nil value in
   1493   order to perform their operation (e.g. `denote-dired-rename-files'
   1494   goes through each marked Dired file, prompting for the information to
   1495   use, but carries out the renaming without asking for confirmation
   1496   ([Rename multiple files interactively])).
   1497 
   1498 
   1499 [Renaming files] See section 4
   1500 
   1501 [Rename multiple files interactively] See section 4.3
   1502 
   1503 
   1504 4.2 Rename a single file based on its front matter
   1505 ──────────────────────────────────────────────────
   1506 
   1507   In the previous section, we covered the more general mechanism of the
   1508   command `denote-rename-file' ([Rename a single file]).  There is also
   1509   a way to have the same outcome by making Denote read the data in the
   1510   current file’s front matter and use it to construct/update the file
   1511   name.  The command for this is
   1512   `denote-rename-file-using-front-matter'.  It is only relevant for
   1513   files that (i) are among the supported file types, per
   1514   `denote-file-type', and (ii) have the requisite front matter in place.
   1515 
   1516   Suppose you have an `.org' file with this front matter ([Front
   1517   matter]):
   1518 
   1519   ┌────
   1520   │ #+title:      My sample note file
   1521   │ #+date:       [2022-08-05 Fri 13:10]
   1522   │ #+filetags:   :testing:
   1523   │ #+identifier: 20220805T131044
   1524   └────
   1525 
   1526   Its file name reflects this information:
   1527 
   1528   ┌────
   1529   │ 20220805T131044--my-sample-note-file__testing.org
   1530   └────
   1531 
   1532 
   1533   You want to change its title and keywords manually, so you modify it
   1534   thus:
   1535 
   1536   ┌────
   1537   │ #+title:      My modified sample note file
   1538   │ #+date:       [2022-08-05 Fri 13:10]
   1539   │ #+filetags:   :testing:denote:emacs:
   1540   │ #+identifier: 20220805T131044
   1541   └────
   1542 
   1543   At this stage, the file name still shows the old title and keywords.
   1544   You now invoke `denote-rename-file-using-front-matter' and it updates
   1545   the file name to:
   1546 
   1547   ┌────
   1548   │ 20220805T131044--my-modified-sample-note-file__testing_denote_emacs.org
   1549   └────
   1550 
   1551 
   1552   The renaming is subject to a “yes or no” prompt that shows the old and
   1553   new names, just so the user is certain about the change.
   1554 
   1555   If called interactively with a prefix argument (`C-u' by default) or
   1556   from Lisp with a non-nil `NO-CONFIRM' argument, this “yes or no”
   1557   prompt is skipped and the renaming is done outright.
   1558 
   1559   If called interactively with a double prefix argument (`C-u C-u' by
   1560   default) or from Lisp with a non-nil `SAVE-BUFFER' argument, the
   1561   buffer is saved after the front matter is updated and the file is
   1562   renamed.
   1563 
   1564   If the user option `denote-rename-no-confirm' is non-nil, it is
   1565   interpreted the same way as a combination of `NO-CONFIRM' and
   1566   `SAVE-BUFFER' ([The `denote-rename-no-confirm' option]).
   1567 
   1568   The identifier of the file, if any, is never modified even if it is
   1569   edited in the front matter: Denote considers the file name to be the
   1570   source of truth in this case, to avoid potential breakage with typos
   1571   and the like.
   1572 
   1573 
   1574 [Rename a single file] See section 4.1
   1575 
   1576 [Front matter] See section 6
   1577 
   1578 [The `denote-rename-no-confirm' option] See section 4.1.1
   1579 
   1580 
   1581 4.3 Rename multiple files interactively
   1582 ───────────────────────────────────────
   1583 
   1584   The command `denote-dired-rename-files' (alias
   1585   `denote-dired-rename-marked-files') renames the files that are marked
   1586   in a Dired buffer. Its behaviour is similar to the
   1587   `denote-rename-file' in that it prompts for a title, keywords, and
   1588   signature ([Rename a single file]). It does so over each marked file,
   1589   renaming one after the other.
   1590 
   1591   Unlike `denote-rename-file', the command `denote-dired-rename-files'
   1592   does not ask to confirm the changes made to the files: it performs
   1593   them outright. This is done to make it easier to rename multiple files
   1594   without having to confirm each step. For an even more direct approach,
   1595   check the command `denote-dired-rename-marked-files-with-keywords'.
   1596 
   1597   • [Rename by writing only keywords]
   1598   • [Rename multiple files based on their front matter]
   1599 
   1600 
   1601 [Rename a single file] See section 4.1
   1602 
   1603 [Rename by writing only keywords] See section 4.4
   1604 
   1605 [Rename multiple files based on their front matter] See section 4.5
   1606 
   1607 
   1608 4.4 Rename multiple files at once by asking only for keywords
   1609 ─────────────────────────────────────────────────────────────
   1610 
   1611   The `denote-dired-rename-marked-files-with-keywords' command renames
   1612   marked files in Dired to conform with our file-naming scheme. It does
   1613   so by writing keywords to them. Specifically, it does the following:
   1614 
   1615   • retains the file’s existing name and makes it the `TITLE' field, per
   1616     Denote’s file-naming scheme;
   1617 
   1618   • sluggifies the `TITLE' and adjusts its letter casing, according to
   1619     our conventions;
   1620 
   1621   • prepends an identifier to the `TITLE', if one is missing;
   1622 
   1623   • preserves the file’s extension, if any;
   1624 
   1625   • prompts once for `KEYWORDS' and applies the user’s input to the
   1626     corresponding field in the file name, rewriting any keywords that
   1627     may exist while removing keywords that do exist if `KEYWORDS' is
   1628     empty;
   1629 
   1630   • adds or rewrites existing front matter to the underlying file, if it
   1631     is recognized as a Denote note (per the `denote-file-type' user
   1632     option), such that it includes the new keywords.
   1633 
   1634   [ Note that the affected buffers are not saved, unless the user option
   1635     `denote-rename-no-confirm' is non-nil. Users can thus check them to
   1636     confirm that the new front matter does not cause any problems (e.g.
   1637     with the `diff-buffer-with-file' command). Multiple buffers can be
   1638     saved in one go with the command `save-some-buffers' (read its doc
   1639     string). ]
   1640 
   1641 
   1642 4.5 Rename multiple files based on their front matter
   1643 ─────────────────────────────────────────────────────
   1644 
   1645   As already noted, Denote can rename a file based on the data in its
   1646   front matter ([Rename a single file based on its front matter]).  The
   1647   command `denote-dired-rename-marked-files-using-front-matter' extends
   1648   this principle to a batch operation which applies to all marked files
   1649   in Dired.
   1650 
   1651   Marked files must count as notes for the purposes of Denote, which
   1652   means that they at least have an identifier in their file name and use
   1653   a supported file type, per `denote-file-type'. Files that do not meet
   1654   this criterion are ignored, because Denote cannot know if they have
   1655   front matter and what that may be. For such files, it is still
   1656   possible to rename them interactively ([Rename multiple files
   1657   interactively]).
   1658 
   1659 
   1660 [Rename a single file based on its front matter] See section 4.2
   1661 
   1662 [Rename multiple files interactively] See section 4.3
   1663 
   1664 
   1665 4.6 Rename a file by changing only its file type
   1666 ────────────────────────────────────────────────
   1667 
   1668   The command `denote-change-file-type-and-front-matter' provides the
   1669   convenience of converting a note taken in one file type, say, `.txt'
   1670   into another like `.org'. It presents a choice among the
   1671   `denote-file-type' options.
   1672 
   1673   The conversion does NOT modify the existing front matter.  Instead, it
   1674   prepends new front matter to the top of the file.  We do this as a
   1675   safety precaution since the user can, in principle, add arbitrary
   1676   extras to their front matter that we would not want to touch.
   1677 
   1678   If in Dired, `denote-change-file-type-and-front-matter' operates on
   1679   the file at point, else it prompts with minibuffer completion for one.
   1680 
   1681   The title of the file is retrieved from a line starting with a title
   1682   field in the file’s front matter, depending on the previous file type
   1683   (e.g.  `#+title' for Org).  The same process applies for keywords.
   1684 
   1685   As a final step, the command asks for confirmation, showing the
   1686   difference between old and new file names.
   1687 
   1688 
   1689 4.7 Rename a file by adding or removing keywords interactively
   1690 ──────────────────────────────────────────────────────────────
   1691 
   1692   The commands `denote-keywords-add' and `denote-keywords-remove'
   1693   streamline the process of interactively updating a file’s keywords in
   1694   the front matter and renaming it accordingly.
   1695 
   1696   The `denote-keywords-add' asks for keywords using the familiar
   1697   minibuffer prompt ([Standard note creation]).  It then renames the
   1698   file ([Rename a single file based on its front matter]).
   1699 
   1700   Similarly, the `denote-keywords-remove' removes one or more keywords
   1701   from the list of existing keywords and then renames the file
   1702   accordingly.
   1703 
   1704   Both commands accept an optional prefix argument to automatically save
   1705   the buffer. Similarly, they both interpret a non-nil value for the
   1706   user option `denote-rename-no-confirm' the same as the prefix argument
   1707   ([The `denote-rename-no-confirm' option]).
   1708 
   1709   Furthermore, both commands call the `denote-after-rename-file-hook' as
   1710   a final step after carrying out their task.
   1711 
   1712   Aliases for these commands are: `denote-rename-add-keywords' and
   1713   `denote-rename-remove-keywords'.
   1714 
   1715 
   1716 [Standard note creation] See section 3.1
   1717 
   1718 [Rename a single file based on its front matter] See section 4.2
   1719 
   1720 [The `denote-rename-no-confirm' option] See section 4.1.1
   1721 
   1722 
   1723 4.8 Rename a file by adding or removing a signature interactively
   1724 ─────────────────────────────────────────────────────────────────
   1725 
   1726   The commands `denote-rename-add-signature' and
   1727   `denote-rename-remove-signature' streamline the process of
   1728   interactively adding or removing a signature from a given file ([The
   1729   file-naming scheme]).
   1730 
   1731   The `denote-rename-add-signature' prompts for a file and a
   1732   signature. The default value for the file prompt is the file of the
   1733   currently open buffer or the file-at-point in a Dired buffer. The
   1734   signature is an ordinary string, defaulting to the selected file’s
   1735   signature, if any.
   1736 
   1737   The `denote-rename-remove-signature' uses the same file prompt as
   1738   above. It performs its action only if the selected file has a
   1739   signature. Otherwise, it does nothing.
   1740 
   1741   Both commands ask for confirmation before carrying out their action.
   1742   They do so unless the user option `denote-rename-no-confirm' is set to
   1743   a non-nil value ([The `denote-rename-no-confirm' option]). They also
   1744   both take care to reload any Dired buffers and run the
   1745   `denote-after-rename-file-hook' as a final step.
   1746 
   1747 
   1748 [The file-naming scheme] See section 5
   1749 
   1750 [The `denote-rename-no-confirm' option] See section 4.1.1
   1751 
   1752 
   1753 4.9 Faces used by rename commands
   1754 ─────────────────────────────────
   1755 
   1756   These are the faces used by the various Denote rename commands to
   1757   style or highlight the old/new/current file shown in the relevant
   1758   minibuffer prompts:
   1759 
   1760   • `denote-faces-prompt-current-name'
   1761   • `denote-faces-prompt-new-name'
   1762   • `denote-faces-prompt-old-name'
   1763 
   1764 
   1765 5 The file-naming scheme
   1766 ════════════════════════
   1767 
   1768   Notes are stored in the `denote-directory'.  The default path is
   1769   `~/Documents/notes'.  The `denote-directory' can be a flat listing,
   1770   meaning that it has no subdirectories, or it can be a directory tree.
   1771   Either way, Denote takes care to only consider “notes” as valid
   1772   candidates in the relevant operations and will omit other files or
   1773   directories.
   1774 
   1775   Every note produced by Denote follows this pattern by default ([Points
   1776   of entry]):
   1777 
   1778   ┌────
   1779   │ DATE==SIGNATURE--TITLE__KEYWORDS.EXTENSION
   1780   └────
   1781 
   1782 
   1783   The `DATE' field represents the date in year-month-day format followed
   1784   by the capital letter `T' (for “time”) and the current time in
   1785   hour-minute-second notation.  The presentation is compact:
   1786   `20220531T091625'.  The `DATE' serves as the unique identifier of each
   1787   note and, as such, is also known as the file’s ID or identifier.
   1788 
   1789   File names can include a string of alphanumeric characters in the
   1790   `SIGNATURE' field. Signatures have no clearly defined purpose and are
   1791   up to the user to define. One use-case is to use them to establish
   1792   sequential relations between files (e.g. 1, 1a, 1b, 1b1, 1b2, …).
   1793 
   1794   Signatures are an optional extension to Denote’s file-naming scheme.
   1795   They can be added to newly created files on demand, with the command
   1796   `denote-signature', or by modifying the value of the user option
   1797   `denote-prompts'.
   1798 
   1799   The `TITLE' field is the title of the note, as provided by the user.
   1800   It automatically gets downcased by default and is also hyphenated
   1801   ([Sluggification of file name components]).  An entry about “Economics
   1802   in the Euro Area” produces an `economics-in-the-euro-area' string for
   1803   the `TITLE' of the file name.
   1804 
   1805   The `KEYWORDS' field consists of one or more entries demarcated by an
   1806   underscore (the separator is inserted automatically).  Each keyword is
   1807   a string provided by the user at the relevant prompt which broadly
   1808   describes the contents of the entry.
   1809 
   1810   Each of the keywords is a single word, with multiple keywords
   1811   providing the multi-dimensionality needed for advanced searches
   1812   through Denote files.  Users who need to compose a keyword out of
   1813   multiple words such as camelCase/CamelCase and are encouraged to use
   1814   the `denote-file-name-slug-functions' user option accordingly
   1815   ([Sluggification of file name components]).
   1816 
   1817   The `EXTENSION' is the file type.  By default, it is `.org'
   1818   (`org-mode') though the user option `denote-file-type' provides
   1819   support for Markdown with YAML or TOML variants (`.md' which runs
   1820   `markdown-mode') and plain text (`.txt' via `text-mode').  Consult its
   1821   doc string for the minutiae.  While files end in the `.org' extension
   1822   by default, the Denote code base does not actually depend on org.el
   1823   and/or its accoutrements.
   1824 
   1825   Examples:
   1826 
   1827   ┌────
   1828   │ 20220610T043241--initial-thoughts-on-the-zettelkasten-method__notetaking.org
   1829   │ 20220610T062201--define-custom-org-hyperlink-type__denote_emacs_package.md
   1830   │ 20220610T162327--on-hierarchy-and-taxis__notetaking_philosophy.txt
   1831   └────
   1832 
   1833 
   1834   The different field separators, namely `--' and `__' introduce an
   1835   efficient way to anchor searches (such as with Emacs commands like
   1836   `isearch' or from the command-line with `find' and related).  A query
   1837   for `_word' always matches a keyword, while a regexp in the form of,
   1838   say, `"\\([0-9T]+?\\)--\\(.*?\\)_"' captures the date in group `\1'
   1839   and the title in `\2' (test any regular expression in the current
   1840   buffer by invoking `M-x re-builder').
   1841 
   1842   [Features of the file-naming scheme for searching or filtering].
   1843 
   1844   The `denote-prompts' can be configured in such ways to yield the
   1845   following file name permutations:
   1846 
   1847   ┌────
   1848   │ DATE.EXT
   1849   │ DATE--TITLE.EXT
   1850   │ DATE__KEYWORDS.EXT
   1851   │ DATE==SIGNATURE.EXT
   1852   │ DATE==SIGNATURE--TITLE.EXT
   1853   │ DATE==SIGNATURE--TITLE__KEYWORDS.EXT
   1854   │ DATE==SIGNATURE__KEYWORDS.EXT
   1855   └────
   1856 
   1857 
   1858   When in doubt, stick to the default design.
   1859 
   1860   While Denote is an Emacs package, notes should work long-term and not
   1861   depend on the functionality of a specific program.  The file-naming
   1862   scheme we apply guarantees that a listing is readable in a variety of
   1863   contexts.  The Denote file-naming scheme is, in essence, an effective,
   1864   low-tech invention.
   1865 
   1866 
   1867 [Points of entry] See section 3
   1868 
   1869 [Sluggification of file name components] See section 5.1
   1870 
   1871 [Features of the file-naming scheme for searching or filtering] See
   1872 section 5.3
   1873 
   1874 5.1 Sluggification of file name components
   1875 ──────────────────────────────────────────
   1876 
   1877   Files names can contain any character that the file system
   1878   permits. Denote imposes a few additional restrictions:
   1879 
   1880   ⁃ The tokens “`=", =__' and `--' are interpreted by Denote and should
   1881     appear only once.
   1882 
   1883   ⁃ The dot character is not allowed in a note’s file name, except to
   1884     indicate the file type extension. Denote recognises two extensions
   1885     for encrypted files, like `.txt.gpg'.
   1886 
   1887   By default, Denote enforces other rules to file names through the user
   1888   option `denote-file-name-slug-functions'. These rules are applied to
   1889   file names by default:
   1890 
   1891   ⁃ What we count as “illegal characters” are removed.  The constant
   1892     `denote-excluded-punctuation-regexp' holds the relevant value.
   1893 
   1894   ⁃ Input for a file title is hyphenated.  The original value is
   1895     preserved in the note’s contents ([Front matter]).
   1896 
   1897   ⁃ Spaces or other delimiters are removed from keywords, meaning that
   1898     `hello-world' becomes `helloworld'.  This is because hyphens in
   1899     keywords do not work everywhere, such as in Org. Plus, hyphens are
   1900     word separators in the title and we want to keep distinct separators
   1901     for each component to make search easier and semantic ([Features of
   1902     the file-naming scheme for searching or filtering]).
   1903 
   1904   ⁃ Signatures are like the above, but use the equals sign instead of
   1905     hyphens as a word separator.
   1906 
   1907   ⁃ All file name components are downcased. Further down we document how
   1908     to deviate from these rules, such as to accept input of the form
   1909     `helloWorld' or `HelloWorld' verbatim.
   1910 
   1911   Denote imposes these restrictions to enforce uniformity, which is
   1912   helpful long-term as it keeps all files with the same predictable
   1913   pattern. Too many permutations make searches more difficult to express
   1914   accurately and be confident that the matches cover all files.
   1915   Nevertheless, one of the principles of Denote is its flexibility or
   1916   hackability and so users can deviate from the aforementioned
   1917   ([User-defined sluggification of file name components]).
   1918 
   1919 
   1920 [Front matter] See section 6
   1921 
   1922 [Features of the file-naming scheme for searching or filtering] See
   1923 section 5.3
   1924 
   1925 [User-defined sluggification of file name components] See section 5.2
   1926 
   1927 
   1928 5.2 User-defined sluggification of file name components
   1929 ───────────────────────────────────────────────────────
   1930 
   1931   The user option `denote-file-name-slug-functions' controls the
   1932   sluggification of file name components ([Sluggification of file name
   1933   components]).  The default method is outlined above and in the
   1934   previous section ([The file-naming scheme]).
   1935 
   1936   The value of this user option is an alist where each element is a cons
   1937   cell of the form `(COMPONENT . METHOD)'. For example, here is the
   1938   default value:
   1939 
   1940   ┌────
   1941   │ '((title . denote-sluggify-title)
   1942   │   (signature . denote-sluggify-signature)
   1943   │   (keyword . denote-sluggify-keyword))
   1944   └────
   1945 
   1946   • The `COMPONENT' is an unquoted symbol among `title', `signature',
   1947     `keyword', which refers to the corresponding component of the file
   1948     name.
   1949 
   1950   • The `METHOD' is a function to format the given component. This
   1951     function must take a string as its parameter and return the string
   1952     formatted for the file name. Note that even in the case of the
   1953     `keyword' component, the function receives one string representing a
   1954     single keyword and returns it formatted for the file name. Joining
   1955     the keywords together is handled internally by Denote.
   1956 
   1957   One commonly requested deviation from the sluggification rules is to
   1958   not sluggify individual keywords, such that the user’s input is taken
   1959   as-is. This can be done as follows:
   1960 
   1961   ┌────
   1962   │ (setq denote-file-name-slug-functions
   1963   │       '((title . denote-sluggify-title)
   1964   │ 	(keyword . identity)
   1965   │ 	(signature . denote-sluggify-signature)))
   1966   └────
   1967 
   1968   The `identity' function simply returns the string it receives, thus
   1969   not altering it in any way.
   1970 
   1971   Another approach is to keep the sluggification but not downcase the
   1972   string. We can do this by modifying the original functions used by
   1973   Denote. For example, we have this:
   1974 
   1975   ┌────
   1976   │ ;; The original function for reference
   1977   │ (defun denote-sluggify-title (str)
   1978   │   "Make STR an appropriate slug for title."
   1979   │   (downcase (denote--slug-hyphenate (denote--slug-no-punct str))))
   1980   1981   │ ;; Our variant of the above, which does the same thing except from
   1982   │ ;; downcasing the string.
   1983   │ (defun my-denote-sluggify-title (str)
   1984   │   "Make STR an appropriate slug for title."
   1985   │   (denote--slug-hyphenate (denote--slug-no-punct str)))
   1986   1987   │ ;; Now we use our function to sluggify titles without affecting their
   1988   │ ;; letter casing.
   1989   │ (setq denote-file-name-slug-functions
   1990   │       '((title . my-denote-sluggify-title) ; our function here
   1991   │ 	(signature . denote-sluggify-signature)
   1992   │ 	(keyword . denote-sluggify-keyword)))
   1993   └────
   1994 
   1995   Follow this principle for all the sluggification functions.
   1996 
   1997   To access the source code, use either of the following built-in
   1998   methods:
   1999 
   2000   1. Call the command `find-library' and search for `denote'. Then
   2001      navigate to the symbol you are searching for.
   2002 
   2003   2. Invoke the command `describe-symbol', search for the symbol you are
   2004      interested in, and from the resulting Help buffer either click on
   2005      the first link or do `M-x help-view-source' (bound to `s' in Help
   2006      buffers, by default).
   2007 
   2008   Remember that deviating from the default file-naming scheme of Denote
   2009   will make things harder to use in the future, as files can/will have
   2010   permutations that create uncertainty. The sluggification scheme and
   2011   concomitant restrictions we impose by default are there for a very
   2012   good reason: they are the distillation of years of experience. Here we
   2013   give you what you wish, but bear in mind it may not be what you need.
   2014   You have been warned.
   2015 
   2016 
   2017 [Sluggification of file name components] See section 5.1
   2018 
   2019 [The file-naming scheme] See section 5
   2020 
   2021 
   2022 5.3 Features of the file-naming scheme for searching or filtering
   2023 ─────────────────────────────────────────────────────────────────
   2024 
   2025   By default, file names have three fields and two sets of field
   2026   delimiters between them:
   2027 
   2028   ┌────
   2029   │ DATE--TITLE__KEYWORDS.EXTENSION
   2030   └────
   2031 
   2032 
   2033   When a signature is present, this becomes:
   2034 
   2035   ┌────
   2036   │ DATE==SIGNATURE--TITLE__KEYWORDS.EXTENSION
   2037   └────
   2038 
   2039 
   2040   Field delimiters practically serve as anchors for easier searching.
   2041   Consider this example:
   2042 
   2043   ┌────
   2044   │ 20220621T062327==1a2--introduction-to-denote__denote_emacs.txt
   2045   └────
   2046 
   2047 
   2048   You will notice that there are two matches for the word `denote': one
   2049   in the title field and another in the keywords’ field.  Because of the
   2050   distinct field delimiters, if we search for `-denote' we only match
   2051   the first instance while `_denote' targets the second one.  When
   2052   sorting through your notes, this kind of specificity is invaluable—and
   2053   you get it for free from the file names alone!  Similarly, a search
   2054   for `=1' will show all notes that are related to each other by virtue
   2055   of their signature.
   2056 
   2057   Users can get a lot of value out of this simple yet effective
   2058   arrangement, even if they have no knowledge of regular expressions.
   2059   One thing to consider, for maximum effect, is to avoid using
   2060   multi-word keywords as those can get hyphenated like the title and
   2061   will thus interfere with the above: either set the user option
   2062   `denote-allow-multi-word-keywords' to nil or simply insert single
   2063   words at the relevant prompts.
   2064 
   2065 
   2066 6 Front matter
   2067 ══════════════
   2068 
   2069   Notes have their own “front matter”.  This is a block of data at the
   2070   top of the file, with no empty lines between the entries, which is
   2071   automatically generated at the creation of a new note.  The front
   2072   matter includes the title and keywords (aka “tags” or “filetags”,
   2073   depending on the file type) which the user specified at the relevant
   2074   prompt, as well as the date and unique identifier, which are derived
   2075   automatically.
   2076 
   2077   This is how it looks for Org mode (when `denote-file-type' is nil or
   2078   the `org' symbol):
   2079 
   2080   ┌────
   2081   │ #+title:      This is a sample note
   2082   │ #+date:       [2022-06-30 Thu 16:09]
   2083   │ #+filetags:   :denote:testing:
   2084   │ #+identifier: 20220630T160934
   2085   └────
   2086 
   2087   For Markdown with YAML (`denote-file-type' has the `markdown-yaml'
   2088   value), the front matter looks like this:
   2089 
   2090   ┌────
   2091   │ ---
   2092   │ title:      "This is a sample note"
   2093   │ date:       2022-06-30T16:09:58+03:00
   2094   │ tags:       ["denote", "testing"]
   2095   │ identifier: "20220630T160958"
   2096   │ ---
   2097   └────
   2098 
   2099   For Markdown with TOML (`denote-file-type' has the `markdown-toml'
   2100   value), it is:
   2101 
   2102   ┌────
   2103   │ +++
   2104   │ title      = "This is a sample note"
   2105   │ date       = 2022-06-30T16:10:13+03:00
   2106   │ tags       = ["denote", "testing"]
   2107   │ identifier = "20220630T161013"
   2108   │ +++
   2109   └────
   2110 
   2111   And for plain text (`denote-file-type' has the `text' value), we have
   2112   the following:
   2113 
   2114   ┌────
   2115   │ title:      This is a sample note
   2116   │ date:       2022-06-30
   2117   │ tags:       denote  testing
   2118   │ identifier: 20220630T161028
   2119   │ ---------------------------
   2120   └────
   2121 
   2122   The format of the date in the front matter is controlled by the user
   2123   option `denote-date-format'.  When nil, Denote uses a
   2124   file-type-specific format:
   2125 
   2126   • For Org, an inactive timestamp is used, such as `[2022-06-30 Wed
   2127     15:31]'.
   2128 
   2129   • For Markdown, the RFC3339 standard is applied:
   2130     `2022-06-30T15:48:00+03:00'.
   2131 
   2132   • For plain text, the format is that of ISO 8601: `2022-06-30'.
   2133 
   2134   If the value is a string, ignore the above and use it instead.  The
   2135   string must include format specifiers for the date.  These are
   2136   described in the doc string of `format-time-string'..
   2137 
   2138 
   2139 6.1 Change the front matter format
   2140 ──────────────────────────────────
   2141 
   2142   Per Denote’s design principles, the code is hackable.  All front
   2143   matter is stored in variables that are intended for public use.  We do
   2144   not declare those as “user options” because (i) they expect the user
   2145   to have some degree of knowledge in Emacs Lisp and (ii) implement
   2146   custom code.
   2147 
   2148   [ NOTE for tinkerers: code intended for internal use includes double
   2149     hyphens in its symbol.  “Internal use” means that it can be changed
   2150     without warning and with no further reference in the change log.  Do
   2151     not use any of it without understanding the consequences. ]
   2152 
   2153   The variables which hold the front matter format are:
   2154 
   2155   • `denote-org-front-matter'
   2156 
   2157   • `denote-text-front-matter'
   2158 
   2159   • `denote-toml-front-matter'
   2160 
   2161   • `denote-yaml-front-matter'
   2162 
   2163   These variables have a string value with specifiers that are used by
   2164   the `format' function.  The formatting operation passes four arguments
   2165   which include the values of the given entries.  If you are an advanced
   2166   user who wants to edit this variable to affect how front matter is
   2167   produced, consider using something like `%2$s' to control where the
   2168   Nth argument is placed.
   2169 
   2170   When editing the value, make sure to:
   2171 
   2172   1. Not use empty lines inside the front matter block.
   2173 
   2174   2. Insert at least one empty line after the front matter block and do
   2175      not use any empty line before it.
   2176 
   2177   These help with consistency and might prove useful if we ever need to
   2178   operate on the front matter as a whole.
   2179 
   2180   With those granted, below are some examples.  The approach is the same
   2181   for all variables.
   2182 
   2183   ┌────
   2184   │ ;; Like the default, but upcase the entries
   2185   │ (setq denote-org-front-matter
   2186   │   "#+TITLE:      %s
   2187   │ #+DATE:       %s
   2188   │ #+FILETAGS:   %s
   2189   │ #+IDENTIFIER: %s
   2190   │ \n")
   2191   2192   │ ;; Change the order (notice the %N$s notation)
   2193   │ (setq denote-org-front-matter
   2194   │   "#+title:      %1$s
   2195   │ #+filetags:   %3$s
   2196   │ #+date:       %2$s
   2197   │ #+identifier: %4$s
   2198   │ \n")
   2199   2200   │ ;; Remove the date
   2201   │ (setq denote-org-front-matter
   2202   │   "#+title:      %1$s
   2203   │ #+filetags:   %3$s
   2204   │ #+identifier: %4$s
   2205   │ \n")
   2206   2207   │ ;; Remove the date and the identifier
   2208   │ (setq denote-org-front-matter
   2209   │   "#+title:      %1$s
   2210   │ #+filetags:   %3$s
   2211   │ \n")
   2212   └────
   2213 
   2214   Note that `setq' has a global effect: it affects the creation of all
   2215   new notes.  Depending on the workflow, it may be preferrable to have a
   2216   custom command which `let' binds the different format.  We shall not
   2217   provide examples at this point as this is a more advanced feature and
   2218   we are not yet sure what the user’s needs are.  Please provide
   2219   feedback and we shall act accordingly.
   2220 
   2221 
   2222 6.2 Regenerate front matter
   2223 ───────────────────────────
   2224 
   2225   Sometimes the user needs to produce new front matter for an existing
   2226   note.  Perhaps because they accidentally deleted a line and could not
   2227   undo the operation.  The command `denote-add-front-matter' can be used
   2228   for this very purpose.
   2229 
   2230   In interactive use, `denote-add-front-matter' must be invoked from a
   2231   buffer that visits a Denote note.  It prompts for a title and then for
   2232   keywords.  These are the standard prompts we already use for note
   2233   creation, so the keywords’ prompt allows minibuffer completion and the
   2234   input of multiple entries, each separated by a comma ([Points of
   2235   entry]).
   2236 
   2237   The newly created front matter is added to the top of the file.
   2238 
   2239   This command does not rename the file (e.g. to update the keywords).
   2240   To rename a file by reading its front matter as input, the user can
   2241   rely on `denote-rename-file-using-front-matter' ([Renaming files]).
   2242 
   2243   Note that `denote-add-front-matter' is useful only for existing Denote
   2244   notes.  If the user needs to convert a generic text file to a Denote
   2245   note, they can use one of the command which first rename the file to
   2246   make it comply with our file-naming scheme and then add the relevant
   2247   front matter.
   2248 
   2249 
   2250 [Points of entry] See section 3
   2251 
   2252 [Renaming files] See section 4
   2253 
   2254 
   2255 7 Linking notes
   2256 ═══════════════
   2257 
   2258   Denote offers several commands for linking between notes.
   2259 
   2260   All links target files which are Denote files. This means that they
   2261   have our file-naming scheme. Files need to be inside the
   2262   `denote-directory' or one of its subdirectories. No other file is
   2263   recognised.
   2264 
   2265   The following sections delve into the details.
   2266 
   2267 
   2268 7.1 Adding a single link
   2269 ────────────────────────
   2270 
   2271   The `denote-link' command inserts a link at point to a file specified
   2272   at the minibuffer prompt ([The `denote-org-store-link-to-heading' user
   2273   option]).  Links are formatted depending on the file type of the
   2274   current note. In Org and plain text buffers, links are formatted thus:
   2275   `[[denote:IDENTIFIER][DESCRIPTION]]'. While in Markdown they are
   2276   expressed as `[DESCRIPTION](denote:IDENTIFIER)'.
   2277 
   2278   When `denote-link' is called with a prefix argument (`C-u' by
   2279   default), it formats links like `[[denote:IDENTIFIER]]'.  The user
   2280   might prefer its simplicity.
   2281 
   2282   By default, the description of the link is taken from the signature of
   2283   the file, if present, and the target file’s front matter’s title or,
   2284   if that is not available, from the file name.  If the region is
   2285   active, its text is used as the link’s description instead.  If the
   2286   active region has no text, the inserted link uses just the identifier,
   2287   as with the `C-u' prefix mentioned above.
   2288 
   2289   Inserted links are automatically buttonized and remain active for as
   2290   long as the buffer is available.  In Org this is handled by the major
   2291   mode: the `denote:' hyperlink type works exactly like the standard
   2292   `file:'.  In Markdown and plain text, Denote performs the
   2293   buttonization of those links.  To buttonize links in existing files
   2294   while visiting them, the user must add this snippet to their setup (it
   2295   already excludes Org):
   2296 
   2297   ┌────
   2298   │ (add-hook 'find-file-hook #'denote-link-buttonize-buffer)
   2299   └────
   2300 
   2301   The `denote-link-buttonize-buffer' is also an interactive function in
   2302   case the user needs it.
   2303 
   2304   Links are created only for files which qualify as a “note” for our
   2305   purposes ([Linking notes]).
   2306 
   2307   Links are styled with the `denote-faces-link' face, which looks
   2308   exactly like an ordinary link by default.  This is just a convenience
   2309   for the user/theme in case they want `denote:' links to remain
   2310   distinct from other links.
   2311 
   2312   In files whose major mode is `markdown-mode', the default key binding
   2313   `C-c C-o' (which calls the command `markdown-follow-thing-at-point')
   2314   correctly resolves `denote:' links. This method works in addition to
   2315   the `RET' key, which is made available by the aforementioned
   2316   buttonization. Interested users can refer to the function
   2317   `denote-link-markdown-follow' for the implementation details.
   2318 
   2319 
   2320 [The `denote-org-store-link-to-heading' user option] See section 7.2
   2321 
   2322 [Linking notes] See section 7
   2323 
   2324 
   2325 7.2 The `denote-org-store-link-to-heading' user option
   2326 ──────────────────────────────────────────────────────
   2327 
   2328   The user option `denote-org-store-link-to-heading' determines whether
   2329   `org-store-link' links to the current Org heading (such links are
   2330   merely “stored” and need to be inserted afterwards with the command
   2331   `org-insert-link'). Note that the `org-capture' command uses the
   2332   `org-link' internally if it has to store a link.
   2333 
   2334   When its value is non-nil, `org-store-link' stores a link to the
   2335   current Org heading inside the Denote Org file. If the heading does
   2336   not have a `CUSTOM_ID', it creates it and includes it in the heading’s
   2337   `PROPERTIES' drawer. If a `CUSTOM_ID' exists, `org-store-link' use it
   2338   as-is.
   2339 
   2340   This makes the resulting link a combination of the `denote:' link
   2341   type, pointing to the identifier of the current file, plus the value
   2342   of the heading’s `CUSTOM_ID', such as:
   2343 
   2344   • `[[denote:20240118T060608][Some test]]'
   2345   • `[[denote:20240118T060608::#h:eed0fb8e-4cc7-478f-acb6-f0aa1a8bffcd][Some
   2346     test::Heading text]]'
   2347 
   2348   Both lead to the same Denote file, but the latter jumps to the heading
   2349   with the given `CUSTOM_ID'. Notice that the link to the heading also
   2350   has a different description, which includes the heading text.
   2351 
   2352   The value of the `CUSTOM_ID' is determined by the Org user option
   2353   `org-id-method'. The sample shown above uses the default UUID
   2354   infrastructure.
   2355 
   2356   If `denote-org-store-link-to-heading' is set to a nil value, the
   2357   command `org-store-link' only stores links to the Denote file (using
   2358   its identifier), but not to the given heading. This is what Denote was
   2359   doing in versions prior to `2.3.0'.
   2360 
   2361   Note that the optional extension `denote-org-extras.el' defines the
   2362   command `denote-org-extras-link-to-heading', which always links to a
   2363   file+heading regardless of the aforementioned user option ([Insert
   2364   link to an Org file with a further pointer to a heading]).
   2365 
   2366   [ This feature only works in Org mode files, as other file types do
   2367     not have a linking mechanism that handles unique identifiers for
   2368     headings or other patterns to jump to. If `org-store-link' is
   2369     invoked in one such file, it captures only the Denote identifier of
   2370     the file, even if this user option is set to a non-nil value. ]
   2371 
   2372 
   2373 [Insert link to an Org file with a further pointer to a heading] See
   2374 section 7.3
   2375 
   2376 
   2377 7.3 Insert link to an Org file with a further pointer to a heading
   2378 ──────────────────────────────────────────────────────────────────
   2379 
   2380   As part of the optional `denote-org-extras.el' extension, the command
   2381   `denote-org-extras-link-to-heading' prompts for a link to an Org file
   2382   and then asks for a heading therein, using minibuffer completion. Once
   2383   the user provides input at the two prompts, the command inserts a link
   2384   at point which has the following pattern:
   2385   `[[denote:IDENTIFIER::#ORG-HEADING-CUSTOM-ID]][Description::Heading
   2386   text]]'.
   2387 
   2388   Because only Org files can have links to individual headings, the
   2389   command `denote-org-extras-link-to-heading' prompts only for Org files
   2390   (i.e. files which include the `.org' extension). Remember that Denote
   2391   works with many file types ([The file-naming scheme]).
   2392 
   2393   This feature is similar to the concept of the user option
   2394   `denote-org-store-link-to-heading' ([The
   2395   `denote-org-store-link-to-heading' user option]). It is, however,
   2396   interactive and differs in the directionality of the action. With that
   2397   user option, the command `org-store-link' will generate a `CUSTOM_ID'
   2398   for the current heading (or capture the value of one as-is), giving
   2399   the user the option to then call `org-insert-link' wherever they see
   2400   fit. By contrast, the command `denote-org-extras-link-to-heading'
   2401   prompts for a file, then a heading, and inserts the link at point.
   2402 
   2403 
   2404 [The file-naming scheme] See section 5
   2405 
   2406 [The `denote-org-store-link-to-heading' user option] See section 7.2
   2407 
   2408 
   2409 7.4 Insert links matching a regexp
   2410 ──────────────────────────────────
   2411 
   2412   The command `denote-add-links' adds links at point matching a regular
   2413   expression or plain string.  The links are inserted as a typographic
   2414   list, such as:
   2415 
   2416   ┌────
   2417   │ - link1
   2418   │ - link2
   2419   │ - link3
   2420   └────
   2421 
   2422   Each link is formatted according to the file type of the current note,
   2423   as explained further above about the `denote-link' command.  The
   2424   current note is excluded from the matching entries (adding a link to
   2425   itself is pointless).
   2426 
   2427   When called with a prefix argument (`C-u') `denote-add-links' will
   2428   format all links as `[[denote:IDENTIFIER]]', hence a typographic list:
   2429 
   2430   ┌────
   2431   │ - [[denote:IDENTIFIER-1]]
   2432   │ - [[denote:IDENTIFIER-2]]
   2433   │ - [[denote:IDENTIFIER-3]]
   2434   └────
   2435 
   2436   Same examples of a regular expression that can be used with this
   2437   command:
   2438 
   2439   • `journal' match all files which include `journal' anywhere in their
   2440     name.
   2441 
   2442   • `_journal' match all files which include `journal' as a keyword.
   2443 
   2444   • `^2022.*_journal' match all file names starting with `2022' and
   2445     including the keyword `journal'.
   2446 
   2447   • `\.txt' match all files including `.txt'.  In practical terms, this
   2448     only applies to the file extension, as Denote automatically removes
   2449     dots (and other characters) from the base file name.
   2450 
   2451   If files are created with `denote-sort-keywords' as non-nil (the
   2452   default), then it is easy to write a regexp that includes multiple
   2453   keywords in alphabetic order:
   2454 
   2455   • `_denote.*_package' match all files that include both the `denote'
   2456     and `package' keywords, in this order.
   2457 
   2458   • `\(.*denote.*package.*\)\|\(.*package.*denote.*\)' is the same as
   2459     above, but out-of-order.
   2460 
   2461   Remember that regexp constructs only need to be escaped once (like
   2462   `\|') when done interactively but twice when called from Lisp.  What
   2463   we show above is for interactive usage.
   2464 
   2465   Links are created only for files which qualify as a “note” for our
   2466   purposes ([Linking notes]).
   2467 
   2468 
   2469 [Linking notes] See section 7
   2470 
   2471 
   2472 7.5 Insert link to file with signature
   2473 ──────────────────────────────────────
   2474 
   2475   The command `denote-link-with-signature' prompts for a file among
   2476   those that contain a `==SIGNATURE' and inserts a link to it.  The
   2477   description of the link includes the text of the signature and that of
   2478   the file’s title, if any.  For example, a link to the following file:
   2479 
   2480   ┌────
   2481   │ 20230925T144303==abc--my-first-signature-note__denote_testing.txt
   2482   └────
   2483 
   2484 
   2485   will get this link: `[[denote:20230925T144303][abc My first signature
   2486   note]]'.
   2487 
   2488   For more advanced uses, refer to the doc string of the `denote-link'
   2489   function.
   2490 
   2491 
   2492 7.6 Insert links from marked files in Dired
   2493 ───────────────────────────────────────────
   2494 
   2495   The command `denote-link-dired-marked-notes' is similar to
   2496   `denote-add-links' in that it inserts in the buffer a typographic list
   2497   of links to Denote notes ([Insert links matching a regexp]).  Though
   2498   instead of reading a regular expression, it lets the user mark files
   2499   in Dired and link to them.  This should be easier for users of all
   2500   skill levels, instead of having to write a potentially complex regular
   2501   expression.
   2502 
   2503   If there are multiple buffers that visit a Denote note, this command
   2504   will ask to select one among them, using minibuffer completion.  If
   2505   there is only one buffer, it will operate in it outright.  If there
   2506   are no buffers, it will produce an error.
   2507 
   2508   With optional `ID-ONLY' as a prefix argument (`C-u' by default), the
   2509   command inserts links with just the identifier, which is the same
   2510   principle as with `denote-link' and others ([Adding a single link]).
   2511 
   2512   The command `denote-link-dired-marked-notes' is meant to be used from
   2513   a Dired buffer.
   2514 
   2515   As always, links are created only for files which qualify as a “note”
   2516   for our purposes ([Linking notes]).
   2517 
   2518 
   2519 [Insert links matching a regexp] See section 7.4
   2520 
   2521 [Adding a single link] See section 7.1
   2522 
   2523 [Linking notes] See section 7
   2524 
   2525 
   2526 7.7 Link to an existing note or create a new one
   2527 ────────────────────────────────────────────────
   2528 
   2529   In one’s note-taking workflow, there may come a point where they are
   2530   expounding on a certain topic but have an idea about another subject
   2531   they would like to link to ([Linking notes]).  The user can always
   2532   rely on the other linking facilities we have covered herein to target
   2533   files that already exist.  Though they may not know whether they
   2534   already have notes covering the subject or whether they would need to
   2535   write new ones.  To this end, Denote provides two convenience
   2536   commands:
   2537 
   2538   `denote-link-after-creating'
   2539         Create new note in the background and link to it directly.
   2540 
   2541         Use `denote' interactively to produce the new note.  Its doc
   2542         string or this manual explains which prompts will be used and
   2543         under what conditions ([Standard note creation]).
   2544 
   2545         With optional `ID-ONLY' as a prefix argument (this is the `C-u'
   2546         key, by default) create a link that consists of just the
   2547         identifier.  Else try to also include the file’s title.  This
   2548         has the same meaning as in `denote-link' ([Adding a single
   2549         link]).
   2550 
   2551         IMPORTANT NOTE: Normally, `denote' does not save the buffer it
   2552         produces for the new note ([The
   2553         `denote-save-buffer-after-creation' option]).  This is a safety
   2554         precaution to not write to disk unless the user wants it
   2555         (e.g. the user may choose to kill the buffer, thus cancelling
   2556         the creation of the note). However, for this command the
   2557         creation of the note happens in the background and the user may
   2558         miss the step of saving their buffer. We thus have to save the
   2559         buffer in order to (i) establish valid links, and (ii) retrieve
   2560         whatever front matter from the target file.
   2561 
   2562   `denote-link-after-creating-with-command'
   2563         This command is like `denote-link-after-creating' except it
   2564         prompts for a note-creating command ([Points of entry]).  Use
   2565         this to, for example, call `denote-signature' so that the newly
   2566         created note has a signature as part of its file name.  Optional
   2567         `ID-ONLY' has the same meaning as in the command
   2568         `denote-link-after-creating'.
   2569 
   2570   `denote-link-or-create'
   2571         Use `denote-link' on `TARGET' file, creating it if necessary.
   2572 
   2573         If `TARGET' file does not exist, call
   2574         `denote-link-after-creating' which runs the `denote' command
   2575         interactively to create the file.  The established link will
   2576         then be targeting that new file.
   2577 
   2578         If `TARGET' file does not exist, add the user input that was
   2579         used to search for it to the history of the
   2580         `denote-file-prompt'.  The user can then retrieve and possibly
   2581         further edit their last input, using it as the newly created
   2582         note’s actual title.  At the `denote-file-prompt' type `M-p'
   2583         with the default key bindings, which calls
   2584         `previous-history-element'.
   2585 
   2586         With optional `ID-ONLY' as a prefix argument create a link with
   2587         just the file’s identifier.  This has the same meaning as in
   2588         `denote-link'.
   2589 
   2590         This command has the alias
   2591         `denote-link-to-existing-or-new-note', which helps with
   2592         discoverability.
   2593 
   2594   `denote-link-or-create-with-command'
   2595         This is like the above, except when it is about to create the
   2596         new note it first prompts for the specific file-creating command
   2597         to use ([Points of entry]). For example, the user may want to
   2598         specify a signature for this new file, so they can select the
   2599         `denote-signature' command.
   2600 
   2601   In all of the above, an optional prefix argument (`C-u' by default)
   2602   creates a link that consists of just the identifier.  This has the
   2603   same meaning as in the regular `denote-link' command.
   2604 
   2605   Denote provides similar functionality for opening an existing note or
   2606   creating a new one ([Open an existing note or create it if missing]).
   2607 
   2608 
   2609 [Linking notes] See section 7
   2610 
   2611 [Standard note creation] See section 3.1
   2612 
   2613 [Adding a single link] See section 7.1
   2614 
   2615 [The `denote-save-buffer-after-creation' option] See section 3.1.5
   2616 
   2617 [Points of entry] See section 3
   2618 
   2619 [Points of entry] See section 3
   2620 
   2621 [Open an existing note or create it if missing] See section 3.6
   2622 
   2623 
   2624 7.8 The backlinks’ buffer
   2625 ─────────────────────────
   2626 
   2627   The command `denote-backlinks' produces a bespoke buffer which
   2628   displays backlinks to the current note.  A “backlink” is a link back
   2629   to the present entry.
   2630 
   2631   By default, the backlinks’ buffer is designed to display the file name
   2632   of the note linking to the current entry.  Each file name is presented
   2633   on its own line, like this:
   2634 
   2635   ┌────
   2636   │ Backlinks to "On being honest" (20220614T130812)
   2637   │ ------------------------------------------------
   2638   2639   │ 20220614T145606--let-this-glance-become-a-stare__journal.txt
   2640   │ 20220616T182958--feeling-butterflies-in-your-stomach__journal.txt
   2641   └────
   2642 
   2643   When the user option `denote-backlinks-show-context' is non-nil, the
   2644   backlinks’ buffer displays the line on which a link to the current
   2645   note occurs.  It also shows multiple occurrences, if present.  It
   2646   looks like this (and has the appropriate fontification):
   2647 
   2648   ┌────
   2649   │ Backlinks to "On being honest" (20220614T130812)
   2650   │ ------------------------------------------------
   2651   2652   │ 20220614T145606--let-this-glance-become-a-stare__journal.txt
   2653   │ 37: growing into it: [[denote:20220614T130812][On being honest]].
   2654   │ 64: As I said in [[denote:20220614T130812][On being honest]] I have never
   2655   │ 20220616T182958--feeling-butterflies-in-your-stomach__journal.txt
   2656   │ 62: indifference.  In [[denote:20220614T130812][On being honest]] I alluded
   2657   └────
   2658 
   2659   Note that the width of the lines in the context depends on the
   2660   underlying file.  In the above example, the lines are split at the
   2661   `fill-column'.  Long lines will show up just fine.  Also note that the
   2662   built-in user option `xref-truncation-width' can truncate long lines
   2663   to a given maximum number of characters.
   2664 
   2665   [Speed up backlinks’ buffer creation?]
   2666 
   2667   The backlinks’ buffer runs the major-mode `denote-backlinks-mode'.  It
   2668   binds keys to move between links with `n' (next) and `p' (previous).
   2669   These are stored in the `denote-backlinks-mode-map' (use `M-x
   2670   describe-mode' (`C-h m') in an unfamiliar buffer to learn more about
   2671   it).  When the user option `denote-backlinks-show-context' is non-nil,
   2672   all relevant Xref key bindings are fully functional: again, check
   2673   `describe-mode'.
   2674 
   2675   The backlinking facility uses Emacs’ built-in Xref infrastructure.  On
   2676   some operating systems, the user may need to add certain executables
   2677   to the relevant environment variable.
   2678 
   2679   [Why do I get “Search failed with status 1” when I search for
   2680   backlinks?]
   2681 
   2682   Backlinks to the current file can also be visited by using the
   2683   minibuffer completion interface with the `denote-find-backlink'
   2684   command ([Visiting linked files via the minibuffer]).
   2685 
   2686   The placement of the backlinks’ buffer is subject to the user option
   2687   `denote-link-backlinks-display-buffer-action'.  Due to the nature of
   2688   the underlying `display-buffer' mechanism, this inevitably is a
   2689   relatively advanced feature.  By default, the backlinks’ buffer is
   2690   displayed below the current window.  The doc string of our user option
   2691   includes a sample configuration that places the buffer in a left side
   2692   window instead.  Reproducing it here for the sake of convenience:
   2693 
   2694   ┌────
   2695   │ (setq denote-link-backlinks-display-buffer-action
   2696   │       '((display-buffer-reuse-window
   2697   │ 	 display-buffer-in-side-window)
   2698   │ 	(side . left)
   2699   │ 	(slot . 99)
   2700   │ 	(window-width . 0.3)))
   2701   └────
   2702 
   2703 
   2704 [Speed up backlinks’ buffer creation?] See section 23.9
   2705 
   2706 [Why do I get “Search failed with status 1” when I search for
   2707 backlinks?] See section 23.10
   2708 
   2709 [Visiting linked files via the minibuffer] See section 7.10
   2710 
   2711 
   2712 7.9 Writing metanotes
   2713 ─────────────────────
   2714 
   2715   A “metanote” is an entry that describes other entries who have
   2716   something in common.  Writing metanotes can be part of a workflow
   2717   where the user periodically reviews their work in search of patterns
   2718   and deeper insights.  For example, you might want to read your journal
   2719   entries from the past year to reflect on your experiences, evolution
   2720   as a person, and the like.
   2721 
   2722   The commands `denote-add-links', `denote-link-dired-marked-notes' are
   2723   suited for this task.
   2724 
   2725   [Insert links matching a regexp].
   2726 
   2727   [Insert links from marked files in Dired].
   2728 
   2729   You will create your metanote the way you use Denote ordinarily
   2730   (metanotes may have the `metanote' keyword, among others), write an
   2731   introduction or however you want to go about it, invoke the command
   2732   which inserts multiple links at once (see the above-cited nodes), and
   2733   continue writing.
   2734 
   2735   Metanotes can serve as entry points to groupings of individual notes.
   2736   They are not the same as a filtered list of files, i.e. what you would
   2737   do in Dired or the minibuffer where you narrow the list of notes to a
   2738   given query.  Metanotes contain the filtered list plus your thoughts
   2739   about it.  The act of purposefully grouping notes together and
   2740   contemplating on their shared patterns is what adds value.
   2741 
   2742   Your future self will appreciate metanotes for the function they serve
   2743   in encapsulating knowledge, while current you will be equipped with
   2744   the knowledge derived from the deliberate self-reflection.
   2745 
   2746 
   2747 [Insert links matching a regexp] See section 7.4
   2748 
   2749 [Insert links from marked files in Dired] See section 7.6
   2750 
   2751 
   2752 7.10 Visiting linked files via the minibuffer
   2753 ─────────────────────────────────────────────
   2754 
   2755   Denote has a major-mode-agnostic mechanism to collect all linked file
   2756   references in the current buffer and return them as an appropriately
   2757   formatted list.  This list can then be used in interactive commands.
   2758   The `denote-find-link' is such a command.  It uses minibuffer
   2759   completion to visit a file that is linked to from the current note.
   2760   The candidates have the correct metadata, which is ideal for
   2761   integration with other standards-compliant tools ([Extending Denote]).
   2762   For instance, a package such as `marginalia' will display accurate
   2763   annotations, while the `embark' package will be able to work its magic
   2764   such as in exporting the list into a filtered Dired buffer (i.e. a
   2765   familiar Dired listing with only the files of the current minibuffer
   2766   session).
   2767 
   2768   To visit backlinks to the current note via the minibuffer, use
   2769   `denote-find-backlink'.  This is an alternative to placing backlinks
   2770   in a dedicated buffer ([The backlinks’ buffer]).
   2771 
   2772 
   2773 [Extending Denote] See section 15
   2774 
   2775 [The backlinks’ buffer] See section 7.8
   2776 
   2777 
   2778 7.11 Convert `denote:' links to `file:' links
   2779 ─────────────────────────────────────────────
   2780 
   2781   Sometimes the user needs to translate all `denote:' link types to
   2782   their `file:' equivalent. This may be because some other tool does not
   2783   recognise `denote:' links (or other custom links types—which are a
   2784   standard feature of Org, by the way). The user thus needs to (i)
   2785   either make a copy of their Denote note or edit the existing one, and
   2786   (ii) convert all links to the generic `file:' link type that
   2787   external/other programs understand.
   2788 
   2789   The optional extension `denote-org-extras.el' contains two commands
   2790   that are relevant for this use-case:
   2791 
   2792   Convert `denote:' links to `file:' links
   2793         The command `denote-org-extras-convert-links-to-file-type' goes
   2794         through the buffer to find all `denote:' links. It gets the
   2795         identifier of the link and resolves it to the actual file system
   2796         path. It then replaces the match so that the link is written
   2797         with the `file:' type and then the file system path. The
   2798         optional search terms and/or link description are preserved
   2799         ([Insert link to an Org file with a further pointer to a
   2800         heading]).
   2801 
   2802   Convert `file:' links to `denote:' links
   2803         The command `denote-org-extras-convert-links-to-denote-type'
   2804         behaves like the one above. The difference is that it finds the
   2805         file system path and converts it into its identifier.
   2806 
   2807 
   2808 [Insert link to an Org file with a further pointer to a heading] See
   2809 section 7.3
   2810 
   2811 
   2812 7.12 Miscellaneous information about links
   2813 ──────────────────────────────────────────
   2814 
   2815 7.12.1 Aliases for the linking commands
   2816 ╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌
   2817 
   2818   For convenience, the `denote-link' command has an alias called
   2819   `denote-insert-link'.  The `denote-backlinks' can also be used as
   2820   `denote-show-backlinks-buffer'.  While `denote-add-links' is aliased
   2821   `denote-link-insert-links-matching-regexp'.  The purpose of these
   2822   aliases is to offer alternative, more descriptive names of select
   2823   commands.
   2824 
   2825 
   2826 7.12.2 The `denote-link-description-function' to format links
   2827 ╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌
   2828 
   2829   The user option `denote-link-description-function' takes as its value
   2830   the symbol of a function. This is used to format the text of the link.
   2831   The default function inserts the title. If the file has a signature,
   2832   it includes that as well, prepending it to the title.
   2833 
   2834   The function specified accepts a single `FILE' argument and returns
   2835   the description as a string.
   2836 
   2837 
   2838 8 Choose which commands to prompt for
   2839 ═════════════════════════════════════
   2840 
   2841   The user option `denote-commands-for-new-notes' specifies a list of
   2842   commands that are available at the `denote-command-prompt'.  This
   2843   prompt is used by Denote commands that ask the user how to create a
   2844   new note, as described elsewhere in this manual:
   2845 
   2846   • [Open an existing note or create it if missing]
   2847   • [Link to a note or create it if missing]
   2848 
   2849   The default value includes all the basic file-creating commands
   2850   ([Points of entry]).  Users may customise this value if (i) they only
   2851   want to see fewer options and/or (ii) wish to include their own custom
   2852   command in the list ([Write your own convenience commands]).
   2853 
   2854 
   2855 [Open an existing note or create it if missing] See section 3.6
   2856 
   2857 [Link to a note or create it if missing] See section 7.7
   2858 
   2859 [Points of entry] See section 3
   2860 
   2861 [Write your own convenience commands] See section 3.1.4.1
   2862 
   2863 
   2864 9 Fontification in Dired
   2865 ════════════════════════
   2866 
   2867   One of the upsides of Denote’s file-naming scheme is the predictable
   2868   pattern it establishes, which appears as a near-tabular presentation
   2869   in a listing of notes (i.e. in Dired).  The `denote-dired-mode' can
   2870   help enhance this impression, by fontifying the components of the file
   2871   name to make the date (identifier) and keywords stand out.
   2872 
   2873   There are two ways to set the mode.  Either use it for all
   2874   directories, which probably is not needed:
   2875 
   2876   ┌────
   2877   │ (add-hook 'dired-mode-hook #'denote-dired-mode)
   2878   └────
   2879 
   2880   Or configure the user option `denote-dired-directories' and then set
   2881   up the function `denote-dired-mode-in-directories':
   2882 
   2883   ┌────
   2884   │ ;; We use different ways to specify a path for demo purposes.
   2885   │ (setq denote-dired-directories
   2886   │       (list denote-directory
   2887   │ 	    (thread-last denote-directory (expand-file-name "attachments"))
   2888   │ 	    (expand-file-name "~/Documents/vlog")))
   2889   2890   │ (add-hook 'dired-mode-hook #'denote-dired-mode-in-directories)
   2891   └────
   2892 
   2893   The user option `denote-dired-directories-include-subdirectories'
   2894   specifies whether the `denote-dired-directories' also cover their
   2895   subdirectories. By default they do not. Set this option to `t' to
   2896   include subdirectories as well.
   2897 
   2898   The faces we define for this purpose are:
   2899 
   2900   ⁃ `denote-faces-date'
   2901   ⁃ `denote-faces-delimiter'
   2902   ⁃ `denote-faces-extension'
   2903   ⁃ `denote-faces-keywords'
   2904   • `denote-faces-signature'
   2905   ⁃ `denote-faces-subdirectory'
   2906   ⁃ `denote-faces-time'
   2907   ⁃ `denote-faces-title'
   2908 
   2909   For more control, we also provide these:
   2910 
   2911   #+vindex denote-faces-year +vindex denote-faces-month +vindex
   2912   #denote-faces-day +vindex denote-faces-hour +vindex
   2913   #denote-faces-minute +vindex denote-faces-second
   2914   ⁃ `denote-faces-year'
   2915   ⁃ `denote-faces-month'
   2916   ⁃ `denote-faces-day'
   2917   ⁃ `denote-faces-hour'
   2918   ⁃ `denote-faces-minute'
   2919   ⁃ `denote-faces-second'
   2920 
   2921   For the time being, the `diredfl' package is not compatible with this
   2922   facility.
   2923 
   2924   The `denote-dired-mode' does not only fontify note files that were
   2925   created by Denote: it covers every file name that follows our naming
   2926   conventions ([The file-naming scheme]).  This is particularly useful
   2927   for scenaria where, say, one wants to organise their collection of
   2928   PDFs and multimedia in a systematic way (and, perhaps, use them as
   2929   attachments for the notes Denote produces if you are writing Org notes
   2930   and are using its standand attachments’ facility).
   2931 
   2932 
   2933 [The file-naming scheme] See section 5
   2934 
   2935 
   2936 10 Automatically rename Denote buffers
   2937 ══════════════════════════════════════
   2938 
   2939   The minor mode `denote-rename-buffer-mode' provides the means to
   2940   automatically rename the buffer of a Denote file upon visiting the
   2941   file. This applies both to existing Denote files as well as new ones
   2942   ([Points of entry]). Enable the mode thus:
   2943 
   2944   ┌────
   2945   │ (denote-rename-buffer-mode 1)
   2946   └────
   2947 
   2948   Buffers are named by applying the function specified in the user
   2949   option `denote-rename-buffer-function'. The default function is
   2950   `denote-rename-buffer': it renames the buffer based on the template
   2951   set in the user option `denote-rename-buffer-format'. By default, the
   2952   formatting template targets only the `TITLE' component of the file
   2953   name ([The file-naming scheme]). Other fields are explained elsewhere
   2954   in this manual ([The denote-rename-buffer-format]).
   2955 
   2956   Note that renaming a buffer is not the same as renaming a file
   2957   ([Renaming files]). The former is just for convenience inside of
   2958   Emacs.  Whereas the latter is for writing changes to disk, making them
   2959   available to all programs.
   2960 
   2961 
   2962 [Points of entry] See section 3
   2963 
   2964 [The file-naming scheme] See section 5
   2965 
   2966 [The denote-rename-buffer-format] See section 10.1
   2967 
   2968 [Renaming files] See section 4
   2969 
   2970 10.1 The `denote-rename-buffer-format' option
   2971 ─────────────────────────────────────────────
   2972 
   2973   The user option `denote-rename-buffer-format' controls how the
   2974   function `denote-rename-buffer' chooses the name of the
   2975   buffer-to-be-renamed.
   2976 
   2977   The value of this user option is a string. The following specifiers
   2978   are placeholders for Denote file name components ([The file-naming
   2979   scheme]):
   2980 
   2981   • The `%t' is the Denote `TITLE' of the file.
   2982   • The `%i' is the Denote `IDENTIFIER' of the file.
   2983   • The `%d' is the same as `%i' (`DATE' mnemonic).
   2984   • The `%s' is the Denote `SIGNATURE' of the file.
   2985   • The `%k' is the Denote `KEYWORDS' of the file.
   2986   • The `%%' is a literal percent sign.
   2987 
   2988   In addition, the following flags are available for each of the
   2989   specifiers:
   2990 
   2991   `0'
   2992         Pad to the width, if given, with zeros instead of spaces.
   2993   `-'
   2994         Pad to the width, if given, on the right instead of the left.
   2995   `<'
   2996         Truncate to the width and precision, if given, on the left.
   2997   `>'
   2998         Truncate to the width and precision, if given, on the right.
   2999   `^'
   3000         Convert to upper case.
   3001   `_'
   3002         Convert to lower case.
   3003 
   3004   When combined all together, the above are written thus:
   3005 
   3006   ┌────
   3007   │ %<flags><width><precision>SPECIFIER-CHARACTER
   3008   └────
   3009 
   3010 
   3011   Any other string it taken as-is.  Users may want, for example, to
   3012   include some text that makes Denote buffers stand out, such as a `[D]'
   3013   prefix.  Examples:
   3014 
   3015   ┌────
   3016   │ ;; Use the title (default)
   3017   │ (setq denote-rename-buffer-format "%t")
   3018   3019   │ ;; Use the title and keywords with some emoji in between
   3020   │ (setq denote-rename-buffer-format "%t 🤨 %k")
   3021   3022   │ ;; Use the title with a literal "[D]" before it
   3023   │ (setq denote-rename-buffer-format "[D] %t")
   3024   └────
   3025 
   3026   Users who need yet more flexibility are best served by writing their
   3027   own function and assigning it to the `denote-rename-buffer-function'.
   3028 
   3029 
   3030 [The file-naming scheme] See section 5
   3031 
   3032 
   3033 11 Use Org dynamic blocks
   3034 ═════════════════════════
   3035 
   3036   [ As part of version 2.3.0, all dynamic blocks are defined in the file
   3037     `denote-org-extras.el'. The file which was once called
   3038     `denote-org-dblock.el' contains aliases for the new function names
   3039     and dipslays a warning about its deprecation. There is no need to
   3040     `require' the `denote-org-extras' feature because all of Denote’s
   3041     Org dynamic blocks are autoloaded (meaning that they work as soon as
   3042     they are used). For backward compatibility, all dynamic blocks
   3043     retain their original names as an alias for the newer one. ]
   3044 
   3045   Denote can optionally integrate with Org mode’s “dynamic blocks”
   3046   facility. This means that it can use special blocks that are evaluated
   3047   with `C-c C-x C-u' (`org-dblock-update') to generate their contents.
   3048   The following subsections describe the types of Org dynamic blocks
   3049   provided by Denote.
   3050 
   3051   • [Org dynamic blocks to insert links or backlinks]
   3052   • [Org dynamic block to insert file contents]
   3053 
   3054   A dynamic block gets its contents by evaluating a function that
   3055   corresponds to the type of block. The block type and its parameters
   3056   are stated in the opening `#+BEGIN' line. Typing `C-c C-x C-u'
   3057   (`org-dblock-update') with point on that line runs (or re-runs) the
   3058   associated function with the given parameters and populates the
   3059   block’s contents accordingly.
   3060 
   3061   Dynamic blocks are particularly useful for metanote entries that
   3062   reflect on the status of earlier notes ([Writing metanotes]).
   3063 
   3064   The Org manual describes the technicalities of Dynamic Blocks.
   3065   Evaluate:
   3066 
   3067   ┌────
   3068   │ (info "(org) Dynamic Blocks")
   3069   └────
   3070 
   3071 
   3072 [Org dynamic blocks to insert links or backlinks] See section 11.1
   3073 
   3074 [Org dynamic block to insert file contents] See section 11.2
   3075 
   3076 [Writing metanotes] See section 7.9
   3077 
   3078 11.1 Org dynamic blocks to insert links or backlinks
   3079 ────────────────────────────────────────────────────
   3080 
   3081   [ As part of version 2.3.0, all dynamic blocks are defined in the file
   3082     `denote-org-extras.el'. The file which was once called
   3083     `denote-org-dblock.el' contains aliases for the new function names
   3084     and dipslays a warning about its deprecation. There is no need to
   3085     `require' the `denote-org-extras' feature because all of Denote’s
   3086     Org dynamic blocks are autoloaded (meaning that they work as soon as
   3087     they are used). For backward compatibility, all dynamic blocks
   3088     retain their original names as an alias for the newer one. ]
   3089 
   3090   The `denote-links' block can be inserted at point with the command
   3091   `denote-org-extras-dblock-insert-links' or by manually including the
   3092   following in an Org file:
   3093 
   3094   ┌────
   3095   │ #+BEGIN: denote-links :regexp "YOUR REGEXP HERE" :sort-by-component nil :reverse-sort nil :id-only nil
   3096   3097   │ #+END:
   3098   └────
   3099 
   3100 
   3101   The `denote-links' block is also registered as an option for the
   3102   command `org-dynamic-block-insert-dblock'.
   3103 
   3104   Type `C-c C-x C-u' (`org-dblock-update') with point on the `#+BEGIN'
   3105   line to update the block.
   3106 
   3107   • The `:regexp' parameter is mandatory. Its value is a string and its
   3108     behaviour is the same as that of the `denote-add-links' command
   3109     ([Insert links matching a regexp]). Concretely, it produces a
   3110     typographic list of links to files matching the giving regular
   3111     expression. The value of the `:regexp' parameter may also be of the
   3112     form read by the `rx' macro (Lisp notation instead of a string), as
   3113     explained in the Emacs Lisp Reference Manual (evaluate this code to
   3114     read the documentation: `(info "(elisp) Rx Notation")'). Note that
   3115     you do not need to write an actual regular expression to get
   3116     meaningful results: even something like `_journal' will work to
   3117     include all files that have a `journal' keyword.
   3118 
   3119   • The `:sort-by-component' parameter is optional. It sorts the files
   3120     by the given Denote file name component. The value it accepts is an
   3121     unquoted symbol among `title', `keywords', `signature',
   3122     `identifier'.  When using the command
   3123     `denote-org-extras-dblock-insert-files', this parameter is
   3124     automatically inserted together with the (`:regexp' parameter) and
   3125     the user is prompted for a file name component.
   3126 
   3127   • The `:reverse-sort' parameter is optional. It reverses the order in
   3128     which files appear in. This is meaningful even without the presence
   3129     of the parameter `:sort-by-component', though it also combines with
   3130     it.
   3131 
   3132   • The `:id-only' parameter is optional. It accepts a `t' value, in
   3133     which case links are inserted without a description text but only
   3134     with the identifier of the given file. This has the same meaning as
   3135     with the `denote-link' command and related facilities ([Linking
   3136     notes]).
   3137 
   3138   • An optional `:block-name' parameter can be specified with a string
   3139     value to add a `#+name' to the results. This is useful for further
   3140     processing using Org facilities (a feature that is outside Denote’s
   3141     purview).
   3142 
   3143   The same as above except for the `:regexp' parameter are true for the
   3144   `denote-backlinks' block. The block can be inserted at point with the
   3145   command `denote-org-extras-dblock-insert-backlinks' or by manually
   3146   writing this in an Org file:
   3147 
   3148   ┌────
   3149   │ #+BEGIN: denote-backlinks :sort-by-component nil :reverse-sort nil :id-only nil
   3150   3151   │ #+END:
   3152   └────
   3153 
   3154 
   3155   Finally, the `denote-missing-links' block is available with the
   3156   command `denote-org-extras-dblock-insert-missing-links'. It is like
   3157   the aforementioned `denote-links' block, except it only lists links to
   3158   files that are not present in the current buffer. The parameters are
   3159   otherwise the same:
   3160 
   3161   ┌────
   3162   │ #+BEGIN: denote-missing-links :regexp "YOUR REGEXP HERE" :sort-by-component nil :reverse-sort nil :id-only nil
   3163   3164   │ #+END:
   3165   └────
   3166 
   3167 
   3168   Remember to type `C-c C-x C-u' (`org-dblock-update') with point on the
   3169   `#+BEGIN' line to update the block.
   3170 
   3171 
   3172 [Insert links matching a regexp] See section 7.4
   3173 
   3174 [Linking notes] See section 7
   3175 
   3176 
   3177 11.2 Org dynamic block to insert file contents
   3178 ──────────────────────────────────────────────
   3179 
   3180   [ As part of version 2.3.0, all dynamic blocks are defined in the file
   3181     `denote-org-extras.el'. The file which was once called
   3182     `denote-org-dblock.el' contains aliases for the new function names
   3183     and dipslays a warning about its deprecation. There is no need to
   3184     `require' the `denote-org-extras' feature because all of Denote’s
   3185     Org dynamic blocks are autoloaded (meaning that they work as soon as
   3186     they are used). For backward compatibility, all dynamic blocks
   3187     retain their original names as an alias for the newer one. ]
   3188 
   3189   Denote can optionally use Org’s dynamic blocks facility to produce a
   3190   section that lists entire file contents ([Use Org dynamic blocks]).
   3191   This works by instructing Org to match a regular expression of Denote
   3192   files, the same way we do with Denote links ([Insert links matching a
   3193   regexp]).
   3194 
   3195   This is useful to, for example, compile a dynamically concatenated
   3196   list of scattered thoughts on a given topic, like `^2023.*_emacs' for
   3197   a long entry that incorporates all the notes written in 2023 with the
   3198   keyword `emacs'.
   3199 
   3200   To produce such a block, call the command
   3201   `denote-org-extras-dblock-insert-files' or manually write the
   3202   following block in an Org file and then type `C-c C-x C-u'
   3203   (`org-dblock-update') on the `#+BEGIN' line to run it (do it again to
   3204   recalculate the block):
   3205 
   3206   ┌────
   3207   │ #+BEGIN: denote-files :regexp "YOUR REGEXP HERE"
   3208   3209   │ #+END:
   3210   └────
   3211 
   3212 
   3213   To fully control the output, include these additional optional
   3214   parameters, which are described further below:
   3215 
   3216   ┌────
   3217   │ #+BEGIN: denote-files :regexp "YOUR REGEXP HERE" :sort-by-component nil :reverse-sort nil :no-front-matter nil :file-separator nil :add-links nil
   3218   3219   │ #+END:
   3220   └────
   3221 
   3222 
   3223   • The `:regexp' parameter is mandatory. Its value is a string,
   3224     representing a regular expression to match Denote file names. Its
   3225     value may also be an `rx' expression instead of a string, as noted
   3226     in the previous section ([Org dynamic blocks to insert links or
   3227     backlinks]).  Note that you do not need to write an actual regular
   3228     expression to get meaningful results: even something like `_journal'
   3229     will work to include all files that have a `journal' keyword.
   3230 
   3231   • The `:sort-by-component' parameter is optional. It sorts the files
   3232     by the given Denote file name component. The value it accepts is an
   3233     unquoted symbol among `title', `keywords', `signature',
   3234     `identifier'.  When using the command
   3235     `denote-org-extras-dblock-insert-files', this parameter is
   3236     automatically inserted together with the (`:regexp' parameter) and
   3237     the user is prompted for a file name component.
   3238 
   3239   • The `:reverse-sort' parameter is optional. It reverses the order in
   3240     which files appear in. This is meaningful even without the presence
   3241     of the parameter `:sort-by-component', though it also combines with
   3242     it.
   3243 
   3244   • The `:file-separator' parameter is optional. If it is omitted, then
   3245     Denote will use no separator between the files it inserts. If the
   3246     value is `t' the `denote-org-extras-dblock-file-contents-separator'
   3247     is applied at the end of each file: it introduces some empty lines
   3248     and a horizontal rule between them to visually distinguish
   3249     individual files. If the `:file-separator' value is a string, it is
   3250     used as the file separator (e.g. use `"\n"' to insert just one empty
   3251     new line).
   3252 
   3253   • The `:no-front-matter' parameter is optional. When set to a `t'
   3254     value, Denote tries to remove front matter from the files it is
   3255     inserting in the dynamic block. The technique used to perform this
   3256     operation is by removing all lines from the top of the file until
   3257     the first empty line. This works with the default front matter that
   3258     Denote adds, but is not 100% reliable with all sorts of user-level
   3259     modifications and edits to the file. When the `:no-front-matter' is
   3260     set to a natural number, Denote will omit that many lines from the
   3261     top of the file.
   3262 
   3263   • The `:add-links' parameter is optional. When it is set to a `t'
   3264     value, all files are inserted as a typographic list and are indented
   3265     accordingly. The first line in each list item is a link to the file
   3266     whose contents are inserted in the following lines. When the value
   3267     is `id-only', then links are inserted without a description text but
   3268     only with the identifier of the given file. This has the same
   3269     meaning as with the `denote-link' command and related facilities
   3270     ([Linking notes]). Remember that Org can fold the items in a
   3271     typographic list the same way it does with headings. So even long
   3272     files can be presented in this format without much trouble.
   3273 
   3274   • An optional `:block-name' parameter can be specified with a string
   3275     value to add a `#+name' to the results. This is useful for further
   3276     processing using Org facilities (a feature that is outside Denote’s
   3277     purview).
   3278 
   3279 
   3280 [Use Org dynamic blocks] See section 11
   3281 
   3282 [Insert links matching a regexp] See section 7.4
   3283 
   3284 [Org dynamic blocks to insert links or backlinks] See section 11.1
   3285 
   3286 [Linking notes] See section 7
   3287 
   3288 
   3289 12 Sort files by component
   3290 ══════════════════════════
   3291 
   3292   The `denote-sort.el' file is an optional extension to the core
   3293   functionality of Denote, which empowers users to sort files by the
   3294   given file name component ([The file-naming scheme]).
   3295 
   3296   The command `denote-sort-dired' produces a Dired file listing with a
   3297   flat, filtered, and sorted set of files from the `denote-directory'.
   3298   It does so by means of three minibuffer prompts:
   3299 
   3300   1. It first asks for a regular expression with which to match Denote
   3301      files. Remember that due to Denote’s efficient file-naming scheme,
   3302      you do not need to write some complex regular expression. Even
   3303      something like `_journal' will match only files with a `journal'
   3304      keyword.
   3305   2. Once the regular expression is provided, the command asks for a
   3306      Denote file name component to sort files by. This is a symbol among
   3307      `title', `keywords', `signature', and `identifier'.
   3308   3. Finally, it asks a “yes or no” on whether to reverse the sort
   3309      order.
   3310 
   3311   The resulting Dired listing is a regular Dired buffer, unlike that of
   3312   `dired-virtual-mode' ([Use `dired-virtual-mode' for arbitrary file
   3313   listings]).
   3314 
   3315   The dynamic Org blocks that Denote defines to insert file contents
   3316   also use this feature ([Org dynamic block to insert file contents]).
   3317 
   3318   DEVELOPMENT NOTE as of 2023-11-30 07:24 +0200: The sort mechanism will
   3319   be incorporated in more functions on a case-by-case basis, subject to
   3320   user feedback. For the time being, I am not documenting the functions
   3321   that are only accessed from Lisp. Do not hesitate to contact me
   3322   (Protesilaos) in person or on one of the development sources (mailing
   3323   list or GitHub/GitLab mirror) if you have a use-case where sorting
   3324   seems useful. I am happy to help but do not want to roll this feature
   3325   everywhere before eliciting relevant feedback: once we add it, we are
   3326   not going back.
   3327 
   3328 
   3329 [The file-naming scheme] See section 5
   3330 
   3331 [Use `dired-virtual-mode' for arbitrary file listings] See section 15.3
   3332 
   3333 [Org dynamic block to insert file contents] See section 11.2
   3334 
   3335 
   3336 13 Keep a journal or diary
   3337 ══════════════════════════
   3338 
   3339   Denote provides a general-purpose mechanism to create new files that
   3340   broadly count as “notes” ([Points of entry]).  Such files can be daily
   3341   entries in a journal.  While it is possible to use the generic
   3342   `denote' command to maintain a journal, we provide an optional set of
   3343   convenience options and commands as part of
   3344   `denote-journal-extras.el'.  To use those, add the following the
   3345   Denote configuration:
   3346 
   3347   ┌────
   3348   │ (require 'denote-journal-extras)
   3349   └────
   3350 
   3351   The command `denote-journal-extras-new-entry' creates a new entry in
   3352   the journal.  Such a file has the `denote-journal-extras-keyword',
   3353   which is `journal' by default ([The file-naming scheme]).  The user
   3354   can set this keyword to an arbitrary string (single word is
   3355   preferred).  New journal entries can be stored in the
   3356   `denote-directory' or subdirectory thereof.  To make it easier for the
   3357   user, the new journal entry will be placed in
   3358   `denote-journal-extras-directory', which defaults to a subdirectory of
   3359   `denote-directory' called `journal'.
   3360 
   3361   If `denote-journal-extras-directory' is nil, the `denote-directory' is
   3362   used.  Journal entries will thus be in a flat listing together with
   3363   all other notes.  They can still be retrieved easily by searching for
   3364   the `denote-journal-extras-keyword' ([Features of the file-naming
   3365   scheme for searching or filtering]).
   3366 
   3367   Furthermore, the command `denote-journal-extras-new-entry' will use
   3368   the current date as the title of the new entry.  The exact format is
   3369   controlled by the user option `denote-journal-extras-title-format'.
   3370   Acceptable values for `denote-journal-extras-title-format' and their
   3371   corresponding styles are:
   3372 
   3373   ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
   3374    Symbol                   Style                             
   3375   ────────────────────────────────────────────────────────────
   3376    day                      Monday                            
   3377    day-date-month-year      Monday 19 September 2023          
   3378    day-date-month-year-24h  Monday 19 September 2023 20:49    
   3379    day-date-month-year-12h  Monday 19 September 2023 08:49 PM 
   3380   ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
   3381 
   3382   For example:
   3383 
   3384   ┌────
   3385   │ (setq denote-journal-extras-title-format 'day-date-month-year)
   3386   └────
   3387 
   3388   If the value of this user option is `nil', then
   3389   `denote-journal-extras-new-entry' will prompt for a title.
   3390 
   3391   The `denote-journal-extras-new-entry' command also accepts an optional
   3392   `DATE' argument. When called internactively, this is a universal
   3393   prefix (e.g. `C-u' with the default key bindings). With `DATE', it
   3394   prompts for a date to create a new journal entry for. The date prompt
   3395   can optionally use the Org date+calendar selection interface ([The
   3396   `denote-date-prompt-use-org-read-date' option]).
   3397 
   3398   In terms of workflow, using the current date as the title is better
   3399   for maintaining a daily journal.  A prompt for an arbitrary title is
   3400   more suitable for those who like to keep a record of something like a
   3401   thought or event (though this can also be achieved by the regular
   3402   `denote' command or maybe `denote-subdirectory').
   3403 
   3404   The `denote-journal-extras-new-entry' command calls the normal hook
   3405   `denote-journal-extras-hook' after it is done.  The user can leverage
   3406   this to produce consequences therefrom, such as to set a timer with
   3407   the `tmr' package from GNU ELPA ([Journaling with a timer]).
   3408 
   3409   The command `denote-journal-extras-new-or-existing-entry' locates an
   3410   existing journal entry or creates a new one.  A journal entry is one
   3411   that has `denote-journal-extras-keyword' as part of its file name.  If
   3412   there are multiple journal entries for the current date, it prompts
   3413   for one among them using minibuffer completion.  If there is only one,
   3414   it visits it outright.  If there is no journal entry, it creates one
   3415   by calling `denote-journal-extra-new-entry' (as described above).
   3416 
   3417   The command `denote-journal-extras-link-or-create-entry' links to the
   3418   journal entry for today or creates it in the background, if missing,
   3419   and then links to it from the current file. If there are multiple
   3420   journal entries for the same day, it prompts to select one among them
   3421   and then links to it. When called with an optional prefix argument
   3422   (such as `C-u' with default key bindings), the command prompts for a
   3423   date and then performs the aforementioned. With a double prefix
   3424   argument (`C-u C-u'), it also produces a link whose description
   3425   includes just the file’s identifier.
   3426 
   3427 
   3428 [Points of entry] See section 3
   3429 
   3430 [The file-naming scheme] See section 5
   3431 
   3432 [Features of the file-naming scheme for searching or filtering] See
   3433 section 5.3
   3434 
   3435 [The `denote-date-prompt-use-org-read-date' option] See section 3.1.6
   3436 
   3437 [Journaling with a timer] See section 13.1
   3438 
   3439 13.1 Journaling with a timer
   3440 ────────────────────────────
   3441 
   3442   [ Revised as part of version 2.1.0 to conform with how we now tend to
   3443     the needs of users who use Denote for journaling purposes ([Keep a
   3444     journal or diary]). ]
   3445 
   3446   Sometimes journaling is done with the intent to hone one’s writing
   3447   skills.  Perhaps you are learning a new language or wish to
   3448   communicate your ideas with greater clarity and precision.  As with
   3449   everything that requires a degree of sophistication, you have to work
   3450   for it—write, write, write!
   3451 
   3452   One way to test your progress is to set a timer.  It helps you gauge
   3453   your output and its quality.  To use a timer with Emacs, consider the
   3454   `tmr' package.  A new timer can be set with something like this:
   3455 
   3456   ┌────
   3457   │ ;; Set 10 minute timer with the given description
   3458   │ (tmr "10" "Practice writing in my journal")
   3459   └────
   3460 
   3461   To make this timer start as soon as a new journal entry is created
   3462   with the command `denote-journal-extras-new-entry', add a function to
   3463   the `denote-journal-extras-hook'.  For example:
   3464 
   3465   ┌────
   3466   │ ;; Add an anonymous function, which is more difficult to modify after
   3467   │ ;; the fact:
   3468   │ (add-hook 'denote-journal-extras-hook (lambda ()
   3469   │ 					(tmr "10" "Practice writing in my journal")))
   3470   3471   │ ;; Or write a small function that you can then modify without
   3472   │ ;; revaluating the hook:
   3473   │ (defun my-denote-tmr ()
   3474   │   (tmr "10" "Practice writing in my journal"))
   3475   3476   │ (add-hook 'denote-journal-extras-hook 'my-denote-tmr)
   3477   3478   │ ;; Or to make it fully featured, define variables for the duration and
   3479   │ ;; the description and set it up so that you only need to modify
   3480   │ ;; those:
   3481   │ (defvar my-denote-tmr-duration "10")
   3482   3483   │ (defvar my-denote-tmr-description "Practice writing in my journal")
   3484   3485   │ (defun my-denote-tmr ()
   3486   │   (tmr my-denote-tmr-duration my-denote-tmr-description))
   3487   3488   │ (add-hook 'denote-journal-extras-hook 'my-denote-tmr)
   3489   └────
   3490 
   3491   Once the timer elapses, stop writing and review your performance.
   3492   Practice makes perfect!
   3493 
   3494   Sources for `tmr':
   3495 
   3496   ⁃ Package name (GNU ELPA): `tmr'
   3497   ⁃ Official manual: <https://protesilaos.com/emacs/tmr>
   3498   ⁃ Change log: <https://protesilaos.com/emacs/denote-changelog>
   3499   ⁃ Git repo on SourceHut: <https://git.sr.ht/~protesilaos/tmr>
   3500     • Mirrors:
   3501       ⁃ GitHub: <https://github.com/protesilaos/tmr>
   3502       ⁃ GitLab: <https://gitlab.com/protesilaos/tmr>
   3503   ⁃ Mailing list: <https://lists.sr.ht/~protesilaos/tmr>
   3504 
   3505 
   3506 [Keep a journal or diary] See section 13
   3507 
   3508 
   3509 14 Minibuffer histories
   3510 ═══════════════════════
   3511 
   3512   Denote has a dedicated minibuffer history for each one of its prompts.
   3513   This practically means that using `M-p' (`previous-history-element')
   3514   and `M-n' (`next-history-element') will only cycle through the
   3515   relevant record of inputs, such as your latest titles in the `TITLE'
   3516   prompt, and keywords in the `KEYWORDS' prompt.
   3517 
   3518   The built-in `savehist' library saves minibuffer histories.  Sample
   3519   configuration:
   3520 
   3521   ┌────
   3522   │ (require 'savehist)
   3523   │ (setq savehist-file (locate-user-emacs-file "savehist"))
   3524   │ (setq history-length 500)
   3525   │ (setq history-delete-duplicates t)
   3526   │ (setq savehist-save-minibuffer-history t)
   3527   │ (add-hook 'after-init-hook #'savehist-mode)
   3528   └────
   3529 
   3530 
   3531 15 Extending Denote
   3532 ═══════════════════
   3533 
   3534   Denote is a tool with a narrow scope: create notes and link between
   3535   them, based on the aforementioned file-naming scheme.  For other
   3536   common operations the user is advised to rely on standard Emacs
   3537   facilities or specialised third-party packages.  This section covers
   3538   the details.
   3539 
   3540 
   3541 15.1 Create a new note in any directory
   3542 ───────────────────────────────────────
   3543 
   3544   The commands that create new files are designed to write to the
   3545   `denote-directory'. The idea is that the linking mechanism can find
   3546   any file by its identifier if it is in the `denote-directory'
   3547   (searching the entire file system would be cumbersome).
   3548 
   3549   However, these are cases where the user needs to create a new note in
   3550   an arbitrary directory. The following command can do this. Put the
   3551   code in your configuration file and evaluate it. Then call the command
   3552   by its name with `M-x'.
   3553 
   3554   ┌────
   3555   │ (defun my-denote-create-note-in-any-directory ()
   3556   │   "Create new Denote note in any directory.
   3557   │ Prompt for the directory using minibuffer completion."
   3558   │   (declare (interactive-only t))
   3559   │   (interactive)
   3560   │   (let ((denote-directory (read-directory-name "New note in: " nil nil :must-match)))
   3561   │     (call-interactively 'denote)))
   3562   └────
   3563 
   3564 
   3565 15.2 Narrow the list of files in Dired
   3566 ──────────────────────────────────────
   3567 
   3568   Emacs’ standard file manager (or directory editor) can read a regular
   3569   expression to mark the matching files.  This is the command
   3570   `dired-mark-files-regexp', which is bound to `% m' by default.  For
   3571   example, `% m _denote' will match all files that have the `denote'
   3572   keyword ([Features of the file-naming scheme for searching or
   3573   filtering]).
   3574 
   3575   Once the files are matched, the user has two options: (i) narrow the
   3576   list to the matching items or (ii) exclude the matching items from the
   3577   list.
   3578 
   3579   For the former, we want to toggle the marks by typing `t' (calls the
   3580   command `dired-toggle-marks' by default) and then hit the letter `k'
   3581   (for `dired-do-kill-lines').  The remaining files are those that match
   3582   the regexp that was provided earlier.
   3583 
   3584   For the latter approach of filtering out the matching items, simply
   3585   involves the use of the `k' command (`dired-do-kill-lines') to omit
   3586   the marked files from the list.
   3587 
   3588   These sequences can be combined to incrementally narrow the list.
   3589   Note that `dired-do-kill-lines' does not delete files: it simply hides
   3590   them from the current view.
   3591 
   3592   Revert to the original listing with `g' (`revert-buffer').
   3593 
   3594   For a convenient wrapper, consider this example:
   3595 
   3596   ┌────
   3597   │ (defvar prot-dired--limit-hist '()
   3598   │   "Minibuffer history for `prot-dired-limit-regexp'.")
   3599   3600   │ ;;;###autoload
   3601   │ (defun prot-dired-limit-regexp (regexp omit)
   3602   │   "Limit Dired to keep files matching REGEXP.
   3603   3604   │ With optional OMIT argument as a prefix (\\[universal-argument]),
   3605   │ exclude files matching REGEXP.
   3606   3607   │ Restore the buffer with \\<dired-mode-map>`\\[revert-buffer]'."
   3608   │   (interactive
   3609   │    (list
   3610   │     (read-regexp
   3611   │      (concat "Files "
   3612   │ 	     (when current-prefix-arg
   3613   │ 	       (propertize "NOT " 'face 'warning))
   3614   │ 	     "matching PATTERN: ")
   3615   │      nil 'prot-dired--limit-hist)
   3616   │     current-prefix-arg))
   3617   │   (dired-mark-files-regexp regexp)
   3618   │   (unless omit (dired-toggle-marks))
   3619   │   (dired-do-kill-lines))
   3620   └────
   3621 
   3622 
   3623 [Features of the file-naming scheme for searching or filtering] See
   3624 section 5.3
   3625 
   3626 
   3627 15.3 Use `dired-virtual-mode' for arbitrary file listings
   3628 ─────────────────────────────────────────────────────────
   3629 
   3630   Emacs’ Dired is a powerful file manager that builds its functionality
   3631   on top of the Unix `ls' command.  As noted elsewhere in this manual,
   3632   the user can update the `ls' flags that Dired uses to display its
   3633   contents ([I want to sort by last modified, why won’t Denote let
   3634   me?]).
   3635 
   3636   What Dired cannot do is parse the output of a result that is produced
   3637   by piped commands, such as `ls -l | sort -t _ -k2'.  This specific
   3638   example targets the second underscore-separated field of the file
   3639   name, per our conventions ([The file-naming scheme]).  Conceretely, it
   3640   matches the “alpha” as the sorting key in something like this:
   3641 
   3642   ┌────
   3643   │ 20220929T200432--testing-file-one__alpha.txt
   3644   └────
   3645 
   3646   Consider then, how Dired will sort those files by their identifier:
   3647 
   3648   ┌────
   3649   │ 20220929T200432--testing-file-one__alpha.txt
   3650   │ 20220929T200532--testing-file-two__beta.txt
   3651   │ 20220929T200632--testing-file-three__alpha.txt
   3652   │ 20220929T200732--testing-file-four__beta.txt
   3653   └────
   3654 
   3655   Whereas on the command line, we can get the following:
   3656 
   3657   ┌────
   3658   │ $ ls | sort -t _ -k 2
   3659   │ 20220929T200432--testing-file-one__alpha.txt
   3660   │ 20220929T200632--testing-file-three__alpha.txt
   3661   │ 20220929T200532--testing-file-two__beta.txt
   3662   │ 20220929T200732--testing-file-four__beta.txt
   3663   └────
   3664 
   3665   This is where `dired-virtual-mode' shows its utility.  If we tweak our
   3666   command-line invocation to include `ls -l', this mode can behave like
   3667   Dired on the listed files.  (We omit the output of the `-l' flag from
   3668   this tutorial, as it is too verbose.)
   3669 
   3670   What we now need is to capture the output of `ls -l | sort -t _ -k 2'
   3671   in an Emacs buffer and then enable `dired-virtual-mode'.  To do that,
   3672   we can rely on either `M-x shell' or `M-x eshell' and then manually
   3673   copy the relevant contents.
   3674 
   3675   For the user’s convenience, I share what I have for Eshell to quickly
   3676   capture the last command’s output in a dedicated buffer:
   3677 
   3678   ┌────
   3679   │ (defcustom prot-eshell-output-buffer "*Exported Eshell output*"
   3680   │   "Name of buffer with the last output of Eshell command.
   3681   │ Used by `prot-eshell-export'."
   3682   │   :type 'string
   3683   │   :group 'prot-eshell)
   3684   3685   │ (defcustom prot-eshell-output-delimiter "* * *"
   3686   │   "Delimiter for successive `prot-eshell-export' outputs.
   3687   │ This is formatted internally to have newline characters before
   3688   │ and after it."
   3689   │   :type 'string
   3690   │   :group 'prot-eshell)
   3691   3692   │ (defun prot-eshell--command-prompt-output ()
   3693   │   "Capture last command prompt and its output."
   3694   │   (let ((beg (save-excursion
   3695   │ 	       (goto-char (eshell-beginning-of-input))
   3696   │ 	       (goto-char (point-at-bol)))))
   3697   │     (when (derived-mode-p 'eshell-mode)
   3698   │       (buffer-substring-no-properties beg (eshell-end-of-output)))))
   3699   3700   │ ;;;###autoload
   3701   │ (defun prot-eshell-export ()
   3702   │   "Produce a buffer with output of the last Eshell command.
   3703   │ If `prot-eshell-output-buffer' does not exist, create it.  Else
   3704   │ append to it, while separating multiple outputs with
   3705   │ `prot-eshell-output-delimiter'."
   3706   │   (interactive)
   3707   │   (let ((eshell-output (prot-eshell--command-prompt-output)))
   3708   │     (with-current-buffer (get-buffer-create prot-eshell-output-buffer)
   3709   │       (let ((inhibit-read-only t))
   3710   │ 	(goto-char (point-max))
   3711   │ 	(unless (eq (point-min) (point-max))
   3712   │ 	  (insert (format "\n%s\n\n" prot-eshell-output-delimiter)))
   3713   │ 	(goto-char (point-at-bol))
   3714   │ 	(insert eshell-output)
   3715   │ 	(switch-to-buffer-other-window (current-buffer))))))
   3716   └────
   3717 
   3718   Bind `prot-eshell-export' to a key in the `eshell-mode-map' and give
   3719   it a try (I use `C-c C-e').  In the produced buffer, activate the
   3720   `dired-virtual-mode'.
   3721 
   3722 
   3723 [I want to sort by last modified, why won’t Denote let me?] See section
   3724 23.7
   3725 
   3726 [The file-naming scheme] See section 5
   3727 
   3728 
   3729 15.4 Use Embark to collect minibuffer candidates
   3730 ────────────────────────────────────────────────
   3731 
   3732   `embark' is a remarkable package that lets you perform relevant,
   3733   context-dependent actions using a prefix key (simplifying in the
   3734   interest of brevity).
   3735 
   3736   For our purposes, Embark can be used to produce a Dired listing
   3737   directly from the minibuffer.  Suppose the current note has links to
   3738   three other notes.  You might use the `denote-find-link' command to
   3739   pick one via the minibuffer.  But why not turn those three links into
   3740   their own Dired listing?  While in the minibuffer, invoke `embark-act'
   3741   which you may have already bound to `C-.' and then follow it up with
   3742   `E' (for the `embark-export' command).
   3743 
   3744   This pattern can be repeated with any list of candidates, meaning that
   3745   you can narrow the list by providing some input before eventually
   3746   exporting the results with Embark.
   3747 
   3748   Overall, this is very powerful and you might prefer it over doing the
   3749   same thing directly in Dired, since you also benefit from all the
   3750   power of the minibuffer ([Narrow the list of files in Dired]).
   3751 
   3752 
   3753 [Narrow the list of files in Dired] See section 15.2
   3754 
   3755 
   3756 15.5 Search file contents
   3757 ─────────────────────────
   3758 
   3759   Emacs provides built-in commands which are wrappers of standard Unix
   3760   tools: `M-x grep' lets the user input the flags of a `grep' call and
   3761   pass a regular expression to the `-e' flag.
   3762 
   3763   The author of Denote uses this thin wrapper instead:
   3764 
   3765   ┌────
   3766   │ (defvar prot-search--grep-hist '()
   3767   │   "Input history of grep searches.")
   3768   3769   │ ;;;###autoload
   3770   │ (defun prot-search-grep (regexp &optional recursive)
   3771   │   "Run grep for REGEXP.
   3772   3773   │ Search in the current directory using `lgrep'.  With optional
   3774   │ prefix argument (\\[universal-argument]) for RECURSIVE, run a
   3775   │ search starting from the current directory with `rgrep'."
   3776   │   (interactive
   3777   │    (list
   3778   │     (read-from-minibuffer (concat (if current-prefix-arg
   3779   │ 				      (propertize "Recursive" 'face 'warning)
   3780   │ 				    "Local")
   3781   │ 				  " grep for PATTERN: ")
   3782   │ 			  nil nil nil 'prot-search--grep-hist)
   3783   │     current-prefix-arg))
   3784   │   (unless grep-command
   3785   │     (grep-compute-defaults))
   3786   │   (if recursive
   3787   │       (rgrep regexp "*" default-directory)
   3788   │     (lgrep regexp "*" default-directory)))
   3789   └────
   3790 
   3791   Rather than maintain custom code, consider using the excellent
   3792   `consult' package: it provides commands such as `consult-grep' and
   3793   `consult-find' which provide live results and are generally easier to
   3794   use than the built-in commands.
   3795 
   3796 
   3797 15.6 Bookmark the directory with the notes
   3798 ──────────────────────────────────────────
   3799 
   3800   Part of the reason Denote does not reinvent existing functionality is
   3801   to encourage you to learn more about Emacs.  You do not need a bespoke
   3802   “jump to my notes” directory because such commands do not scale well.
   3803   Will you have a “jump to my downloads” then another for multimedia and
   3804   so on?  No.
   3805 
   3806   Emacs has a built-in framework for recording persistent markers to
   3807   locations.  Visit the `denote-directory' (or any dir/file for that
   3808   matter) and invoke the `bookmark-set' command (bound to `C-x r m' by
   3809   default).  It lets you create a bookmark.
   3810 
   3811   The list of bookmarks can be reviewed with the `bookmark-bmenu-list'
   3812   command (bound to `C-x r l' by default).  A minibuffer interface is
   3813   available with `bookmark-jump' (`C-x r b').
   3814 
   3815   If you use the `consult' package, its default `consult-buffer' command
   3816   has the means to group together buffers, recent files, and bookmarks.
   3817   Each of those types can be narrowed to with a prefix key.  The package
   3818   `consult-dir' is an extension to `consult' which provides useful
   3819   extras for working with directories, including bookmarks.
   3820 
   3821 
   3822 15.7 Use the `denote-explore' package to explore your notes
   3823 ───────────────────────────────────────────────────────────
   3824 
   3825   Peter Prevos has developed the `denote-explore' package which provides
   3826   four groups of Emacs commands to explore your Denote files:
   3827 
   3828   Summary statistics
   3829         Count notes, attachments and keywords.
   3830   Random walks
   3831         Generate new ideas using serendipity.
   3832   Janitor
   3833         Manage your denote collection.
   3834   Visualisations
   3835         Visualise your Denote network.
   3836 
   3837   The package’s documentation covers the details:
   3838   <https://lucidmanager.org/productivity/denote-explore/>.
   3839 
   3840 
   3841 15.8 Use the `citar-denote' package for bibliography notes
   3842 ──────────────────────────────────────────────────────────
   3843 
   3844   Peter Prevos has produced the `citar-denote' package which makes it
   3845   possible to write notes on BibTeX entries with the help of the `citar'
   3846   package.  These notes have the citation’s unique key associated with
   3847   them in the file’s front matter.  They also get a configurable keyword
   3848   in their file name, making it easy to find them in Dired and/or
   3849   retrieve them with the various Denote methods.
   3850 
   3851   With `citar-denote', the user leverages standard minibuffer completion
   3852   mechanisms (e.g. with the help of the `vertico' and `embark' packages)
   3853   to manage bibliographic notes and access those notes with ease.  The
   3854   package’s documentation covers the details:
   3855   <https://lucidmanager.org/productivity/bibliographic-notes-in-emacs-with-citar-denote/>.
   3856 
   3857 
   3858 15.9 Use the `consult-notes' package
   3859 ────────────────────────────────────
   3860 
   3861   If you are using Daniel Mendler’s `consult' (which is a brilliant
   3862   package), you will most probably like its `consult-notes' extension,
   3863   developed by Colin McLear.  It uses the familiar mechanisms of Consult
   3864   to preview the currently selected entry and to filter searches via a
   3865   prefix key.  For example:
   3866 
   3867   ┌────
   3868   │ (setq consult-notes-file-dir-sources
   3869   │       `(("Denote Notes"  ?d ,(denote-directory))
   3870   │ 	("Books"  ?b "~/Documents/books/")))
   3871   └────
   3872 
   3873   With the above, `M-x consult-notes' will list the files in those two
   3874   directories.  If you type `d' and space, it narrows the list to just
   3875   the notes, while `b' does the same for books.
   3876 
   3877   The other approach is to enable the `consult-notes-denote-mode'.  It
   3878   takes care to add the `denote-directory' to the sources that
   3879   `consult-notes' reads from.  Denote notes are then filtered by the `d'
   3880   prefix followed by a space.
   3881 
   3882   The minor mode has the extra feature of reformatting the title of
   3883   notes shown in the minibuffer.  It isolates the `TITLE' component of
   3884   each note and shows it without hyphens, while presenting keywords in
   3885   their own column.  The user option `consult-notes-denote-display-id'
   3886   can be set to `nil' to hide the identifier.  Depending on how one
   3887   searches through their notes, this refashioned presentation may be the
   3888   best option ([Features of the file-naming scheme for searching or
   3889   filtering]).
   3890 
   3891 
   3892 [Features of the file-naming scheme for searching or filtering] See
   3893 section 5.3
   3894 
   3895 
   3896 15.10 Use the `denote-menu' package
   3897 ───────────────────────────────────
   3898 
   3899   Denote’s file-naming scheme is designed to be efficient and to provide
   3900   valueable meta information about the file.  The cost, however, is that
   3901   it is terse and harder to read, depending on how the user chooses to
   3902   filter and process their notes.
   3903 
   3904   To this end, [the `denote-menu' package by Mohamed Suliman] provides
   3905   the convenience of a nice tabular interface for all notes.
   3906   `denote-menu' removes the delimiters that are found in Denote file
   3907   names and presents the information in a human-readable format.
   3908   Furthermore, the package provides commands to interact with the list
   3909   of notes, such as to filter them and to transition from the tabular
   3910   list to Dired.  Its documentation expands on the technicalities.
   3911 
   3912 
   3913 [the `denote-menu' package by Mohamed Suliman]
   3914 <https://github.com/namilus/denote-menu>
   3915 
   3916 
   3917 15.11 Treat your notes as a project
   3918 ───────────────────────────────────
   3919 
   3920   Emacs has a built-in library for treating a directory tree as a
   3921   “project”.  This means that the contents of this tree are seen as part
   3922   of the same set, so commands like `project-switch-to-buffer' (`C-x p
   3923   b' by default) will only consider buffers in the current project
   3924   (e.g. three notes that are currently being visited).
   3925 
   3926   Normally, a “project” is a directory tree whose root is under version
   3927   control.  For our purposes, all you need is to navigate to the
   3928   `denote-directory' (for the shell or via Dired) and use the
   3929   command-line to run this (requires the `git' executable):
   3930 
   3931   ┌────
   3932   │ git init
   3933   └────
   3934 
   3935 
   3936   From Dired, you can type `M-!' which invokes
   3937   `dired-smart-shell-command' and then run the git call there.
   3938 
   3939   The project can then be registered by invoking any project-related
   3940   command inside of it, such as `project-find-file' (`C-x p f').
   3941 
   3942   It is a good idea to keep your notes under version control, as that
   3943   gives you a history of changes for each file.  We shall not delve into
   3944   the technicalities here, though suffice to note that Emacs’ built-in
   3945   version control framework or the exceptionally well-crafted `magit'
   3946   package will get the job done (VC can work with other backends besides
   3947   Git).
   3948 
   3949 
   3950 15.12 Use the tree-based file prompt for select commands
   3951 ────────────────────────────────────────────────────────
   3952 
   3953   Older versions of Denote had a file prompt that resembled that of the
   3954   standard `find-file' command (bound to `C-x C-f' by default).  This
   3955   means that it used a tree-based method of navigating the filesystem by
   3956   selecting the specific directory and then the given file.
   3957 
   3958   Currently, Denote flattens the file prompt so that every file in the
   3959   `denote-directory' and its subdirectories can be matched from anywhere
   3960   using the power of Emacs’ minibuffer completion (such as with the help
   3961   of the `orderless' package in addition to built-in options).
   3962 
   3963   Users who need the old behaviour on a per-command basis can define
   3964   their own wrapper functions as shown in the following code block.
   3965 
   3966   ┌────
   3967   │ ;; This is the old `denote-file-prompt' that we renamed to
   3968   │ ;; `denote-file-prompt-original' for clarity.
   3969   │ (defun denote-file-prompt-original (&optional initial-text)
   3970   │   "Prompt for file with identifier in variable `denote-directory'.
   3971   │ With optional INITIAL-TEXT, use it to prepopulate the minibuffer."
   3972   │   (read-file-name "Select note: " (denote-directory) nil nil initial-text
   3973   │ 		  (lambda (f)
   3974   │ 		    (or (denote-file-has-identifier-p f)
   3975   │ 			(file-directory-p f)))))
   3976   3977   │ ;; Our wrapper command that changes the current `denote-file-prompt'
   3978   │ ;; to the functionality of `denote-file-prompt-original' only when
   3979   │ ;; this command is used.
   3980   │ (defun my-denote-link ()
   3981   │   "Call `denote-link' but use Denote's original file prompt.
   3982   │ See `denote-file-prompt-original'."
   3983   │   (interactive)
   3984   │   (cl-letf (((symbol-function 'denote-file-prompt) #'denote-file-prompt-original))
   3985   │     (call-interactively #'denote-link)))
   3986   └────
   3987 
   3988 
   3989 15.13 Rename files with Denote in the Image Dired thumbnails buffer
   3990 ───────────────────────────────────────────────────────────────────
   3991 
   3992   [Rename files with Denote using `dired-preview']
   3993 
   3994   Just as with the `denote-dired-rename-marked-files-with-keywords', we
   3995   can use Denote in the Image Dired buffer ([Rename multiple files at
   3996   once]).  Here is the custom code:
   3997 
   3998   ┌────
   3999   │ (autoload 'image-dired--with-marked "image-dired")
   4000   │ (autoload 'image-dired-original-file-name "image-dired-util")
   4001   4002   │ (defun my-denote-image-dired-rename-marked-files (keywords)
   4003   │   "Like `denote-dired-rename-marked-files-with-keywords' but for Image Dired.
   4004   │ Prompt for KEYWORDS and rename all marked files in the Image
   4005   │ Dired buffer to have a Denote-style file name with the given
   4006   │ KEYWORDS.
   4007   4008   │ IMPORTANT NOTE: if there are marked files in the corresponding
   4009   │ Dired buffers, those will be targeted as well.  This is not the
   4010   │ fault of Denote: it is how Dired and Image Dired work in tandem.
   4011   │ To only rename the marked thumbnails, start by unmarking
   4012   │ everything in Dired.  Then mark the items in Image Dired and
   4013   │ invoke this command."
   4014   │   (interactive (list (denote-keywords-prompt)) image-dired-thumbnail-mode)
   4015   │   (image-dired--with-marked
   4016   │    (when-let* ((file (image-dired-original-file-name))
   4017   │ 	       (dir (file-name-directory file))
   4018   │ 	       (id (or (denote-retrieve-filename-identifier file) ""))
   4019   │ 	       (file-type (denote-filetype-heuristics file))
   4020   │ 	       (title (denote--retrieve-title-or-filename file file-type))
   4021   │ 	       (signature (or (denote-retrieve-filename-signature file) "")
   4022   │ 	       (extension (file-name-extension file t))
   4023   │ 	       (new-name (denote-format-file-name dir id keywords title extension signature))
   4024   │ 	       (default-directory dir))
   4025   │      (denote-rename-file-and-buffer file new-name))))
   4026   └────
   4027 
   4028   While the `my-denote-image-dired-rename-marked-files' renames files in
   4029   the helpful Denote-compliant way, users may still need to not prepend
   4030   a unique identifier and not sluggify (hyphenate and downcase) the
   4031   image’s existing file name.  To this end, the following custom command
   4032   can be used instead:
   4033 
   4034   ┌────
   4035   │ (defun my-image-dired-rename-marked-files (keywords)
   4036   │   "Like `denote-dired-rename-marked-files-with-keywords' but for Image Dired.
   4037   │ Prompt for keywords and rename all marked files in the Image
   4038   │ Dired buffer to have Denote-style keywords, but none of the other
   4039   │ conventions of Denote's file-naming scheme."
   4040   │   (interactive (list (denote-keywords-prompt)) image-dired-thumbnail-mode)
   4041   │   (image-dired--with-marked
   4042   │    (when-let* ((file (image-dired-original-file-name))
   4043   │ 	       (dir (file-name-directory file))
   4044   │ 	       (file-type (denote-filetype-heuristics file))
   4045   │ 	       (title (denote--retrieve-title-or-filename file file-type))
   4046   │ 	       (extension (file-name-extension file t))
   4047   │ 	       (kws (denote--keywords-combine keywords))
   4048   │ 	       (new-name (concat dir title "__" kws extension))
   4049   │ 	       (default-directory dir))
   4050   │      (denote-rename-file-and-buffer file new-name))))
   4051   └────
   4052 
   4053 
   4054 [Rename files with Denote using `dired-preview'] See section 15.14
   4055 
   4056 [Rename multiple files at once] See section 4.3
   4057 
   4058 
   4059 15.14 Rename files with Denote using `dired-preview'
   4060 ────────────────────────────────────────────────────
   4061 
   4062   The `dired-preview' package (by me/Protesilaos) automatically displays
   4063   a preview of the file at point in Dired.  This can be helpful in
   4064   tandem with Denote when we want to rename multiple files by taking a
   4065   quick look at their contents.
   4066 
   4067   The command `denote-dired-rename-marked-files-with-keywords' will
   4068   generate Denote-style file names based on the keywords it prompts
   4069   for. Identifiers are derived from each file’s modification date
   4070   ([Rename multiple files at once]). There is no need for any custom
   4071   code in this scenario.
   4072 
   4073   As noted in the section about Image Dired, the user may sometimes not
   4074   need a fully fledged Denote-style file name but only append
   4075   Denote-like keywords to each file name (e.g. `Original
   4076   Name__denote_test.jpg' instead of
   4077   `20230710T195843--original-name__denote_test.jpg').
   4078 
   4079   [Rename files with Denote in the Image Dired thumbnails buffer]
   4080 
   4081   In such a workflow, it is unlikely to be dealing with ordinary text
   4082   files where front matter can be helpful.  A custom command does not
   4083   need to behave like what Denote provides out-of-the-box, but can
   4084   instead append keywords to file names without conducting any further
   4085   actions.  We thus have:
   4086 
   4087   ┌────
   4088   │ (defun my-denote-dired-rename-marked-files-keywords-only ()
   4089   │   "Like `denote-dired-rename-marked-files-with-keywords' but only for keywords in file names.
   4090   4091   │ Prompt for keywords and rename all marked files in the Dired
   4092   │ buffer to only have Denote-style keywords, but none of the other
   4093   │ conventions of Denote's file-naming scheme."
   4094   │   (interactive nil dired-mode)
   4095   │   (if-let ((marks (dired-get-marked-files)))
   4096   │       (let ((keywords (denote-keywords-prompt)))
   4097   │ 	(dolist (file marks)
   4098   │ 	  (let* ((dir (file-name-directory file))
   4099   │ 		 (file-type (denote-filetype-heuristics file))
   4100   │ 		 (title (denote--retrieve-title-or-filename file file-type))
   4101   │ 		 (extension (file-name-extension file t))
   4102   │ 		 (kws (denote--keywords-combine keywords))
   4103   │ 		 (new-name (concat dir title "__" kws extension)))
   4104   │ 	    (denote-rename-file-and-buffer file new-name)))
   4105   │ 	(revert-buffer))
   4106   │     (user-error "No marked files; aborting")))
   4107   └────
   4108 
   4109 
   4110 [Rename multiple files at once] See section 4.3
   4111 
   4112 [Rename files with Denote in the Image Dired thumbnails buffer] See
   4113 section 15.13
   4114 
   4115 
   4116 15.15 Avoid duplicate identifiers when exporting Denote notes
   4117 ─────────────────────────────────────────────────────────────
   4118 
   4119   When exporting Denote notes to, for example, an HTML or PDF file,
   4120   there is a high probability that the same file name is used with a new
   4121   extension.  This is problematic because it creates files with
   4122   duplicate identifiers.  The `20230515T085612--example__keyword.org'
   4123   produces a `20230515T085612--example__keyword.pdf'.  Any link to the
   4124   `20230515T085612' will thus break: it does not honor Denote’s
   4125   expectation of finding unique identifiers.  This is not the fault of
   4126   Denote: exporting is done by the user without Denote’s involvement.
   4127 
   4128   Org Mode and Markdown use different approaches to exporting files.  No
   4129   recommended method is available for plain text files as there is no
   4130   standardised export functionality for this format (the user can always
   4131   create a new note using the file type they want on a case-by-case
   4132   basis: [Convenience commands for note creation]).
   4133 
   4134 
   4135 [Convenience commands for note creation] See section 3.1.4
   4136 
   4137 15.15.1 Export Denote notes with Org Mode
   4138 ╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌
   4139 
   4140   Org Mode has a built-in configurable export engine.  You can prevent
   4141   duplicate identifiers when exporting manually for each exported file
   4142   or by advising the Org export function.
   4143 
   4144   Denote also provides commands to convert `denote:' links to their
   4145   `file:' equivalent, in case this is a required pre-processing step for
   4146   export purposes ([Convert `denote:' links to `file:' links]).
   4147 
   4148 
   4149 [Convert `denote:' links to `file:' links] See section 7.11
   4150 
   4151 ◊ 15.15.1.1 Manually configure Org export
   4152 
   4153   Insert `#+export_file_name: FILENAME' in the front matter before
   4154   exporting to force a filename called whatever the value of `FILENAME'
   4155   is.  The `FILENAME' does not specify the file type extension, such as
   4156   `.pdf'.  This is up to the export engine.  For example, a Denote note
   4157   with a complete file name of `20230515T085612--example__keyword.org'
   4158   and a front matter entry of `#+export_file_name: hello' will be
   4159   exported as `hello.pdf'.
   4160 
   4161   The advantage of this manual method is that it gives the user full
   4162   control over the resulting file name.  The disadvantage is that it
   4163   depends on the user’s behaviour.  Forgetting to add a new name can
   4164   lead to duplicate identifiers, as already noted in the introduction to
   4165   this section ([Export Denote notes]).
   4166 
   4167 
   4168   [Export Denote notes] See section 15.15
   4169 
   4170 
   4171 ◊ 15.15.1.2 Automatically store Org exports in another folder
   4172 
   4173   It is possible to automatically place all exports in another folder by
   4174   making Org’s function `org-export-output-file-name' create the target
   4175   directory if needed and move the exported file there.  Remember that
   4176   advising Elisp code must be handled with care, as it might break the
   4177   original function in subtle ways.
   4178 
   4179   ┌────
   4180   │ (defvar my-org-export-output-directory-prefix "./export_"
   4181   │   "Prefix of directory used for org-mode export.
   4182   4183   │ The single dot means that the directory is created on the same
   4184   │ level as the one where the Org file that performs the exporting
   4185   │ is.  Use two dots to place the directory on a level above the
   4186   │ current one.
   4187   4188   │ If this directory is part of `denote-directory', make sure it is
   4189   │ not read by Denote.  See `denote-excluded-directories-regexp'.
   4190   │ This way there will be no known duplicate Denote identifiers
   4191   │ produced by the Org export mechanism.")
   4192   4193   │ (defun my-org-export-create-directory (fn extension &rest args)
   4194   │   "Move Org export file to its appropriate directory.
   4195   4196   │ Append the file type EXTENSION of the exported file to
   4197   │ `my-org-export-output-directory-prefix' and, if absent, create a
   4198   │ directory named accordingly.
   4199   4200   │ Install this as advice around `org-export-output-file-name'.  The
   4201   │ EXTENSION is supplied by that function.  ARGS are its remaining
   4202   │ arguments."
   4203   │   (let ((export-dir (format "%s%s" my-org-export-output-directory-prefix extension)))
   4204   │     (unless (file-directory-p export-dir)
   4205   │       (make-directory export-dir)))
   4206   │   (apply fn extension args))
   4207   4208   │ (advice-add #'org-export-output-file-name :around #'my-org-export-create-directory)
   4209   └────
   4210 
   4211   The target export directory should not be a subdirectory of
   4212   `denote-directory', as that will result in duplicate identifiers.
   4213   Exclude it with the `denote-excluded-directories-regexp' user option
   4214   ([Exclude certain directories from all operations]).
   4215 
   4216   [ NOTE: I (Protesilaos) am not a LaTeX user and cannot test the
   4217     following. ]
   4218 
   4219   Using a different directory will require some additional configuration
   4220   when exporting using LaTeX.  The export folder cannot be inside the
   4221   path of the `denote-directory' to prevent Denote from recognising it
   4222   as an attachment:
   4223   <https://emacs.stackexchange.com/questions/45751/org-export-to-different-directory>.
   4224 
   4225 
   4226   [Exclude certain directories from all operations] See section 3.8
   4227 
   4228 
   4229 ◊ 15.15.1.3 Org Mode Publishing
   4230 
   4231   Org Mode also has a publishing tool for exporting a collection of
   4232   files. Some user might apply this approach to convert their note
   4233   collection to a public or private website.
   4234 
   4235   The `org-publish-project-alist' variable drives the publishing
   4236   process, including the publishing directory.
   4237 
   4238   The publishing directory should not be a subdirectory of
   4239   `denote-directory', as that will result in duplicate identifiers.
   4240   Exclude it with the `denote-excluded-directories-regexp' user option
   4241   ([Exclude certain directories from all operations]).
   4242 
   4243 
   4244   [Exclude certain directories from all operations] See section 3.8
   4245 
   4246 
   4247 15.15.2 Export Denote notes with Markdown
   4248 ╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌
   4249 
   4250   Exporting from Markdown requires an external processor (e.g.,
   4251   Markdown.pl, Pandoc, or MultiMarkdown).  The `markdown-command'
   4252   variable defines the command line used in export, for example:
   4253 
   4254   ┌────
   4255   │ (setq markdown-command "multimarkdown")
   4256   └────
   4257 
   4258   The export process thus occurs outside of Emacs.  Users need to read
   4259   the documentation of their preferred processor to prevent the creation
   4260   of duplicate Denote identifiers.
   4261 
   4262 
   4263 16 Installation
   4264 ═══════════════
   4265 
   4266 
   4267 
   4268 
   4269 16.1 GNU ELPA package
   4270 ─────────────────────
   4271 
   4272   The package is available as `denote'.  Simply do:
   4273 
   4274   ┌────
   4275   │ M-x package-refresh-contents
   4276   │ M-x package-install
   4277   └────
   4278 
   4279 
   4280   And search for it.
   4281 
   4282   GNU ELPA provides the latest stable release.  Those who prefer to
   4283   follow the development process in order to report bugs or suggest
   4284   changes, can use the version of the package from the GNU-devel ELPA
   4285   archive.  Read:
   4286   <https://protesilaos.com/codelog/2022-05-13-emacs-elpa-devel/>.
   4287 
   4288 
   4289 16.2 Manual installation
   4290 ────────────────────────
   4291 
   4292   Assuming your Emacs files are found in `~/.emacs.d/', execute the
   4293   following commands in a shell prompt:
   4294 
   4295   ┌────
   4296   │ cd ~/.emacs.d
   4297   4298   │ # Create a directory for manually-installed packages
   4299   │ mkdir manual-packages
   4300   4301   │ # Go to the new directory
   4302   │ cd manual-packages
   4303   4304   │ # Clone this repo, naming it "denote"
   4305   │ git clone https://git.sr.ht/~protesilaos/denote denote
   4306   └────
   4307 
   4308   Finally, in your `init.el' (or equivalent) evaluate this:
   4309 
   4310   ┌────
   4311   │ ;; Make Elisp files in that directory available to the user.
   4312   │ (add-to-list 'load-path "~/.emacs.d/manual-packages/denote")
   4313   └────
   4314 
   4315   Everything is in place to set up the package.
   4316 
   4317 
   4318 17 Sample configuration
   4319 ═══════════════════════
   4320 
   4321   ┌────
   4322   │ (require 'denote)
   4323   4324   │ ;; Remember to check the doc strings of those variables.
   4325   │ (setq denote-directory (expand-file-name "~/Documents/notes/"))
   4326   │ (setq denote-save-buffer-after-creation nil)
   4327   │ (setq denote-known-keywords '("emacs" "philosophy" "politics" "economics"))
   4328   │ (setq denote-infer-keywords t)
   4329   │ (setq denote-sort-keywords t)
   4330   │ (setq denote-file-type nil) ; Org is the default, set others here
   4331   │ (setq denote-prompts '(title keywords))
   4332   │ (setq denote-excluded-directories-regexp nil)
   4333   │ (setq denote-excluded-keywords-regexp nil)
   4334   │ (setq denote-rename-no-confirm nil) ; Set to t if you are familiar with `denote-rename-file'
   4335   4336   │ ;; Pick dates, where relevant, with Org's advanced interface:
   4337   │ (setq denote-date-prompt-use-org-read-date t)
   4338   4339   4340   │ ;; Read this manual for how to specify `denote-templates'.  We do not
   4341   │ ;; include an example here to avoid potential confusion.
   4342   4343   4344   │ (setq denote-date-format nil) ; read doc string
   4345   4346   │ ;; By default, we do not show the context of links.  We just display
   4347   │ ;; file names.  This provides a more informative view.
   4348   │ (setq denote-backlinks-show-context t)
   4349   4350   │ ;; Also see `denote-link-backlinks-display-buffer-action' which is a bit
   4351   │ ;; advanced.
   4352   4353   │ ;; If you use Markdown or plain text files (Org renders links as buttons
   4354   │ ;; right away)
   4355   │ (add-hook 'find-file-hook #'denote-link-buttonize-buffer)
   4356   4357   │ ;; We use different ways to specify a path for demo purposes.
   4358   │ (setq denote-dired-directories
   4359   │       (list denote-directory
   4360   │ 	    (thread-last denote-directory (expand-file-name "attachments"))
   4361   │ 	    (expand-file-name "~/Documents/books")))
   4362   4363   │ ;; Generic (great if you rename files Denote-style in lots of places):
   4364   │ ;; (add-hook 'dired-mode-hook #'denote-dired-mode)
   4365   │ ;;
   4366   │ ;; OR if only want it in `denote-dired-directories':
   4367   │ (add-hook 'dired-mode-hook #'denote-dired-mode-in-directories)
   4368   4369   4370   │ ;; Automatically rename Denote buffers using the `denote-rename-buffer-format'.
   4371   │ (denote-rename-buffer-mode 1)
   4372   4373   │ ;; Denote DOES NOT define any key bindings.  This is for the user to
   4374   │ ;; decide.  For example:
   4375   │ (let ((map global-map))
   4376   │   (define-key map (kbd "C-c n n") #'denote)
   4377   │   (define-key map (kbd "C-c n c") #'denote-region) ; "contents" mnemonic
   4378   │   (define-key map (kbd "C-c n N") #'denote-type)
   4379   │   (define-key map (kbd "C-c n d") #'denote-date)
   4380   │   (define-key map (kbd "C-c n z") #'denote-signature) ; "zettelkasten" mnemonic
   4381   │   (define-key map (kbd "C-c n s") #'denote-subdirectory)
   4382   │   (define-key map (kbd "C-c n t") #'denote-template)
   4383   │   ;; If you intend to use Denote with a variety of file types, it is
   4384   │   ;; easier to bind the link-related commands to the `global-map', as
   4385   │   ;; shown here.  Otherwise follow the same pattern for `org-mode-map',
   4386   │   ;; `markdown-mode-map', and/or `text-mode-map'.
   4387   │   (define-key map (kbd "C-c n i") #'denote-link) ; "insert" mnemonic
   4388   │   (define-key map (kbd "C-c n I") #'denote-add-links)
   4389   │   (define-key map (kbd "C-c n b") #'denote-backlinks)
   4390   │   (define-key map (kbd "C-c n f f") #'denote-find-link)
   4391   │   (define-key map (kbd "C-c n f b") #'denote-find-backlink)
   4392   │   ;; Note that `denote-rename-file' can work from any context, not just
   4393   │   ;; Dired bufffers.  That is why we bind it here to the `global-map'.
   4394   │   (define-key map (kbd "C-c n r") #'denote-rename-file)
   4395   │   (define-key map (kbd "C-c n R") #'denote-rename-file-using-front-matter))
   4396   4397   │ ;; Key bindings specifically for Dired.
   4398   │ (let ((map dired-mode-map))
   4399   │   (define-key map (kbd "C-c C-d C-i") #'denote-link-dired-marked-notes)
   4400   │   (define-key map (kbd "C-c C-d C-r") #'denote-dired-rename-files)
   4401   │   (define-key map (kbd "C-c C-d C-k") #'denote-dired-rename-marked-files-with-keywords)
   4402   │   (define-key map (kbd "C-c C-d C-R") #'denote-dired-rename-marked-files-using-front-matter))
   4403   4404   │ (with-eval-after-load 'org-capture
   4405   │   (setq denote-org-capture-specifiers "%l\n%i\n%?")
   4406   │   (add-to-list 'org-capture-templates
   4407   │ 	       '("n" "New note (with denote.el)" plain
   4408   │ 		 (file denote-last-path)
   4409   │ 		 #'denote-org-capture
   4410   │ 		 :no-save t
   4411   │ 		 :immediate-finish nil
   4412   │ 		 :kill-buffer t
   4413   │ 		 :jump-to-captured t)))
   4414   4415   │ ;; Also check the commands `denote-link-after-creating',
   4416   │ ;; `denote-link-or-create'.  You may want to bind them to keys as well.
   4417   4418   4419   │ ;; If you want to have Denote commands available via a right click
   4420   │ ;; context menu, use the following and then enable
   4421   │ ;; `context-menu-mode'.
   4422   │ (add-hook 'context-menu-functions #'denote-context-menu)
   4423   └────
   4424 
   4425 
   4426 18 For developers or advanced users
   4427 ═══════════════════════════════════
   4428 
   4429   Denote is in a stable state and can be relied upon as the basis for
   4430   custom extensions.  Further below is a list with the functions or
   4431   variables we provide for public usage.  Those are in addition to all
   4432   user options and commands that are already documented in the various
   4433   sections of this manual.
   4434 
   4435   In this context “public” is any form with single hyphens in its
   4436   symbol, such as `denote-directory-files'.  We expressly support those,
   4437   meaning that we consider them reliable and commit to documenting any
   4438   changes in their particularities (such as through `make-obsolete', a
   4439   record in the change log, a blog post on the maintainer’s website, and
   4440   the like).
   4441 
   4442   By contradistinction, a “private” form is declared with two hyphens in
   4443   its symbol such as `denote--file-extension'.  Do not use those as we
   4444   might change them without further notice.
   4445 
   4446   Variable `denote-id-format'
   4447         Format of ID prefix of a note’s filename.  The note’s ID is
   4448         derived from the date and time of its creation ([The file-naming
   4449         scheme]).
   4450 
   4451   Variable `denote-id-regexp'
   4452         Regular expression to match `denote-id-format'.
   4453 
   4454   Variable `denote-signature-regexp'
   4455         Regular expression to match the `SIGNATURE' field in a file
   4456         name.
   4457 
   4458   Variable `denote-title-regexp'
   4459         Regular expression to match the `TITLE' field in a file name
   4460         ([The file-naming scheme]).
   4461 
   4462   Variable `denote-keywords-regexp'
   4463         Regular expression to match the `KEYWORDS' field in a file name
   4464         ([The file-naming scheme]).
   4465 
   4466   Variable `denote-excluded-punctuation-regexp'
   4467         Punctionation that is removed from file names.  We consider
   4468         those characters illegal for our purposes.
   4469 
   4470   Variable `denote-excluded-punctuation-extra-regexp'
   4471         Additional punctuation that is removed from file names.  This
   4472         variable is for advanced users who need to extend the
   4473         `denote-excluded-punctuation-regexp'.  Once we have a better
   4474         understanding of what we should be omitting, we will update
   4475         things accordingly.
   4476 
   4477   Function `denote-file-is-note-p'
   4478         Return non-nil if `FILE' is an actual Denote note.  For our
   4479         purposes, a note must not be a directory, must satisfy
   4480         `file-regular-p', its path must be part of the variable
   4481         `denote-directory', it must have a Denote identifier in its
   4482         name, and use one of the extensions implied by
   4483         `denote-file-type'.
   4484 
   4485   Function `denote-file-has-identifier-p'
   4486         Return non-nil if `FILE' has a Denote identifier.
   4487 
   4488   Function `denote-file-has-signature-p'
   4489         Return non-nil if `FILE' has a signature.
   4490 
   4491   Function `denote-file-has-supported-extension-p'
   4492         Return non-nil if `FILE' has supported extension.  Also account
   4493         for the possibility of an added `.gpg' suffix. Supported
   4494         extensions are those implied by `denote-file-type'.
   4495 
   4496   Function `denote-file-is-writable-and-supported-p'
   4497         Return non-nil if `FILE' is writable and has supported
   4498         extension.
   4499 
   4500   Function `denote-file-type-extensions'
   4501         Return all file type extensions in `denote-file-types'.
   4502 
   4503   Variable `denote-encryption-file-extensions'
   4504         List of strings specifying file extensions for encryption.
   4505 
   4506   Function `denote-file-type-extensions-with-encryption'
   4507         Derive `denote-file-type-extensions' plus
   4508         `denote-encryption-file-extensions'.
   4509 
   4510   Function `denote-get-file-extension'
   4511         Return extension of `FILE' with dot included.  Account for
   4512         `denote-encryption-file-extensions'.  In other words, return
   4513         something like `.org.gpg' if it is part of the file, else return
   4514         `.org'.
   4515 
   4516   Function `denote-get-file-extension-sans-encryption'
   4517         Return extension of `FILE' with dot included and without the
   4518         encryption part.  Build on top of `denote-get-file-extension'
   4519         though always return something like `.org' even if the actual
   4520         file extension is `.org.gpg'.
   4521 
   4522   Function `denote-keywords'
   4523         Return appropriate list of keyword candidates.  If
   4524         `denote-infer-keywords' is non-nil, infer keywords from existing
   4525         notes and combine them into a list with `denote-known-keywords'.
   4526         Else use only the latter set of keywords ([Standard note
   4527         creation]).
   4528 
   4529   Function `denote-convert-file-name-keywords-to-crm'
   4530         Make `STRING' with keywords readable by
   4531         `completing-read-multiple'. `STRING' consists of
   4532         underscore-separated words, as those appear in the keywords
   4533         component of a Denote file name. `STRING' is the same as the
   4534         return value of `denote-retrieve-filename-keywords'.
   4535 
   4536   Function `denote-keywords-sort'
   4537         Sort `KEYWORDS' if `denote-sort-keywords' is non-nil.
   4538         `KEYWORDS' is a list of strings, per `denote-keywords-prompt'.
   4539 
   4540   Function `denote-keywords-combine'
   4541         Combine `KEYWORDS' list of strings into a single
   4542         string. Keywords are separated by the underscore character, per
   4543         the Denote file-naming scheme.
   4544 
   4545   Function `denote-valid-date-p'
   4546         Return `DATE' as a valid date. A valid `DATE' is a value that
   4547         can be parsed by either `decode-time' or `date-to-time' .Those
   4548         functions signal an error if `DATE' is a value they do not
   4549         recognise. If `DATE' is nil, return nil.
   4550 
   4551   Function `denote-parse-date'
   4552         Return `DATE' as an appropriate value for the `denote'
   4553         command. Pass `DATE' through `denote-valid-date-p' and use its
   4554         return value. If either that or `DATE' is nil, return
   4555         `current-time'.
   4556 
   4557   Function `denote-directory'
   4558         Return path of the variable `denote-directory' as a proper
   4559         directory, also because it accepts a directory-local value for
   4560         what we internally refer to as “silos” ([Maintain separate
   4561         directories for notes]).  Custom Lisp code can `let' bind the
   4562         value of the variable `denote-directory' to override what this
   4563         function returns.
   4564 
   4565   Function `denote-directory-files'
   4566         Return list of absolute file paths in variable
   4567         `denote-directory'. Files only need to have an identifier. The
   4568         return value may thus include file types that are not implied by
   4569         `denote-file-type'. Remember that the variable
   4570         `denote-directory' accepts a dir-local value, as explained in
   4571         its doc string ([Maintain separate directories for notes]). With
   4572         optional `FILES-MATCHING-REGEXP', restrict files to those
   4573         matching the given regular expression. With optional
   4574         `OMIT-CURRENT' as a non-nil value, do not include the current
   4575         Denote file in the returned list. With optional `TEXT-ONLY' as a
   4576         non-nil value, limit the results to text files that satisfy
   4577         `denote-file-is-note-p'.
   4578 
   4579   Function `denote-directory-subdirectories'
   4580         Return list of subdirectories in variable
   4581         `denote-directory'. Omit dotfiles (such as .git)
   4582         unconditionally.  Also exclude whatever matches
   4583         `denote-excluded-directories-regexp'.  Note that the
   4584         `denote-directory' accepts a directory-local value for what we
   4585         call “silos” ([Maintain separate directories for notes]).
   4586 
   4587   Function `denote-file-name-relative-to-denote-directory'
   4588         Return name of `FILE' relative to the variable
   4589         `denote-directory'.  `FILE' must be an absolute path.
   4590 
   4591   Function `denote-get-path-by-id'
   4592         Return absolute path of `ID' string in `denote-directory-files'.
   4593 
   4594   Function `denote-barf-duplicate-id'
   4595         Throw a `user-error' if `IDENTIFIER' already exists.
   4596 
   4597   Function `denote-sluggify'
   4598         Make `STR' an appropriate slug for file names and related
   4599         ([Sluggification of file name components]).
   4600 
   4601   Function `denote-sluggify-keyword'
   4602         Sluggify `STR' while joining separate words.
   4603 
   4604   Function `denote-sluggify-signature'
   4605         Make `STR' an appropriate slug for signatures ([Sluggification
   4606         of file name components]).
   4607 
   4608   Function `denote-sluggify-keywords'
   4609         Sluggify `KEYWORDS', which is a list of strings ([Sluggification
   4610         of file name components]).
   4611 
   4612   Function `denote-filetype-heuristics'
   4613         Return likely file type of `FILE'. If in the process of
   4614         `org-capture', consider the file type to be that of
   4615         Org. Otherwise, use the file extension to detect the file type
   4616         of `FILE'.
   4617 
   4618         If more than one file type correspond to this file extension,
   4619         use the first file type for which the :title-key-regexp in
   4620         `denote-file-types' matches in the file.
   4621 
   4622         If no file type in `denote-file-types' has the file extension,
   4623         the file type is assumed to be the first one in
   4624         `denote-file-types'.
   4625 
   4626   Function `denote-format-file-name'
   4627         Format file name. `DIR-PATH', `ID', `KEYWORDS', `TITLE',
   4628         `EXTENSION' and `SIGNATURE' are expected to be supplied by
   4629         `denote' or equivalent command.
   4630 
   4631         `DIR-PATH' is a string pointing to a directory. It ends with a
   4632         forward slash (the function `denote-directory' makes sure this
   4633         is the case when returning the value of the variable
   4634         `denote-directory').  `DIR-PATH' cannot be nil or an empty
   4635         string.
   4636 
   4637         `ID' is a string holding the identifier of the note. It cannot
   4638         be nil or an empty string and must match `denote-id-regexp'.
   4639 
   4640         `DIR-PATH' and `ID' form the base file name.
   4641 
   4642         `KEYWORDS' is a list of strings that is reduced to a single
   4643         string by `denote-keywords-combine'. `KEYWORDS' can be an empty
   4644         list or a nil value, in which case the relevant file name
   4645         component is not added to the base file name.
   4646 
   4647         `TITLE' and `SIGNATURE' are strings. They can be an empty
   4648         string, in which case their respective file name component is
   4649         not added to the base file name.
   4650 
   4651         `EXTENSION' is a string that contains a dot followed by the file
   4652         type extension. It can be an empty string or a nil value, in
   4653         which case it is not added to the base file name.
   4654 
   4655   Function `denote-extract-keywords-from-path'
   4656         Extract keywords from `PATH' and return them as a list of
   4657         strings.  `PATH' must be a Denote-style file name where keywords
   4658         are prefixed with an underscore.  If `PATH' has no such
   4659         keywords, which is possible, return nil ([The file-naming
   4660         scheme]).
   4661 
   4662   Function `denote-extract-id-from-string'
   4663         Return existing Denote identifier in `STRING', else nil.
   4664 
   4665   Function `denote-retrieve-filename-identifier'
   4666         Extract identifier from `FILE' name, if present, else return
   4667         nil.  To create a new one, refer to the
   4668         `denote-create-unique-file-identifier' function.
   4669 
   4670   Function `denote-retrieve-filename-title'
   4671         Extract Denote title component from `FILE' name, if present,
   4672         else return nil.
   4673 
   4674   Function `denote-retrieve-filename-keywords'
   4675         Extract keywords from `FILE' name, if present, else return
   4676         nil. Return matched keywords as a single string.
   4677 
   4678   Function `denote-retrieve-filename-signature'
   4679         Extract signature from `FILE' name, if present, else return nil.
   4680 
   4681   Function `denote-retrieve-title-or-filename'
   4682         Return appropriate title for `FILE' given its `TYPE'. Try to
   4683         find the value of the title in the front matter of FILE,
   4684         otherwise use its file name. This is a wrapper for
   4685         `denote-retrieve-front-matter-title-value' and
   4686         `denote-retrieve-filename-title'.
   4687 
   4688   Function `denote-get-identifier'
   4689         Convert `DATE' into a Denote identifier using
   4690         `denote-id-format'. `DATE' is parsed by
   4691         `denote-valid-date-p'. If `DATE' is nil, use the current time.
   4692 
   4693   Function `denote-create-unique-file-identifier'
   4694         Create a new unique `FILE' identifier.  Test that the identifier
   4695         is unique among `USED-IDS'.  The conditions are as follows:
   4696 
   4697         • If `DATE' is non-nil, invoke
   4698           `denote-prompt-for-date-return-id'.
   4699 
   4700         • If `DATE' is nil, use the file attributes to determine the
   4701           last modified date and format it as an identifier.
   4702 
   4703         • As a fallback, derive an identifier from the current time.
   4704 
   4705         With optional `USED-IDS' as nil, test that the identifier is
   4706         unique among all files and buffers in variable
   4707         `denote-directory'.
   4708 
   4709         To only return an existing identifier, refer to the function
   4710         `denote-retrieve-filename-identifier'.
   4711 
   4712   Function `denote-retrieve-front-matter-title-value'
   4713         Return title value from `FILE' front matter per `FILE-TYPE'.
   4714 
   4715   Function `denote-retrieve-front-matter-title-line'
   4716         Return title line from `FILE' front matter per `FILE-TYPE'.
   4717 
   4718   Function `denote-retrieve-front-matter-keywords-value'
   4719         Return keywords value from `FILE' front matter per
   4720         `FILE-TYPE'. The return value is a list of strings. To get a
   4721         combined string the way it would appear in a Denote file name,
   4722         use `denote-retrieve-front-matter-keywords-value-as-string'.
   4723 
   4724   Function `denote-retrieve-front-matter-keywords-value-as-string'
   4725         Return keywords value from `FILE' front matter per
   4726         `FILE-TYPE'. The return value is a string, with the underscrore
   4727         as a separator between individual keywords. To get a list of
   4728         strings instead, use
   4729         `denote-retrieve-front-matter-keywords-value' (the current
   4730         function uses that internally).
   4731 
   4732   Function `denote-retrieve-front-matter-keywords-line'
   4733         Return keywords line from `FILE' front matter per `FILE-TYPE'.
   4734 
   4735   Function `denote-signature-prompt'
   4736         Prompt for signature string.  With optional `INITIAL-SIGNATURE'
   4737         use it as the initial minibuffer text. With optional
   4738         `PROMPT-TEXT' use it in the minibuffer instead of the default
   4739         prompt. Previous inputs at this prompt are available for
   4740         minibuffer completion if the user option
   4741         `denote-history-completion-in-prompts' is set to a non-nil value
   4742         ([The `denote-history-completion-in-prompts' option]).
   4743 
   4744   Function `denote-file-prompt'
   4745         Prompt for file with identifier in variable
   4746         `denote-directory'. With optional `FILES-MATCHING-REGEXP',
   4747         filter the candidates per the given regular expression. With
   4748         optional `PROMPT-TEXT', use it instead of the default “Select
   4749         NOTE”.
   4750 
   4751   Function `denote-keywords-prompt'
   4752         Prompt for one or more keywords.  Read entries as separate when
   4753         they are demarcated by the `crm-separator', which typically is a
   4754         comma. With optional `PROMPT-TEXT', use it to prompt the user
   4755         for keywords. Else use a generic prompt. With optional
   4756         `INITIAL-KEYWORDS' use them as the initial minibuffer text.
   4757 
   4758   Function `denote-title-prompt'
   4759         Prompt for title string. With optional `INITIAL-TITLE' use it as
   4760         the initial minibuffer text. With optional `PROMPT-TEXT' use it
   4761         in the minibuffer instead of the default prompt. Previous inputs
   4762         at this prompt are available for minibuffer completion if the
   4763         user option `denote-history-completion-in-prompts' is set to a
   4764         non-nil value ([The `denote-history-completion-in-prompts'
   4765         option]).
   4766 
   4767   Variable `denote-title-prompt-current-default'
   4768         Currently bound default title for `denote-title-prompt'.  Set
   4769         the value of this variable within the lexical scope of a command
   4770         that needs to supply a default title before calling
   4771         `denote-title-prompt' and use `unwind-protect' to set its value
   4772         back to nil.
   4773 
   4774   Function `denote-file-type-prompt'
   4775         Prompt for `denote-file-type'.  Note that a non-nil value other
   4776         than `text', `markdown-yaml', and `markdown-toml' falls back to
   4777         an Org file type.  We use `org' here for clarity.
   4778 
   4779   Function `denote-date-prompt'
   4780         Prompt for date, expecting `YYYY-MM-DD' or that plus `HH:MM' (or
   4781         even `HH:MM:SS').  Use Org’s more advanced date selection
   4782         utility if the user option
   4783         `denote-date-prompt-use-org-read-date' is non-nil.  It requires
   4784         Org ([The denote-date-prompt-use-org-read-date option]).
   4785 
   4786   Function `denote-command-prompt'
   4787         Prompt for command among `denote-commands-for-new-notes'
   4788         ([Points of entry]).
   4789 
   4790   Variable `denote-prompts-with-history-as-completion'
   4791         Prompts that conditionally perform completion against their
   4792         history. These are minibuffer prompts that ordinarily accept a
   4793         free form string input, as opposed to matching against a
   4794         predefined set. These prompts can optionally perform completion
   4795         against their own minibuffer history when the user option
   4796         `denote-history-completion-in-prompts' is set to a non-nil value
   4797         ([The `denote-history-completion-in-prompts' option]).
   4798 
   4799   Function `denote-files-matching-regexp-prompt'
   4800         Prompt for `REGEXP' to filter Denote files by. With optional
   4801         `PROMPT-TEXT' use it instead of a generic prompt.
   4802 
   4803   Function `denote-prompt-for-date-return-id'
   4804         Use `denote-date-prompt' and return it as `denote-id-format'.
   4805 
   4806   Function `denote-template-prompt'
   4807         Prompt for template key in `denote-templates' and return its
   4808         value.
   4809 
   4810   Function `denote-subdirectory-prompt'
   4811         Prompt for subdirectory of the variable `denote-directory'.  The
   4812         table uses the `file' completion category (so it works with
   4813         packages such as `marginalia' and `embark').
   4814 
   4815   Function `denote-rename-file-prompt'
   4816         Prompt to rename file named `OLD-NAME' to `NEW-NAME'.
   4817 
   4818   Function `denote-rename-file-and-buffer'
   4819         Rename file named `OLD-NAME' to `NEW-NAME', updating buffer
   4820         name.
   4821 
   4822   Function `denote-rewrite-front-matter'
   4823         Rewrite front matter of note after `denote-rename-file' (or
   4824         related) The `FILE', `TITLE', `KEYWORDS', and `FILE-TYPE'
   4825         arguments are given by the renaming command and are used to
   4826         construct new front matter values if appropriate. With optional
   4827         `NO-CONFIRM', do not prompt to confirm the rewriting of the
   4828         front matter. Otherwise produce a `y-or-n-p' prompt to that
   4829         effect. With optional `NO-CONFIRM', save the buffer after
   4830         performing the rewrite. Otherwise leave it unsaved for furthter
   4831         review by the user.
   4832 
   4833   Function `denote-rewrite-keywords'
   4834         Rewrite `KEYWORDS' in `FILE' outright according to
   4835         `FILE-TYPE'. Do the same as `denote-rewrite-front-matter' for
   4836         keywords, but do not ask for confirmation. With optional
   4837         `SAVE-BUFFER', save the buffer corresponding to `FILE'. This
   4838         function is for use in the commands `denote-keywords-add',
   4839         `denote-keywords-remove', `denote-dired-rename-files', or
   4840         related.
   4841 
   4842   Function `denote-update-dired-buffers'
   4843         Update Dired buffers of variable `denote-directory'. Also revert
   4844         the current Dired buffer even if it is not inside the
   4845         `denote-directory'. Note that the `denote-directory' accepts a
   4846         directory-local value for what we internally refer to as “silos”
   4847         ([Maintain separate directories for notes]).
   4848 
   4849   Variable `denote-file-types'
   4850         Alist of `denote-file-type' and their format properties.
   4851 
   4852         Each element is of the form `(SYMBOL PROPERTY-LIST)'.  `SYMBOL'
   4853         is one of those specified in `denote-file-type' or an arbitrary
   4854         symbol that defines a new file type.
   4855 
   4856         `PROPERTY-LIST' is a plist that consists of the following
   4857         elements:
   4858 
   4859         1. `:extension' is a string with the file extension including
   4860            the period.
   4861 
   4862         2. `:date-function' is a function that can format a date.  See
   4863            the functions `denote--date-iso-8601',
   4864            `denote--date-rfc3339', and `denote--date-org-timestamp'.
   4865 
   4866         3. `:front-matter' is either a string passed to `format' or a
   4867            variable holding such a string.  The `format' function
   4868            accepts four arguments, which come from `denote' in this
   4869            order: `TITLE', `DATE', `KEYWORDS', `IDENTIFIER'.  Read the
   4870            doc string of `format' on how to reorder arguments.
   4871 
   4872         4. `:title-key-regexp' is a regular expression that is used to
   4873            retrieve the title line in a file.  The first line matching
   4874            this regexp is considered the title line.
   4875 
   4876         5. `:title-value-function' is the function used to format the
   4877            raw title string for inclusion in the front matter (e.g. to
   4878            surround it with quotes).  Use the `identity' function if no
   4879            further processing is required.
   4880 
   4881         6. `:title-value-reverse-function' is the function used to
   4882            retrieve the raw title string from the front matter.  It
   4883            performs the reverse of `:title-value-function'.
   4884 
   4885         7. `:keywords-key-regexp' is a regular expression used to
   4886            retrieve the keywords’ line in the file.  The first line
   4887            matching this regexp is considered the keywords’ line.
   4888 
   4889         8. `:keywords-value-function' is the function used to format the
   4890            keywords’ list of strings as a single string, with
   4891            appropriate delimiters, for inclusion in the front matter.
   4892 
   4893         9. `:keywords-value-reverse-function' is the function used to
   4894            retrieve the keywords’ value from the front matter.  It
   4895            performs the reverse of the `:keywords-value-function'.
   4896 
   4897         10. `:link' is a string, or variable holding a string, that
   4898             specifies the format of a link.  See the variables
   4899             `denote-org-link-format', `denote-md-link-format'.
   4900 
   4901         11. `:link-in-context-regexp' is a regular expression that is
   4902             used to match the aforementioned link format.  See the
   4903             variables `denote-org-link-in-context-regexp',
   4904             `denote-md-link-in-context-regexp'.
   4905 
   4906         If `denote-file-type' is nil, use the first element of this list
   4907         for new note creation.  The default is `org'.
   4908 
   4909   Variable `denote-org-front-matter'
   4910         Specifies the Org front matter.  It is passed to `format' with
   4911         arguments `TITLE', `DATE', `KEYWORDS', `ID' ([Change the front
   4912         matter format])
   4913 
   4914   Variable `denote-yaml-front-matter'
   4915         Specifies the YAML (Markdown) front matter.  It is passed to
   4916         `format' with arguments `TITLE', `DATE', `KEYWORDS', `ID'
   4917         ([Change the front matter format])
   4918 
   4919   Variable `denote-toml-front-matter'
   4920         Specifies the TOML (Markdown) front matter.  It is passed to
   4921         `format' with arguments `TITLE', `DATE', `KEYWORDS', `ID'
   4922         ([Change the front matter format])
   4923 
   4924   Variable `denote-text-front-matter'
   4925         Specifies the plain text front matter.  It is passed to `format'
   4926         with arguments `TITLE', `DATE', `KEYWORDS', `ID' ([Change the
   4927         front matter format])
   4928 
   4929   Variable `denote-org-link-format'
   4930         Format of Org link to note.  The value is passed to `format'
   4931         with `IDENTIFIER' and `TITLE' arguments, in this order.  Also
   4932         see `denote-org-link-in-context-regexp'.
   4933 
   4934   Variable `denote-md-link-format'
   4935         Format of Markdown link to note.  The `%N$s' notation used in
   4936         the default value is for `format' as the supplied arguments are
   4937         `IDENTIFIER' and `TITLE', in this order.  Also see
   4938         `denote-md-link-in-context-regexp'.
   4939 
   4940   Variable `denote-id-only-link-format'
   4941         Format of identifier-only link to note.  The value is passed to
   4942         `format' with `IDENTIFIER' as its sole argument.  Also see
   4943         `denote-id-only-link-in-context-regexp'.
   4944 
   4945   Variable `denote-org-link-in-context-regexp'
   4946         Regexp to match an Org link in its context.  The format of such
   4947         links is `denote-org-link-format'.
   4948 
   4949   Variable `denote-md-link-in-context-regexp'
   4950         Regexp to match an Markdown link in its context.  The format of
   4951         such links is `denote-md-link-format'.
   4952 
   4953   Variable `denote-id-only-link-in-context-regexp'
   4954         Regexp to match an identifier-only link in its context.  The
   4955         format of such links is `denote-id-only-link-format'.
   4956 
   4957   Function `denote-date-org-timestamp'
   4958         Format `DATE' using the Org inactive timestamp notation.
   4959 
   4960   Function `denote-date-rfc3339'
   4961         Format `DATE' using the RFC3339 specification.
   4962 
   4963   Function `denote-date-iso-8601'
   4964         Format `DATE' according to ISO 8601 standard.
   4965 
   4966   Function `denote-trim-whitespace'
   4967         Trim whitespace around string `S'.  This can be used in
   4968         `denote-file-types' to format front mattter.
   4969 
   4970   Function `denote-trim-whitespace-then-quotes'
   4971         Trim whitespace then quotes around string `S'.  This can be used
   4972         in `denote-file-types' to format front mattter.
   4973 
   4974   Function `denote-format-string-for-org-front-matter'
   4975         Return string `S' as-is for Org or plain text front matter. If
   4976         `S' is not a string, return an empty string.
   4977 
   4978   Function `denote-format-string-for-md-front-matter'
   4979         Surround string `S' with quotes. If `S' is not a string, return
   4980         a literal emptry string. This can be used in `denote-file-types'
   4981         to format front mattter.
   4982 
   4983   Function `denote-format-keywords-for-md-front-matter'
   4984         Format front matter `KEYWORDS' for markdown file type.
   4985         `KEYWORDS' is a list of strings.  Consult the
   4986         `denote-file-types' for how this is used.
   4987 
   4988   Function `denote-format-keywords-for-text-front-matter'
   4989         Format front matter `KEYWORDS' for text file type.  `KEYWORDS'
   4990         is a list of strings.  Consult the `denote-file-types' for how
   4991         this is used.
   4992 
   4993   Function `denote-format-keywords-for-org-front-matter'
   4994         Format front matter `KEYWORDS' for org file type.  `KEYWORDS' is
   4995         a list of strings.  Consult the `denote-file-types' for how this
   4996         is used.
   4997 
   4998   Function `denote-extract-keywords-from-front-matter'
   4999         Format front matter `KEYWORDS' for org file type.  `KEYWORDS' is
   5000         a list of strings.  Consult the `denote-file-types' for how this
   5001         is used.
   5002 
   5003   Function `denote-link-return-links'
   5004         Return list of links in current or optional `FILE'.  Also see
   5005         `denote-link-return-backlinks'.
   5006 
   5007   Function `denote-link-return-backlinks'
   5008         Return list of backlinks in current or optional `FILE'.  Also
   5009         see `denote-link-return-links'.
   5010 
   5011   Variable `denote-link-signature-format'
   5012         Format of link description for `denote-link-with-signature'.
   5013 
   5014   Function `denote-link-description-with-signature-and-title'
   5015         Return link description for `FILE'.  Produce a description as
   5016         follows:
   5017 
   5018 
   5019         If the region is active, use it as the description.
   5020 
   5021 
   5022         If `FILE' as a signature, then use the
   5023         `denote-link-signature-format'.  By default, this looks like
   5024         “signature title”.
   5025 
   5026 
   5027         If `FILE' does not have a signature, then use its title as the
   5028         description.
   5029 
   5030   Variable `denote-link-description-function'
   5031         Function to use to create the description of links. The function
   5032         specified should take a `FILE' argument and should return the
   5033         description as a string. By default, the title of the file is
   5034         returned as the description.
   5035 
   5036 
   5037 [The file-naming scheme] See section 5
   5038 
   5039 [Standard note creation] See section 3.1
   5040 
   5041 [Maintain separate directories for notes] See section 3.7
   5042 
   5043 [Sluggification of file name components] See section 5.1
   5044 
   5045 [The `denote-history-completion-in-prompts' option] See section 3.1.2
   5046 
   5047 [The denote-date-prompt-use-org-read-date option] See section 3.1.6
   5048 
   5049 [Points of entry] See section 3
   5050 
   5051 [Change the front matter format] See section 6.1
   5052 
   5053 
   5054 19 Troubleshoot Denote in a pristine environment
   5055 ════════════════════════════════════════════════
   5056 
   5057   Sometimes we get reports on bugs that may not be actually caused by
   5058   some error in the Denote code base.  To help gain insight into what
   5059   the problem is, we need to be able to reproduce the issue in a minimum
   5060   viable system.  Below is one way to achieve this.
   5061 
   5062   1. Find where your `denote.el' file is stored on your filesystem.
   5063 
   5064   2. Assuming you have already installed the package, one way to do this
   5065      is to invoke `M-x find-library' and search for `denote'.  It will
   5066      take you to the source file.  There do `M-x eval-expression', which
   5067      will bring up a minibuffer prompt.  At the prompt evaluate:
   5068 
   5069   ┌────
   5070   │ (kill-new (expand-file-name (buffer-file-name)))
   5071   └────
   5072 
   5073   1. The above will save the full file system path to your kill ring.
   5074 
   5075   2. In a terminal emulator or an `M-x shell' buffer execute:
   5076 
   5077   ┌────
   5078   │ emacs -Q
   5079   └────
   5080 
   5081   1. This will open a new instance of Emacs in a pristine environment.
   5082      Only the default settings are loaded.
   5083 
   5084   2. In the `*scratch*' buffer of `emacs -Q', add your configurations
   5085      like the following and try to reproduce the issue:
   5086 
   5087   ┌────
   5088   │ (require 'denote "/full/path/to/what/you/got/denote.el")
   5089   5090   │ ;; Your configurations here
   5091   └────
   5092 
   5093   Then try to see if your problem still occurs.  If it does, then the
   5094   fault is with Denote.  Otherwise there is something external to it
   5095   that we need to account for.  Whatever the case, this exercise helps
   5096   us get a better sense of the specifics.
   5097 
   5098 
   5099 20 Contributing
   5100 ═══════════════
   5101 
   5102   Denote is a GNU ELPA package. As such, any significant change to the
   5103   code requires copyright assignment to the Free Software Foundation
   5104   (more below).
   5105 
   5106   You do not need to be a programmer to contribute to this package.
   5107   Sharing an idea or describing a workflow is equally helpful, as it
   5108   teaches us something we may not know and might be able to cover either
   5109   by extending Denote or expanding this manual. If you prefer to write a
   5110   blog post, make sure you share it with us: we can add a section herein
   5111   referencing all such articles. Everyone gets acknowledged
   5112   ([Acknowledgements]). There is no such thing as an “insignificant
   5113   contribution”—they all matter.
   5114 
   5115   ⁃ Package name (GNU ELPA): `denote'
   5116   ⁃ Official manual: <https://protesilaos.com/emacs/denote>
   5117   ⁃ Change log: <https://protesilaos.com/emacs/denote-changelog>
   5118   ⁃ Git repositories:
   5119     ⁃ GitHub: <https://github.com/protesilaos/denote>
   5120     ⁃ GitLab: <https://gitlab.com/protesilaos/denote>
   5121 
   5122   If our public media are not suitable, you are welcome to contact me
   5123   (Protesilaos) in private: <https://protesilaos.com/contact>.
   5124 
   5125   Copyright assignment is a prerequisite to sharing code. It is a simple
   5126   process. Check the request form below (please adapt it accordingly).
   5127   You must write an email to the address mentioned in the form and then
   5128   wait for the FSF to send you a legal agreement. Sign the document and
   5129   file it back to them. This could all happen via email and take about a
   5130   week. You are encouraged to go through this process. You only need to
   5131   do it once. It will allow you to make contributions to Emacs in
   5132   general.
   5133 
   5134   ┌────
   5135   │ Please email the following information to assign@gnu.org, and we
   5136   │ will send you the assignment form for your past and future changes.
   5137   5138   │ Please use your full legal name (in ASCII characters) as the subject
   5139   │ line of the message.
   5140   5141   │ REQUEST: SEND FORM FOR PAST AND FUTURE CHANGES
   5142   5143   │ [What is the name of the program or package you're contributing to?]
   5144   5145   │ GNU Emacs
   5146   5147   │ [Did you copy any files or text written by someone else in these changes?
   5148   │ Even if that material is free software, we need to know about it.]
   5149   5150   │ Copied a few snippets from the same files I edited.  Their author,
   5151   │ Protesilaos Stavrou, has already assigned copyright to the Free Software
   5152   │ Foundation.
   5153   5154   │ [Do you have an employer who might have a basis to claim to own
   5155   │ your changes?  Do you attend a school which might make such a claim?]
   5156   5157   5158   │ [For the copyright registration, what country are you a citizen of?]
   5159   5160   5161   │ [What year were you born?]
   5162   5163   5164   │ [Please write your email address here.]
   5165   5166   5167   │ [Please write your postal address here.]
   5168   5169   5170   5171   5172   5173   │ [Which files have you changed so far, and which new files have you written
   5174   │ so far?]
   5175   5176   └────
   5177 
   5178 
   5179 [Acknowledgements] See section 24
   5180 
   5181 20.1 Wishlist of what we can do to extend Denote
   5182 ────────────────────────────────────────────────
   5183 
   5184   These are various ideas to extend Denote. Whether they should be in
   5185   the core package or a separate extension is something we can discuss.
   5186   I, Protesilaos, am happy to help anyone who wants to do any of this.
   5187 
   5188   denote-consult.el
   5189         This can be a separate package that enhances or replaces the
   5190         various prompts we have for files (and maybe more) by using the
   5191         `consult' package. Consult provides the preview mechanism and
   5192         can probably be used for more things, such as to define a source
   5193         for Denote-only buffers in the `consult-buffer' command. If we
   5194         need to tweak things in `denote.el', I am happy to do it. For
   5195         example, we could have a `denote-file-prompt-function' variable,
   5196         which would default to `denote-file-prompt' (what we currently
   5197         have) and would also such a hypothetical package to easily plug
   5198         into what we have.
   5199 
   5200   denote-embark.el
   5201         Provide integration with the `embark' package.  This can be for
   5202         doing something with the identifier/link at point.  For example,
   5203         it could provide an action to produce backlinks for the
   5204         identifier/file we are linking to, not just the current one.
   5205 
   5206   denote-transient.el
   5207         The `transient' package is built into Emacs 29 (Denote supports
   5208         Emacs 28 though). We can use it to define an alternative to what
   5209         we have for the menu bar. Perhaps this interface can used to
   5210         toggle various options, such as to call `denote' with a
   5211         different set of prompts.
   5212 
   5213   A `denote-directories' user option
   5214         This can be either an extension of the `denote-directory'
   5215         (accept a list of file paths value) or a new variable. The idea
   5216         is to let the user define separate Denote directories which do
   5217         know about the presence of each other (unlike silos). This way,
   5218         a user can have an entry in `~/Documents/notes/' link to
   5219         something `~/Git/projects/' and everything work as if the
   5220         `denote-directory' is set to the `~/' (with the status quo as of
   5221         2024-02-18 08:27 +0200).
   5222 
   5223   Signatures before identifiers
   5224         This is probably going to increase the complixity of `denote.el'
   5225         and may not be worth pursuing. But just to explore the idea: we
   5226         could have an option to rearrange file names such that the
   5227         signature appears before the identifier. If we can do this in a
   5228         smart way, we can probably extend the principle for all file
   5229         name components. Again though, this may be too complex and not
   5230         worth doing.
   5231 
   5232   Encode the day in the identifier
   5233         The idea is to use some coded reference for Monday, Tuesday,
   5234         etc. instead of having the generic `T' in the identifier. For
   5235         example, Monday is `A' so the identifier for it is something
   5236         like `20240219A101522' instead of what we now have as
   5237         `20240219T101522'. The old method should still be supported.
   5238         Apart from changing a few regular expressions, this does not
   5239         seem too complex to me. We would need a user option to opt in to
   5240         such a feature. Then tweak the relevant parts. The tricky issue
   5241         is to define a mapping of day names to letters/symbols that
   5242         works for everyone. Do all countries have a seven-day week, for
   5243         example? We need something universally applicable here.
   5244 
   5245   Anything else? You are welcome to discuss these and/or add to the
   5246   list.
   5247 
   5248 
   5249 21 Publications about Denote
   5250 ════════════════════════════
   5251 
   5252   The Emacs community is putting Denote to great use.  This section
   5253   includes publications that show how people configure their note-taking
   5254   setup.  If you have a blog post, video, or configuration file about
   5255   Denote, feel welcome to tell us about it ([Contributing]).
   5256 
   5257   ⁃ David Wilson (SystemCrafters): /Generating a Blog Site from Denote
   5258     Entries/, 2022-09-09, <https://www.youtube.com/watch?v=5R7ad5xz5wo>
   5259 
   5260   ⁃ David Wilson (SystemCrafters): /Trying Out Prot’s Denote, an Org
   5261     Roam Alternative?/, 2022-07-15,
   5262     <https://www.youtube.com/watch?v=QcRY_rsX0yY>
   5263 
   5264   ⁃ Jack Baty: /Keeping my Org Agenda updated based on Denote keywords/,
   5265     2022-11-30, <https://baty.net/2022/keeping-my-org-agenda-updated>
   5266 
   5267   ⁃ Jeremy Friesen: /Denote Emacs Configuration/, 2022-10-02,
   5268     <https://takeonrules.com/2022/10/09/denote-emacs-configuration/>
   5269 
   5270   ⁃ Jeremy Friesen: /Exploring the Denote Emacs Package/, 2022-10-01,
   5271     <https://takeonrules.com/2022/10/01/exploring-the-denote-emacs-package/>
   5272 
   5273   ⁃ Jeremy Friesen: /Migration Plan for Org-Roam Notes to Denote/,
   5274     2022-10-02,
   5275     <https://takeonrules.com/2022/10/02/migration-plan-for-org-roam-notes-to-denote/>
   5276 
   5277   ⁃ Jeremy Friesen: /Project Dispatch Menu with Org Mode Metadata,
   5278     Denote, and Transient/, 2022-11-19,
   5279     <https://takeonrules.com/2022/11/19/project-dispatch-menu-with-org-mode-metadata-denote-and-transient/>
   5280 
   5281   ⁃ Mohamed Suliman: /Managing a bibliography of BiBTeX entries with
   5282     Denote/, 2022-12-20,
   5283     <https://www.scss.tcd.ie/~sulimanm/posts/denote-bibliography.html>
   5284 
   5285   ⁃ Peter Prevos: /Simulating Text Files with R to Test the Emacs Denote
   5286     Package/, 2022-07-28,
   5287     <https://lucidmanager.org/productivity/testing-denote-package/>
   5288 
   5289   ⁃ Peter Prevos: /Emacs Writing Studio/, 2023-10-19. A configuration
   5290     for authors, using Denote for taking notes, literature reviews and
   5291     manage collections of images:
   5292     • <https://lucidmanager.org/productivity/taking-notes-with-emacs-denote/>
   5293     • <https://lucidmanager.org/productivity/denote-explore/>
   5294     • <https://lucidmanager.org/productivity/bibliographic-notes-in-emacs-with-citar-denote/>
   5295     • <https://lucidmanager.org/productivity/using-emacs-image-dired/>
   5296 
   5297   ⁃ Stefan Thesing: /Denote as a Zettelkasten/, 2023-03-02,
   5298     <https://www.thesing-online.de/blog/denote-as-a-zettelkasten>
   5299 
   5300   ⁃ Summer Emacs: /An explanation of how I use Emacs/, 2023-05-04,
   5301     <https://github.com/summeremacs/howiuseemacs/blob/main/full-explanation-of-how-i-use-emacs.org>
   5302 
   5303 
   5304 [Contributing] See section 20
   5305 
   5306 
   5307 22 Alternatives to Denote
   5308 ═════════════════════════
   5309 
   5310   What follows is a list of Emacs packages for note-taking.  I
   5311   (Protesilaos) have not used any of them, as I was manually applying my
   5312   file-naming scheme beforehand and by the time those packages were
   5313   available I was already hacking on the predecessor of Denote as a
   5314   means of learning Emacs Lisp (a package which I called “Unassuming
   5315   Sidenotes of Little Significance”, aka “USLS” which is pronounced as
   5316   “U-S-L-S” or “useless”).  As such, I cannot comment at length on the
   5317   differences between Denote and each of those packages, beside what I
   5318   gather from their documentation.
   5319 
   5320   [org-roam]
   5321         The de facto standard in the Emacs milieu—and rightly so!  It
   5322         has a massive community, is featureful, and should be an
   5323         excellent companion to anyone who is invested in the Org
   5324         ecosystem and/or knows what “Roam” is (I don’t).  It has been
   5325         explained to me that Org Roam uses a database to store a cache
   5326         about your notes.  It otherwise uses standard Org files.  The
   5327         cache helps refer to the same node through aliases which can
   5328         provide lots of options.  Personally, I follow a
   5329         single-topic-per-note approach, so anything beyond that is
   5330         overkill.  If the database is only for a cache, then maybe that
   5331         has no downside, though I am careful with any kind of
   5332         specialised program as it creates a dependency.  If you ask me
   5333         about database software in particular, I have no idea how to use
   5334         one, let alone debug it or retrieve data from it if something
   5335         goes awry (I could learn, but that is beside the point).
   5336 
   5337   [zk (or zk.el)]
   5338         Reading its documentation makes me think that this is Denote’s
   5339         sibling—the two projects have a lot of things in common,
   5340         including the preference to rely on plain files and standard
   5341         tools.  The core difference is that Denote has a strict
   5342         file-naming scheme.  Other differences in available features
   5343         are, in principle, matters of style or circumstance: both
   5344         packages can have them.  As its initials imply, ZK enables a
   5345         zettelkasten-like workflow.  It does not enforce it though,
   5346         letting the user adapt the method to their needs and
   5347         requirements.
   5348 
   5349   [zettelkasten]
   5350         This is another one of Denote’s relatives, at least insofar as
   5351         the goal of simplicity is concerned.  The major difference is
   5352         that according to its documentation “the name of the file that
   5353         is created is just a unique ID”.  This is not consistent with
   5354         our file-naming scheme which is all about making sense of your
   5355         files by their name alone and being able to visually parse a
   5356         listing of them without any kind of specialised tool (e.g. `ls
   5357         -l' or `ls -C' on the command-line from inside the
   5358         `denote-directory' give you a human-readable set of files names,
   5359         while `find * -maxdepth 0 -type f' is another approach).
   5360 
   5361   [zetteldeft]
   5362         This is a zettelkasten note-taking system built on top of the
   5363         `deft' package.  Deft provides a search interface to a
   5364         directory, in this case the one holding the user’s `zetteldeft'
   5365         notes.  Denote has no such dependency and is not opinionated
   5366         about how the user prefers to search/access their notes: use
   5367         Dired, Grep, the `consult' package, or whatever else you already
   5368         have set up for all things Emacs, not just your notes.
   5369 
   5370   Searching through `M-x list-packages' for “zettel” brings up more
   5371   matches.  `zetteldesk' is an extension to Org Roam and, as such, I
   5372   cannot possibly know what Org Roam truly misses and what the
   5373   added-value of this package is.  `neuron-mode' builds on top of an
   5374   external program called `neuron', which I have never used.
   5375 
   5376   Searching for “note” gives us a few more results.  `notes-mode' has
   5377   precious little documentation and I cannot tell what it actually does
   5378   (as I said in my presentation for LibrePlanet 2022, inadequate docs
   5379   are a bug).  `side-notes' differs from what we try to do with Denote,
   5380   as it basically gives you the means to record your thoughts about some
   5381   other project you are working on and keep them on the side: so it and
   5382   Denote should not be mutually exclusive.
   5383 
   5384   If I missed something, please let me know.
   5385 
   5386 
   5387 [org-roam] <https://github.com/org-roam/org-roam>
   5388 
   5389 [zk (or zk.el)] <https://github.com/localauthor/zk>
   5390 
   5391 [zettelkasten] <https://github.com/ymherklotz/emacs-zettelkasten>
   5392 
   5393 [zetteldeft] <https://github.com/EFLS/zetteldeft>
   5394 
   5395 22.1 Alternative implementations and further reading
   5396 ────────────────────────────────────────────────────
   5397 
   5398   This section covers blog posts and implementations from the Emacs
   5399   community about the topic of note-taking and file organization.  They
   5400   may refer to some of the packages covered in the previous section or
   5401   provide their custom code ([Alternatives to Denote]).  The list is
   5402   unsorted.
   5403 
   5404   ⁃ José Antonio Ortega Ruiz (aka “jao”) explains a note-taking method
   5405     that is simple like Denote but differs in other ways.  An
   5406     interesting approach overall:
   5407     <https://jao.io/blog/simple-note-taking.html>.
   5408 
   5409   ⁃ Jethro Kuan (the main `org-roam' developer) explains their
   5410     note-taking techniques:
   5411     <https://jethrokuan.github.io/org-roam-guide/>.  Good ideas all
   5412     round, regardless of the package/code you choose to use.
   5413 
   5414   ⁃ Karl Voit’s tools [date2name], [filetags], [appendfilename], and
   5415     [move2archive] provide a Python-based implementation to organize
   5416     individual files which do not require Emacs.  His approach ([blog
   5417     post] and his [presentation at GLT18]) has been complemented by
   5418     [memacs] to process e.g., the date of creation of photographs, or
   5419     the log of a phone call in a format compatible to org.
   5420 
   5421   [ Development note: help expand this list. ]
   5422 
   5423 
   5424 [Alternatives to Denote] See section 22
   5425 
   5426 [date2name] <https://github.com/novoid/date2name>
   5427 
   5428 [filetags] <https://github.com/novoid/filetags/>
   5429 
   5430 [appendfilename] <https://github.com/novoid/appendfilename/>
   5431 
   5432 [move2archive] <https://github.com/novoid/move2archive>
   5433 
   5434 [blog post] <https://karl-voit.at/managing-digital-photographs/>
   5435 
   5436 [presentation at GLT18] <https://www.youtube.com/watch?v=rckSVmYCH90>
   5437 
   5438 [memacs] <https://github.com/novoid/memacs>
   5439 
   5440 
   5441 23 Frequently Asked Questions
   5442 ═════════════════════════════
   5443 
   5444   I (Protesilaos) answer some questions I have received or might get.
   5445   It is assumed that you have read the rest of this manual: I will not
   5446   go into the specifics of how Denote works.
   5447 
   5448 
   5449 23.1 Why develop Denote when PACKAGE already exists?
   5450 ────────────────────────────────────────────────────
   5451 
   5452   I wrote Denote because I was using a variant of Denote’s file-naming
   5453   scheme before I was even an Emacs user (I switched to Emacs from
   5454   Tmux+Vim+CLI in the summer of 2019).  I was originally inspired by
   5455   Jekyll, the static site generator, which I started using for my
   5456   website in 2016 (was on WordPress before).  Jekyll’s files follow the
   5457   `YYYY-MM-DD-TITLE.md' pattern.  I liked its efficiency relative to the
   5458   unstructured mess I had before.  Eventually, I started using that
   5459   scheme outside the confines of my website’s source code.  Over time I
   5460   refined it and here we are.
   5461 
   5462   Note-taking is something I take very seriously, as I am a prolific
   5463   writer (just check my website, which only reveals the tip of the
   5464   iceberg).  As such, I need a program that does exactly what I want and
   5465   which I know how to extend.  I originally tried to use Org capture
   5466   templates to create new files with a Denote-style file-naming scheme
   5467   but never managed to achieve it.  Maybe because `org-capture' has some
   5468   hard-coded assumptions or I simply am not competent enough to hack on
   5469   core Org facilities.  Whatever the case, an alternative was in order.
   5470 
   5471   The existence of PACKAGE is never a good reason for me not to conduct
   5472   my own experiments for recreational, educational, or practical
   5473   purposes.  When the question arises of “why not contribute to PACKAGE
   5474   instead?” the answer is that without me experimenting in the first
   5475   place, I would lack the skills for such a task.  Furthermore,
   5476   contributing to another package does not guarantee I get what I want
   5477   in terms of workflow.
   5478 
   5479   Whether you should use Denote or not is another matter altogether:
   5480   choose whatever you want.
   5481 
   5482 
   5483 23.2 Why not rely exclusively on Org?
   5484 ─────────────────────────────────────
   5485 
   5486   I think Org is one of Emacs’ killer apps.  I also believe it is not
   5487   the right tool for every job.  When I write notes, I want to focus on
   5488   writing.  Nothing more.  I thus have no need for stuff like org-babel,
   5489   scheduling to-do items, clocking time, and so on.  The more “mental
   5490   dependencies” you add to your workflow, the heavier the burden you
   5491   carry and the less focused you are on the task at hand: there is
   5492   always that temptation to tweak the markup, tinker with some syntactic
   5493   construct, obsess about what ought to be irrelevant to writing as
   5494   such.
   5495 
   5496   In technical terms, I also am not fond of Org’s code base (I
   5497   understand why it is the way it is—just commenting on the fact).  Ever
   5498   tried to read it?  You will routinely find functions that are
   5499   tens-to-hundreds of lines long and have all sorts of special casing.
   5500   As I am not a programmer and only learnt to write Elisp through trial
   5501   and error, I have no confidence in my ability to make Org do what I
   5502   want at that level, hence `denote' instead of `org-denote' or
   5503   something.
   5504 
   5505   Perhaps the master programmer is one who can deal with complexity and
   5506   keep adding to it.  I am of the opposite view, as language—code
   5507   included—is at its communicative best when it is clear and accessible.
   5508 
   5509   Make no mistake: I use Org for the agenda and also to write technical
   5510   documentation that needs to be exported to various formats, including
   5511   this very manual.
   5512 
   5513 
   5514 23.3 Why care about Unix tools when you use Emacs?
   5515 ──────────────────────────────────────────────────
   5516 
   5517   My notes form part of my longer-term storage.  I do not want to have
   5518   to rely on a special program to be able to read them or filter them.
   5519   Unix is universal, at least as far as I am concerned.
   5520 
   5521   Denote streamlines some tasks and makes things easier in general,
   5522   which is consistent with how Emacs provides a layer of interactivity
   5523   on top of Unix.  Still, Denote’s utilities can, in principle, be
   5524   implemented as POSIX shell scripts (minus the Emacs-specific parts
   5525   like fontification in Dired or the buttonization of links).
   5526 
   5527   Portability matters.  For example, in the future I might own a
   5528   smartphone, so I prefer not to require Emacs, Org, or some other
   5529   executable to access my files on the go.
   5530 
   5531   Furthermore, I might want to share those files with someone.  If I
   5532   make Emacs a requirement, I am limiting my circle to a handful of
   5533   relatively advanced users.
   5534 
   5535   Please don’t misinterpret this: I am using Emacs full-time for my
   5536   computing and maintain a growing list of packages for it.  This is
   5537   just me thinking long-term.
   5538 
   5539 
   5540 23.4 Why many small files instead of few large ones?
   5541 ────────────────────────────────────────────────────
   5542 
   5543   I have read that Org favours the latter method.  If true, I strongly
   5544   disagree with it because of the implicit dependency it introduces and
   5545   the way it favours machine-friendliness over human-readability in
   5546   terms of accessing information.  Notes are long-term storage.  I might
   5547   want to access them on (i) some device with limited features, (ii)
   5548   print on paper, (iii) share with another person who is not a tech
   5549   wizard.
   5550 
   5551   There are good arguments for few large files, but all either
   5552   prioritize machine-friendliness or presuppose the use of sophisticated
   5553   tools like Emacs+Org.
   5554 
   5555   Good luck using `less' on a generic TTY to read a file with a zillion
   5556   words, headings, sub-headings, sub-sub-headings, property drawers, and
   5557   other constructs!  You will not get the otherwise wonderful folding of
   5558   headings the way you do in Emacs—do not take such features for
   5559   granted.
   5560 
   5561   My point is that notes should be atomic to help the user—and
   5562   potentially the user’s family, friends, acquaintances—make sense of
   5563   them in a wide range of scenaria.  The more program-agnostic your file
   5564   is, the better for you and/or everyone else you might share your
   5565   writings with.
   5566 
   5567   Human-readability means that we optimize for what matters to us.  If
   5568   (a) you are the only one who will ever read your notes, (b) always
   5569   have access to good software like Emacs+Org, (c) do not care about
   5570   printing on paper, then Denote’s model is not for you.  Maybe you need
   5571   to tweak some `org-capture' template to append a new entry to one mega
   5572   file (I do that for my Org agenda, by the way, as I explained before
   5573   about using the right tool for the job).
   5574 
   5575 
   5576 23.5 Does Denote perform well at scale?
   5577 ───────────────────────────────────────
   5578 
   5579   Denote does not do anything fancy and has no special requirements: it
   5580   uses standard tools to accomplish ordinary tasks.  If Emacs can cope
   5581   with lots of files, then that is all you need to know: Denote will
   5582   work.
   5583 
   5584   To put this to the test, Peter Prevos is running simulations with R
   5585   that generate large volumes of notes.  You can read the technicalities
   5586   here: <https://lucidmanager.org/productivity/testing-denote-package/>.
   5587   Excerpt:
   5588 
   5589         Using this code I generated ten thousands notes and used
   5590         this to test the Denote package to see it if works at a
   5591         large scale. This tests shows that Prot’s approach is
   5592         perfectly capable of working with thousands of notes.
   5593 
   5594   Of course, we are always prepared to make refinements to the code,
   5595   where necessary, without compromising on the project’s principles.
   5596 
   5597 
   5598 23.6 I add TODOs to my notes; will many files slow down the Org agenda?
   5599 ───────────────────────────────────────────────────────────────────────
   5600 
   5601   Yes, many files will slow down the agenda due to how that works.  Org
   5602   collects all files specified in the `org-agenda-files', searches
   5603   through their contents for timestamped entries, and then loops through
   5604   all days to determine where each entry belongs.  The more days and
   5605   more files, the longer it takes to build the agenda.  Doing this with
   5606   potentially hundreds of files will have a noticeable impact on
   5607   performance.
   5608 
   5609   This is not a deficiency of Denote.  It happens with generic Org
   5610   files.  The way the agenda is built is heavily favoring the use of a
   5611   single file that holds all your timestamped entries (or at least a few
   5612   such files).  Tens or hundreds of files are inefficient for this job.
   5613   Plus doing so has the side-effect of making Emacs open all those
   5614   files, which you probably do not need.
   5615 
   5616   If you want my opinion though, be more forceful with the separation of
   5617   concerns.  Decouple your knowledge base from your ephemeral to-do
   5618   list: Denote (and others) can be used for the former, while you let
   5619   standard Org work splendidly for the latter—that is what I do, anyway.
   5620 
   5621   Org has a powerful linking facility, whether you use `org-store-link'
   5622   or do it via an `org-capture' template.  If you want a certain note to
   5623   be associated with a task, just store the task in a single `tasks.org'
   5624   (or however you name it) and link to the relevant context.
   5625 
   5626   Do not mix your knowledge base with your to-do items.  If you need
   5627   help figuring out the specifics of this workflow, you are welcome to
   5628   ask for help in our relevant channels ([Contributing]).
   5629 
   5630 
   5631 [Contributing] See section 20
   5632 
   5633 
   5634 23.7 I want to sort by last modified in Dired, why won’t Denote let me?
   5635 ───────────────────────────────────────────────────────────────────────
   5636 
   5637   Denote does not control how Dired sorts files. I encourage you to read
   5638   the manpage of the `ls' executable. It will help you in general, while
   5639   it applies to Emacs as well via Dired. The gist is that you can update
   5640   the `ls' flags that Dired uses on-the-fly: type `C-u M-x
   5641   dired-sort-toggle-or-edit' (`C-u s' by default) and append
   5642   `--sort=time' at the prompt. To reverse the order, add the `-r' flag.
   5643   The user option `dired-listing-switches' sets your default preference.
   5644 
   5645   For an on-demand sorted and filtered Dired listing of Denote files,
   5646   use the command `denote-sort-dired' ([Sort files by component]).
   5647 
   5648 
   5649 [Sort files by component] See section 12
   5650 
   5651 
   5652 23.8 How do you handle the last modified case?
   5653 ──────────────────────────────────────────────
   5654 
   5655   Denote does not insert any meta data or heading pertaining to edits in
   5656   the file.  I am of the view that these either do not scale well or are
   5657   not descriptive enough.  Suppose you use a “lastmod” heading with a
   5658   timestamp: which lines where edited and what did the change amount to?
   5659 
   5660   This is where an external program can be helpful.  Use a Version
   5661   Control System, such as Git, to keep track of all your notes.  Every
   5662   time you add a new file, record the addition.  Same for post-creation
   5663   edits.  Your VCS will let you review the history of those changes.
   5664   For instance, Emacs’ built-in version control framework has a command
   5665   that produces a log of changes for the current file: `M-x
   5666   vc-print-log', bound to `C-x v l' by default.  From there one can
   5667   access the corresponding diff output (use `M-x describe-mode' (`C-h
   5668   m') in an unfamiliar buffer to learn more about it).  With Git in
   5669   particular, Emacs users have the option of the all-round excellent
   5670   `magit' package.
   5671 
   5672   In short: let Denote (or equivalent) create notes and link between
   5673   them, the file manager organise and provide access to files, search
   5674   programs deal with searching and narrowing, and version control
   5675   software handle the tracking of changes.
   5676 
   5677 
   5678 23.9 Speed up backlinks’ buffer creation?
   5679 ─────────────────────────────────────────
   5680 
   5681   Denote leverages the built-in `xref' library to search for the
   5682   identifier of the current file and return any links to it.  For users
   5683   of Emacs version 28 or higher, there exists a user option to specify
   5684   the program that performs this search: `xref-search-program'.  The
   5685   default is `grep', which can be slow, though one may opt for `ugrep',
   5686   `ripgrep', or even specify something else (read the doc string of that
   5687   user option for the details).
   5688 
   5689   Try either for these for better results:
   5690 
   5691   ┌────
   5692   │ (setq xref-search-program 'ripgrep)
   5693   5694   │ ;; OR
   5695   5696   │ (setq xref-search-program 'ugrep)
   5697   └────
   5698 
   5699   To use whatever executable is available on your system, use something
   5700   like this:
   5701 
   5702   ┌────
   5703   │ ;; Prefer ripgrep, then ugrep, and fall back to regular grep.
   5704   │ (setq xref-search-program
   5705   │       (cond
   5706   │        ((or (executable-find "ripgrep")
   5707   │ 	    (executable-find "rg"))
   5708   │ 	'ripgrep)
   5709   │        ((executable-find "ugrep")
   5710   │ 	'ugrep)
   5711   │        (t
   5712   │ 	'grep)))
   5713   └────
   5714 
   5715 
   5716 23.10 Why do I get “Search failed with status 1” when I search for backlinks?
   5717 ─────────────────────────────────────────────────────────────────────────────
   5718 
   5719   Denote uses [Emacs’ Xref] to find backlinks.  Xref requires `xargs'
   5720   and one of `grep' or `ripgrep', depending on your configuration.
   5721 
   5722   This is usually not an issue on *nix systems, but the necessary
   5723   executables are not available on Windows Emacs distributions.  Please
   5724   ensure that you have both `xargs' and either `grep' or `ripgrep'
   5725   available within your `PATH' environment variable.
   5726 
   5727   If you have `git' on Windows installed, then you may use the following
   5728   code (adjust the git’s installation path if necessary):
   5729   ┌────
   5730   │ (setenv "PATH" (concat (getenv "PATH") ";" "C:\\Program Files\\Git\\usr\\bin"))
   5731   └────
   5732 
   5733 
   5734 [Emacs’ Xref] <info:emacs#Xref>
   5735 
   5736 
   5737 23.11 Why do I get a double `#+title' in Doom Emacs?
   5738 ────────────────────────────────────────────────────
   5739 
   5740   Doom Emacs provides a set of bespoke templates for Org. One of those
   5741   prefills any new Org file with a `#+title' field. So when Denote
   5742   creates a new Org file and inserts front matter to it, it inevitably
   5743   adds an extra title to the existing one.
   5744 
   5745   This is not a Denote problem. We can only expect a new file to be
   5746   empty by default. Check how to disable the relevant module in your
   5747   Doom Emacs configuration file.
   5748 
   5749 
   5750 24 Acknowledgements
   5751 ═══════════════════
   5752 
   5753   Denote is meant to be a collective effort.  Every bit of help matters.
   5754 
   5755   Author/maintainer
   5756         Protesilaos Stavrou.
   5757 
   5758   Contributions to code or the manual
   5759         Abin Simon, Adam Růžička, Alan Schmitt, Ashton Wiersdorf,
   5760         Benjamin Kästner, Bruno Boal, Charanjit Singh, Clemens
   5761         Radermacher, Colin McLear, Damien Cassou, Eduardo Grajeda, Elias
   5762         Storms, Eshel Yaron, Florian, Glenna D., Graham Marlow, Hilde
   5763         Rhyne, Ivan Sokolov, Jack Baty, Jean-Charles Bagneris,
   5764         Jean-Philippe Gagné Guay, Joseph Turner, Jürgen Hötzel, Kaushal
   5765         Modi, Kai von Fintel, Kostas Andreadis, Kristoffer Balintona,
   5766         Kyle Meyer, Marc Fargas, Matthew Lemon, Noboru Ota (nobiot),
   5767         Norwid Behrnd, Peter Prevos, Philip Kaludercic, Quiliro Ordóñez,
   5768         Stephen R. Kifer, Stefan Monnier, Stefan Thesing, Thibaut
   5769         Benjamin, Tomasz Hołubowicz, Vedang Manerikar, Wesley Harvey,
   5770         Zhenxu Xu, arsaber101, ezchi, jarofromel, leinfink (Henrik),
   5771         l-o-l-h (Lincoln), mattyonweb, maxbrieiev, mentalisttraceur,
   5772         pmenair, relict007.
   5773 
   5774   Ideas and/or user feedback
   5775         Abin Simon, Aditya Yadav, Alan Schmitt, Aleksandr Vityazev, Alex
   5776         Hirschfeld, Alfredo Borrás, Ashton Wiersdorf, Benjamin Kästner,
   5777         Claudiu Tănăselia, Colin McLear, Damien Cassou, Elias Storms,
   5778         Federico Stilman, Florian, Frédéric Willem Frank Ehmsen, Glenna
   5779         D., Guo Yong, Hanspeter Gisler, Jack Baty, Jay Rajput,
   5780         Jean-Charles Bagneris, Jens Östlund, Jeremy Friesen, Jonathan
   5781         Sahar, Johan Bolmsjö, Jousimies, Juanjo Presa, Kai von Fintel,
   5782         Kaushal Modi, M. Hadi Timachi, Mark Olson, Mirko Hernandez,
   5783         Niall Dooley, Paul van Gelder, Peter Prevos, Peter Smith, Suhail
   5784         Singh, Shreyas Ragavan, Stefan Thesing, Summer Emacs, Sven
   5785         Seebeck, Taoufik, TJ Stankus, Vick (VicZz), Viktor Haag, Wade
   5786         Mealing, Yi Liu, Ypot, atanasj, babusri, doolio, drcxd,
   5787         fingerknight, hpgisler, mentalisttraceur, pRot0ta1p, rbenit68,
   5788         relict007, sienic, sundar bp.
   5789 
   5790   Special thanks to Peter Povinec who helped refine the file-naming
   5791   scheme, which is the cornerstone of this project.
   5792 
   5793   Special thanks to Jean-Philippe Gagné Guay for the numerous
   5794   contributions to the code base.
   5795 
   5796 
   5797 25 GNU Free Documentation License
   5798 ═════════════════════════════════
   5799 
   5800 
   5801 26 Indices
   5802 ══════════
   5803 
   5804 26.1 Function index
   5805 ───────────────────
   5806 
   5807 
   5808 26.2 Variable index
   5809 ───────────────────
   5810 
   5811 
   5812 26.3 Concept index
   5813 ──────────────────