### Install Denote Manually Source: https://github.com/protesilaos/denote/blob/main/README.org Steps to manually install the Denote package by cloning the repository and adding it to the load path. ```shell mkdir manual-packages cd manual-packages git clone https://github.com/protesilaos/denote denote ``` ```emacs-lisp ;; Make Elisp files in that directory available to the user. (add-to-list 'load-path "~/.emacs.d/manual-packages/denote") ``` -------------------------------- ### Example File Name for Sorting Source: https://github.com/protesilaos/denote/blob/main/README.org An example file name demonstrating the naming convention used for custom sorting in Dired. ```emacs-lisp 20220929T200432--testing-file-one__alpha.txt ``` -------------------------------- ### Manual Installation of denote Source: https://github.com/protesilaos/denote/blob/main/README.org Steps to manually install the denote Emacs package by cloning the repository into the Emacs configuration directory. ```shell cd ~/.emacs.d ``` -------------------------------- ### Example Usage with Prompts Source: https://github.com/protesilaos/denote/blob/main/_autodocs/api-reference/org-capture.md Demonstrates programmatic calls to `denote-org-capture-with-prompts` with specified metadata, including prompting for title and keywords. ```elisp (denote-org-capture-with-prompts "Meeting Minutes" '("meetings" "2022-06-30") "meetings") (denote-org-capture-with-prompts nil ; prompt for title nil ; prompt for keywords "work" "2022-06-30" 'meeting) ; use "meeting" template ``` -------------------------------- ### Basic Denote Configuration Source: https://github.com/protesilaos/denote/blob/main/CHANGELOG.org A minimal Emacs Lisp configuration to get started with Denote, including keybindings and setting the notes directory. ```emacs-lisp (use-package denote :ensure t :bind (("C-c n n" . denote) ("C-c n r" . denote-rename-file) ("C-c n i" . denote-link) ; "insert" mnemonic ("C-c n b" . denote-backlinks)) :config (setq denote-directory (expand-file-name "~/Documents/notes/"))) ``` -------------------------------- ### Example: Use Only Hyphenation for Slugification Source: https://github.com/protesilaos/denote/blob/main/_autodocs/api-reference/slugification.md This example shows how to set `denote-file-name-slug-functions` to use only the hyphenation function for creating slugs. ```elisp ;; Use only hyphenation (setq denote-file-name-slug-functions '(#'denote-slug-hyphenate)) ``` -------------------------------- ### Example Org Capture Usage Source: https://github.com/protesilaos/denote/blob/main/_autodocs/api-reference/org-capture.md Illustrates the steps to trigger Org Capture and select the Denote template for creating a new note. ```elisp ;; Trigger Org Capture (org-capture) ;; Select "d" for Denote ;; Create note with your content ;; Confirm to save ``` -------------------------------- ### Example: Use Custom Slugification Function Source: https://github.com/protesilaos/denote/blob/main/_autodocs/api-reference/slugification.md This example demonstrates how to include a custom slugification function, `my-custom-slug-function`, in addition to the default hyphenation function. ```elisp ;; Use custom function (setq denote-file-name-slug-functions (list #'denote-slug-hyphenate #'my-custom-slug-function)) ``` -------------------------------- ### Start Emacs in Pristine Environment Source: https://github.com/protesilaos/denote/blob/main/README.org Execute this command in a terminal to launch Emacs with default settings, useful for isolating issues. ```shell emacs -Q ``` -------------------------------- ### Get All Keywords for Completion Source: https://github.com/protesilaos/denote/blob/main/_autodocs/api-reference/metadata-extraction.md Returns the combination of known keywords and inferred keywords from files if enabled. ```elisp (defun denote-keywords ()) ``` -------------------------------- ### Plain Text Front Matter Example Source: https://github.com/protesilaos/denote/blob/main/README.org Example of front matter for a plain text file, including title, date, tags, and identifier, separated by a line of dashes. ```text title: This is a sample note date: 2022-06-30 tags: denote testing identifier: 20220630T161028 --------------------------- ``` -------------------------------- ### Command Line Sorting Example Source: https://github.com/protesilaos/denote/blob/main/README.org Demonstrates how to sort files using the command line with a custom delimiter and key, achieving a different order than Dired's default. ```shell $ ls | sort -t _ -k 2 20220929T200432--testing-file-one__alpha.txt 20220929T200632--testing-file-three__alpha.txt 20220929T200532--testing-file-two__beta.txt 20220929T200732--testing-file-four__beta.txt ``` -------------------------------- ### Org Mode Front Matter Example Source: https://github.com/protesilaos/denote/blob/main/README.org Example of front matter for an Org mode file, including title, date, file tags, and a unique identifier. ```org-mode #+title: This is a sample note #+date: [2022-06-30 Thu 16:09] #+filetags: :denote:testing: #+identifier: 20220630T160934 ``` -------------------------------- ### Link to note with specific keywords Source: https://github.com/protesilaos/denote/blob/main/_autodocs/api-reference/core-commands.md Example of using denote-link-or-create to link to a note that has specific keywords associated with it. ```elisp ;; Link to note with specific keywords (denote-link-or-create nil '("research")) ``` -------------------------------- ### Example Front Matter for Renaming Source: https://github.com/protesilaos/denote/blob/main/README.org This is an example of the front matter structure used by Denote for renaming files. Ensure your files have similar structures for the renaming commands to work effectively. ```org #+title: My sample note file #+date: [2022-08-05 Fri 13:10] #+filetags: :testing: #+identifier: 20220805T131044 ``` -------------------------------- ### Programmatic Note Creation with All Options Source: https://github.com/protesilaos/denote/blob/main/_autodocs/api-reference/core-commands.md A comprehensive example demonstrating programmatic note creation using the `denote` function with all possible parameters: title, keywords, file type, directory, date, template, signature, and identifier. ```elisp ;; Programmatic creation with all options (denote "API Documentation" '("dev" "reference") 'markdown-yaml "~/notes/technical" "2022-06-30 14:30" "quarterly" "v1" "20220630T143000") ``` -------------------------------- ### Example Usage of denote-get-backlinks Source: https://github.com/protesilaos/denote/blob/main/_autodocs/api-reference/metadata-extraction.md Demonstrates how to call denote-get-backlinks and process the returned list of backlinks. It iterates through the results and prints each referencing file path. ```elisp (let ((backlinks (denote-get-backlinks "/path/to/note.org"))) (dolist (file backlinks) (message "Referenced by: %s" file))) ``` -------------------------------- ### Install denote from GNU ELPA Source: https://github.com/protesilaos/denote/blob/main/README.org Refresh package contents and install the denote package using Emacs package manager commands. ```emacs-lisp M-x package-refresh-contents M-x package-install ``` -------------------------------- ### Example Denote File Names in Dired Source: https://github.com/protesilaos/denote/blob/main/CHANGELOG.org Illustrates how file names appear in a Dired buffer when using Denote's sorting mechanism, including subdirectory components. ```text test-subdir/20230320T105950--a-new-note__testing.txt 20231202T095629--rename-works-as-intended__one_test_two.org ``` -------------------------------- ### Dired Sorting Example with Custom Convention Source: https://github.com/protesilaos/denote/blob/main/README.org Illustrates how Dired might sort files based on a custom naming convention, showing the default behavior before custom sorting. ```emacs-lisp 20220929T200432--testing-file-one__alpha.txt 20220929T200532--testing-file-two__beta.txt 20220929T200632--testing-file-three__alpha.txt 20220929T200732--testing-file-four__beta.txt ``` -------------------------------- ### Sort Files by Title Source: https://github.com/protesilaos/denote/blob/main/_autodocs/api-reference/search-and-filtering.md Example of sorting denote files by their titles. ```elisp ;; Sort by title (denote-sort-files nil 'title) ``` -------------------------------- ### Org filetags Example (New Format) Source: https://github.com/protesilaos/denote/blob/main/CHANGELOG.org Shows the correct format for Org file tags as stipulated by Org documentation, using the colon sign as a separator. Denote now conforms to this standard. ```org #+begin_example #+filetags: :tag1:tag2: #+end_example ``` -------------------------------- ### Link to existing or create new topic Source: https://github.com/protesilaos/denote/blob/main/_autodocs/api-reference/core-commands.md Example of using denote-link-or-create to link to an existing note or create a new one in the current buffer. ```elisp ;; In current note, link to existing or create new topic (denote-link-or-create) ``` -------------------------------- ### Dired Renaming Workflow Example Source: https://github.com/protesilaos/denote/blob/main/_autodocs/api-reference/dired-integration.md Illustrates the steps to rename Denote files within a Dired buffer. This workflow involves marking files, initiating the rename command, and confirming Denote-specific updates. ```elisp ;; In dired buffer: ;; 1. Mark files: m (or M for regex) ;; 2. Rename marked: R ;; 3. Confirm denote-specific updates when prompted ``` -------------------------------- ### Org filetags Example (Old Format) Source: https://github.com/protesilaos/denote/blob/main/CHANGELOG.org Illustrates the previous format for Org file tags, which used two spaces as separators. This format is not supported by Org. ```org #+begin_example #+filetags: tag1 tag2 #+end_example ``` -------------------------------- ### Example Usage of denote-rename-file-signature Source: https://github.com/protesilaos/denote/blob/main/_autodocs/api-reference/renaming-commands.md Demonstrates how to call the denote-rename-file-signature function with different arguments, including default values, a specific new signature, and an empty signature. ```elisp (denote-rename-file-signature) ``` ```elisp (denote-rename-file-signature nil "v2") ``` ```elisp (denote-rename-file-signature "/path/to/note.org" "") ``` -------------------------------- ### Example Usage: Focus on Denote Files in Dired Source: https://github.com/protesilaos/denote/blob/main/_autodocs/api-reference/dired-integration.md Demonstrates how to use the `denote-dired-focus` function to filter Dired to show only Denote files. ```emacs-lisp ;; In Dired, focus on denote files only (denote-dired-focus) ``` -------------------------------- ### Open Denote Manual Node Source: https://github.com/protesilaos/denote/blob/main/CHANGELOG.org Evaluates to open the Info manual node for renaming multiple files at once. Ensure the latest Info manual is installed. ```emacs-lisp (info "(denote) Rename multiple files at once") ``` -------------------------------- ### Configure Denote File Name Components Order Source: https://github.com/protesilaos/denote/blob/main/README.org Set the order of components (identifier, signature, title, keywords) in Denote file names. The examples show different ordering possibilities. ```emacs-lisp (setq denote-file-name-components-order '(identifier signature title keywords)) ;; => 20240519T07345==hello--this-is-the-title__denote_testing.org ``` ```emacs-lisp (setq denote-file-name-components-order '(signature identifier title keywords)) ;; => ==hello@@20240519T07345--this-is-the-title__denote_testing.org ``` ```emacs-lisp (setq denote-file-name-components-order '(title signature identifier keywords)) ;; => --this-is-the-title==hello@@20240519T07345__denote_testing.org ``` ```emacs-lisp (setq denote-file-name-components-order '(keywords title signature identifier)) ;; => __denote_testing--this-is-the-title==hello@@20240519T07345.org ``` -------------------------------- ### Get the primary denote directory Source: https://github.com/protesilaos/denote/blob/main/_autodocs/api-reference/file-operations.md Returns the first directory in the configured denote directories. This is the default destination for new notes. ```elisp (defun denote-directory () ``` ```elisp (message "Primary denote directory: %s" (denote-directory)) ``` -------------------------------- ### Configure Link Opening Function Source: https://github.com/protesilaos/denote/blob/main/_autodocs/configuration.md Specify the function to use when opening a file via a Denote link. Examples include opening in the same window or a different frame. ```elisp (defcustom denote-open-link-function #'find-file-other-window :type 'function) ``` ```elisp ;; Open links in the same window (setq denote-open-link-function #'find-file) ;; Open in other frame (setq denote-open-link-function #'find-file-other-frame) ``` -------------------------------- ### Example Usage of denote-rename-file-identifier Source: https://github.com/protesilaos/denote/blob/main/_autodocs/api-reference/renaming-commands.md Shows how to use the denote-rename-file-identifier function, including calling it with default parameters and providing a specific ISO 8601 formatted identifier. ```elisp (denote-rename-file-identifier) ``` ```elisp (denote-rename-file-identifier nil "20220630T143000") ``` -------------------------------- ### Example Usage: Add Keywords to Marked Files Source: https://github.com/protesilaos/denote/blob/main/_autodocs/api-reference/dired-integration.md Shows how to add keywords to marked files in Dired using `denote-dired-rename-marked-files-with-keywords`. Files must be marked first. ```emacs-lisp ;; Mark files in Dired, then: (denote-dired-rename-marked-files-with-keywords) ``` -------------------------------- ### Get Denote File Location for Org Capture Source: https://github.com/protesilaos/denote/blob/main/_autodocs/api-reference/org-capture.md Use this function within an Org Capture template to determine the correct path for a new Denote file. No specific setup is required beyond having Denote installed. ```elisp (denote-org-capture-file) ``` -------------------------------- ### Create Note with Custom Date and Directory Source: https://github.com/protesilaos/denote/blob/main/_autodocs/api-reference/core-commands.md Shows how to create a note with a title, keywords, a specific file type, a custom date, and a target directory. ```elisp ;; Create with custom date (denote "Historical Note" '("archive") 'org "~/notes" "2020-01-15") ``` -------------------------------- ### Shell Command: Initialize Git Repository Source: https://github.com/protesilaos/denote/blob/main/README.org Initializes a new Git repository in the current directory. This is a prerequisite for treating the notes directory as a version-controlled project. ```shell git init ``` -------------------------------- ### Get Denote.el File Path Source: https://github.com/protesilaos/denote/blob/main/README.org Use this Emacs Lisp expression to get the full file system path of the denote.el file and save it to the kill ring. This is useful for setting up a pristine environment for debugging. ```emacs-lisp (kill-new (expand-file-name (buffer-file-name))) ``` -------------------------------- ### denote-directory-subdirectories Source: https://github.com/protesilaos/denote/blob/main/_autodocs/api-reference/file-operations.md Get a list of subdirectories within the denote directories. ```APIDOC ## denote-directory-subdirectories ### Description Get list of subdirectories in denote directories. Returns all subdirectories within the configured denote directories, useful for organizing notes hierarchically. ### Method `defun denote-directory-subdirectories ()` ### Parameters None. ### Return Value List of strings, each an absolute path to a subdirectory. ### Example Usage ```elisp (let ((subdirs (denote-directory-subdirectories))) (message "Subdirectories: %s" subdirs)) ``` ``` -------------------------------- ### Create Note in Subdirectory with Template Source: https://github.com/protesilaos/denote/blob/main/_autodocs/api-reference/core-commands.md Illustrates creating a note in a subdirectory, specifying the file type, and using a template key for content. ```elisp ;; Create in subdirectory with template (denote "Report" '("quarterly") 'org "~/notes/reports" nil "quarterly") ``` -------------------------------- ### Create Note with Title, Keywords, and File Type Source: https://github.com/protesilaos/denote/blob/main/_autodocs/api-reference/core-commands.md Demonstrates creating a note with a title, a list of keywords, and a specified file type (markdown-yaml). ```elisp ;; Create with title, keywords, and file type (denote "Meeting Notes" '("meetings" "work") 'markdown-yaml) ``` -------------------------------- ### Create Note with Title Source: https://github.com/protesilaos/denote/blob/main/_autodocs/api-reference/core-commands.md Example of creating a new note with only a title specified. This is the simplest usage of the `denote` function. ```elisp ;; Create note with just a title (denote "My Project") ``` -------------------------------- ### denote-directory-files Source: https://github.com/protesilaos/denote/blob/main/_autodocs/api-reference/file-operations.md Get a list of denote files with optional filtering capabilities. This function respects configured exclusion patterns. ```APIDOC ## denote-directory-files ### Description Get list of denote files with optional filtering. Returns a list of all denote files in the configured denote directories (including subdirectories), with optional filtering. This respects exclusion patterns configured in `denote-excluded-files-regexp` and `denote-excluded-directories-regexp`. ### Method `defun denote-directory-files (&optional files-matching-regexp omit-current text-only exclude-regexp has-identifier)` ### Parameters #### Optional Parameters - **files-matching-regexp** (string) - no - nil - Filter files by filename regexp - **omit-current** (boolean) - no - nil - If true, exclude the current file - **text-only** (boolean) - no - nil - If true, exclude files with signatures or keywords - **exclude-regexp** (string) - no - nil - Exclude files matching this regexp - **has-identifier** (boolean) - no - nil - If true, only include files with identifiers ### Return Value List of strings, each the absolute path to a denote file. ### Example Usage ```elisp ;; Get all denote files (denote-directory-files) ;; Get files matching pattern, excluding current file (denote-directory-files "work" t) ;; Get only identified files (denote-directory-files nil nil nil nil t) ;; Get files excluding certain pattern (denote-directory-files nil nil nil "archive") ``` ``` -------------------------------- ### Create Note and Insert Link with Command Config (Elisp) Source: https://github.com/protesilaos/denote/blob/main/_autodocs/api-reference/core-commands.md Similar to `denote-link-after-creating`, but utilizes command-specific configuration settings. This is useful when you have distinct configurations for different invocation methods. ```elisp (defun denote-link-after-creating-with-command (&optional title keywords file-type directory date template signature identifier) ) ``` -------------------------------- ### Get Denote Subdirectories Source: https://github.com/protesilaos/denote/blob/main/_autodocs/api-reference/file-operations.md Retrieves a list of all subdirectories within the configured denote directories. Useful for hierarchical organization. ```elisp (let ((subdirs (denote-directory-subdirectories))) (message "Subdirectories: %s" subdirs)) ``` -------------------------------- ### Get All Denote Links from a File Source: https://github.com/protesilaos/denote/blob/main/_autodocs/api-reference/metadata-extraction.md Scans the specified file for all Denote links and returns a list of the target identifiers. ```elisp (defun denote-get-links (file)) ``` ```elisp (let ((links (denote-get-links "/path/to/note.org"))) (dolist (link-id links) (message "Links to: %s" link-id))) ``` -------------------------------- ### Configure Consult Notes Sources Source: https://github.com/protesilaos/denote/blob/main/README.org Set up custom sources for consult-notes to include Denote notes and other directories. This allows M-x consult-notes to list files from specified locations, with optional filtering by prefix. ```emacs-lisp (setq consult-notes-file-dir-sources `(("Denote Notes" ?d ,(denote-directory)) ("Books" ?b "~/Documents/books/"))) ``` -------------------------------- ### denote-file-type Source: https://github.com/protesilaos/denote/blob/main/_autodocs/api-reference/buffer-and-utilities.md Get the file type of a note. Determines the file type of a denote file based on its extension and content. ```APIDOC ## denote-file-type ### Description Get the file type of a note. Determines the file type of a denote file based on its extension and content. ### Parameters #### Path Parameters * None #### Query Parameters * None #### Request Body * None ### Parameters - **file** (string) - Optional - current file - File to check ### Return Value Symbol: `org`, `markdown-yaml`, `markdown-toml`, or `text`. ### Example Usage ```elisp (denote-file-type) ; current buffer (denote-file-type "/path/to/note.org") ;; Returns 'org (denote-file-type "/path/to/note.md") ;; Returns 'markdown-yaml or 'markdown-toml ``` ``` -------------------------------- ### Sort Files by Modification Time (Reverse) Source: https://github.com/protesilaos/denote/blob/main/_autodocs/api-reference/search-and-filtering.md Example of sorting denote files by their last modification time in reverse order. ```elisp ;; Sort by modification time, reverse (denote-sort-files nil 'last-modified t) ``` -------------------------------- ### Format Filename with Components Source: https://github.com/protesilaos/denote/blob/main/_autodocs/api-reference/buffer-and-utilities.md Constructs a complete file path from individual components using denote's naming scheme and the configured component order. Use this to create consistent filenames. ```elisp (defun denote-format-file-name (directory title keywords signature identifier file-type) "Create a complete filename from components.") (denote-format-file-name "~/notes" "My Project" '("work" "important") "v1" "20220630T143000" 'org) ;; Returns "~/notes/20220630T143000==v1==My Project__work_important.org" ``` -------------------------------- ### Configure Denote Settings Source: https://github.com/protesilaos/denote/blob/main/README.org Set up Denote's directory, save buffer behavior, keyword inference, prompts, and rename confirmations. Enable automatic buffer renaming with denote-rename-buffer-mode. ```emacs-lisp (setq denote-directory (expand-file-name "~/Documents/notes/")) (setq denote-save-buffers nil) (setq denote-known-keywords '("emacs" "philosophy" "politics" "economics")) (setq denote-infer-keywords t) (setq denote-sort-keywords t) (setq denote-prompts '(title keywords)) (setq denote-excluded-directories-regexp nil) (setq denote-keywords-to-not-infer-regexp nil) (setq denote-rename-confirmations '(rewrite-front-matter modify-file-name)) ;; Pick dates, where relevant, with Org's advanced interface: (setq denote-date-prompt-use-org-read-date t) ;; Automatically rename Denote buffers using the `denote-rename-buffer-format'. (denote-rename-buffer-mode 1) ``` -------------------------------- ### denote-sort-get-directory-files Source: https://github.com/protesilaos/denote/blob/main/_autodocs/api-reference/buffer-and-utilities.md Returns denote files from the current directory in a format suitable for sorting. This is used to get a sortable list of files. ```APIDOC ## denote-sort-get-directory-files ### Description Returns denote files from current directory in a format suitable for sorting. ### Method Elisp Function Call ### Parameters None. ### Return Value List of file paths. ``` -------------------------------- ### denote-extract-id-from-string Source: https://github.com/protesilaos/denote/blob/main/_autodocs/api-reference/file-operations.md Extracts the identifier from a file path or filename string. This is useful for parsing denote note filenames to get their unique ID. ```APIDOC ## denote-extract-id-from-string ### Description Parses a filename or path and extracts the identifier portion (first component before delimiters). ### Parameters #### Path Parameters - **string** (string) - Required - File path or filename ### Return Value String identifier, or nil if not found. ### Example Usage ```elisp (denote-extract-id-from-string "20220630T143000--my--title__keys.org") ;; Returns "20220630T143000" (denote-extract-id-from-string "/home/user/notes/20220630T143000.org") ;; Returns "20220630T143000" ``` ``` -------------------------------- ### Get all denote directories Source: https://github.com/protesilaos/denote/blob/main/_autodocs/api-reference/file-operations.md Returns the value of `denote-directory` normalized as a list. Useful for functions that need to work with multiple possible directories. ```elisp (defun denote-directories () ``` ```elisp (let ((dirs (denote-directories))) (dolist (dir dirs) (message "Directory: %s" dir))) ``` -------------------------------- ### Get Files for Dired Sorting Source: https://github.com/protesilaos/denote/blob/main/_autodocs/api-reference/search-and-filtering.md Internal helper function to retrieve the list of file paths that will be sorted within the Dired buffer. ```elisp (defun denote-sort-dired--get-files () ``` -------------------------------- ### denote-open-or-create-with-command Source: https://github.com/protesilaos/denote/blob/main/_autodocs/api-reference/core-commands.md Opens an existing note or creates a new one using command-specific prompts for metadata. It is similar to `denote-open-or-create` but leverages custom prompts defined in `denote-commands-for-new-notes`. ```APIDOC ## denote-open-or-create-with-command ### Description Opens an existing note or creates a new one using command-specific prompts for metadata. It is similar to `denote-open-or-create` but leverages custom prompts defined in `denote-commands-for-new-notes`. ### Parameters Same as `denote`. ### Return Value String path to the opened or created note file. ``` -------------------------------- ### Add Function to After New Note Hook Source: https://github.com/protesilaos/denote/blob/main/_autodocs/configuration.md Example of how to add a custom function to the `denote-after-new-note-hook`. This ensures your function runs after each new note is created. ```elisp (add-hook 'denote-after-new-note-hook #'denote-rename-buffer-mode) ``` -------------------------------- ### Example Usage of Denote Current Data Source: https://github.com/protesilaos/denote/blob/main/_autodocs/types.md Illustrates the structure of the denote-current-data variable after creating a note. This shows the type and content of the metadata stored. ```elisp ;; After creating a note with (denote "Title" '("tag1")) denote-current-data ;; => ((title . "Title") ;; (keywords . ("tag1")) ;; (signature . "") ;; (directory . "/home/user/notes/") ;; (date . "2022-06-30 14:30") ;; (id . "20220630T143000") ;; (file-type . org) ;; (template . "")) ``` -------------------------------- ### Configure Denote Directory and Prompts Source: https://github.com/protesilaos/denote/blob/main/_autodocs/00-START-HERE.md Customize the Denote directory and the types of prompts used during note creation. ```elisp (setq denote-directory "~/notes") (setq denote-prompts '(title keywords)) ``` -------------------------------- ### Create Note and Insert Link (Elisp) Source: https://github.com/protesilaos/denote/blob/main/_autodocs/api-reference/core-commands.md Combines note creation with inserting a link to the new note in the current buffer. Use this for a streamlined workflow when you need to immediately reference a newly created note. ```elisp (defun denote-link-after-creating (&optional title keywords file-type directory date template signature identifier) ) ``` ```elisp ;; Create new note and insert link in current buffer (denote-link-after-creating "Related Research") ;; Create in specific directory and link (denote-link-after-creating "Dependency Notes" '("external") 'org "~/notes") ``` -------------------------------- ### Open Dired with Sorted Denote Files Source: https://github.com/protesilaos/denote/blob/main/_autodocs/api-reference/search-and-filtering.md Opens a Dired buffer with denote files pre-sorted. It interactively prompts the user for the sorting component and whether to reverse the order. ```elisp (defun denote-sort-dired () ``` -------------------------------- ### Get File Type Extensions with Encryption Source: https://github.com/protesilaos/denote/blob/main/_autodocs/api-reference/buffer-and-utilities.md Retrieves all file extensions that denote recognizes, including their encrypted variants. This function does not take any parameters. ```elisp (defun denote-file-type-extensions-with-encryption () ``` ```elisp (denote-file-type-extensions-with-encryption) ;; Returns (".org" ".org.gpg" ".org.age" ".md" ".md.gpg" ".md.age" ".txt" ...) ``` -------------------------------- ### Get File Type Extensions Source: https://github.com/protesilaos/denote/blob/main/_autodocs/api-reference/buffer-and-utilities.md Retrieves extensions associated with a specific file type. If no file type is provided, it returns all recognized extensions. ```elisp (defun denote-file-type-extensions (&optional file-type) ``` ```elisp (denote-file-type-extensions 'org) ;; Returns (".org") (denote-file-type-extensions) ;; Returns (".org" ".md" ".txt" ".md") ``` -------------------------------- ### Core Commands Source: https://github.com/protesilaos/denote/blob/main/_autodocs/api-index.md Functions for creating, opening, and linking notes within the Denote system. ```APIDOC ## Note Creation - `denote` — Create a new note - `denote-region` — Create note from buffer region - `denote-open-or-create` — Open existing note or create new - `denote-open-or-create-with-command` — Like above with command-specific prompts - `denote-link-or-create` — Link to existing note or create and link - `denote-link-or-create-with-command` — Like above with command prompts - `denote-link-after-creating` — Create note and insert link - `denote-link-after-creating-with-command` — Like above with command prompts ``` -------------------------------- ### Configure Dired Directories Source: https://github.com/protesilaos/denote/blob/main/_autodocs/configuration.md Define the list of directories that Denote should consider for Dired operations. Ensure this list accurately reflects your note-taking structure. ```elisp (defcustom denote-dired-directories (if (listp denote-directory) denote-directory (list denote-directory)) :type '(repeat directory)) ``` -------------------------------- ### Get Relative Path by ID Source: https://github.com/protesilaos/denote/blob/main/_autodocs/api-reference/file-operations.md Retrieves the relative path to a note file based on its identifier. Specify a reference directory for the relative path calculation. ```elisp (defun denote-get-relative-path-by-id (id &optional directory) "" (interactive "sID: ") (let ((note (denote-get-note id)) (dir (or directory denote-directory))) (when note (let ((path (file-name-relative-to (denote-note-path note) dir))) (if (string-empty-p path) (denote-note-filename note) path))))) ``` ```elisp (denote-get-relative-path-by-id "20220630T143000" "~/notes") ``` -------------------------------- ### Get File Type of a Note Source: https://github.com/protesilaos/denote/blob/main/_autodocs/api-reference/buffer-and-utilities.md Determines the file type of a denote file based on its extension and content. Call with no arguments to check the current buffer. ```elisp (defun denote-file-type (&optional file) ) ``` ```elisp (denote-file-type) ; current buffer (denote-file-type "/path/to/note.org") ;; Returns 'org (denote-file-type "/path/to/note.md") ;; Returns 'markdown-yaml or 'markdown-toml ``` -------------------------------- ### Define New Note Commands Source: https://github.com/protesilaos/denote/blob/main/_autodocs/configuration.md Configures the list of functions used to create new notes. This allows for consistent prompting across different note creation commands. ```elisp (defcustom denote-commands-for-new-notes '(denote denote-region) :type '(repeat function)) ```