dotemacs

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

denote.info (319817B)


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