Compare commits

...

437 commits
4.0.0 ... main

Author SHA1 Message Date
Protesilaos 110ced9999
Acknowledge kimsaram32 for commit 840ca21
This was done in pull request 728: <https://github.com/protesilaos/denote/pull/728>.
The change is small, meaning that its author does not need to assign
copyright to the Free Software Foundation.
2026-09-09 14:37:04 +03:00
Protesilaos 32d83aa68b
Merge pull request #728 from kimsaram32/docs-remove-obsolete-functions
Remove obsolete functions in the documentation
2026-09-09 14:35:59 +03:00
kimsaram32 840ca21f92 Remove obsolete functions in the documentation 2026-09-09 19:31:13 +09:00
Protesilaos 0a157981e5
Rename a helper function to be private and have a more accurate name
Also tweak its docstring.
2026-08-28 16:40:30 +03:00
Protesilaos 2c8cf137ac
Fix typo in the manual
Thanks to Ali Bozorgzadeh for reporting it in issue 727:
<https://github.com/protesilaos/denote/issues/727>.
2026-08-27 17:38:03 +03:00
Protesilaos e401e70405
Merge pull request #726 from jeanphilippegg/move-unix-timestamps-code
Move Unix timestamps code in `denote-valid-date-p`
2026-08-24 12:35:53 +03:00
Jean-Philippe Gagné Guay ec73303bff Move Unix timestamps code in denote-valid-date-p 2026-08-23 21:38:04 -04:00
Protesilaos 42085330f3
Update the :package-version of denote-org-store-link-to-heading
This is because it now has a new option, per commit b90b26e (pull
request 723 by Michael Korat: <https://github.com/protesilaos/denote/pull/723>).
2026-08-23 13:33:39 +03:00
Protesilaos 27cdd67b68
Document denote-org-store-link-to-heading "local" value in the manual
This was introduced by Michael Korat in commit 9a354e4 as part of pull
request 723: <https://github.com/protesilaos/denote/pull/723>.
2026-08-23 13:31:39 +03:00
Protesilaos b90b26e938
Acknowledge Michael Korat for commit 9a354e4
This was done in pull request 723: <https://github.com/protesilaos/denote/pull/723>.
The change is small, meaning that Michael does not need to assign
copyright to the Free Software Foundation.
2026-08-23 13:06:01 +03:00
Protesilaos 5effab91ca
Merge pull request #723 from mkorat/main
Add option to use simple heading links to denote-link-ol-store.
2026-08-23 13:05:08 +03:00
Protesilaos 9ae9d0e1ea
Make stylistic change to denote--date-parse-string
The original was contributed by Jeff Valk in commit 9083ad7, pull
request 722: <https://github.com/protesilaos/denote/pull/722>.
2026-08-10 11:38:16 +03:00
Protesilaos 8f7e988a67
Acknowledge Jeff Valk for commit 9083ad7
This was done in pull request 722: <https://github.com/protesilaos/denote/pull/722>.
The change is small, meaning that Jeff does not need to assign
copyright to the Free Software Foundation.
2026-08-10 11:30:39 +03:00
Protesilaos 7d0c06e0a4
Merge pull request #722 from jeffvalk/main
Support Unix timestamps in date input
2026-08-10 11:29:47 +03:00
Michael Korat 9a354e4362 Add option to use simple heading links to denote-link-ol-store. 2026-08-09 20:58:32 +02:00
Jeff Valk 9083ad781e Support Unix timestamps in date input
This allows for other recognized date patterns to be supported as well.
2026-07-31 12:20:10 -04:00
Protesilaos 3718a60305
Make denote-query-focus-last-search reuse the existing query buffer 2026-07-29 13:05:00 +03:00
Protesilaos 5b632ae958
Make denote-query-* commands work as intended in the backlinks buffer
Thanks to 82Kang for reporting the bug in issue 695:
<https://github.com/protesilaos/denote/issues/695>.
2026-07-29 13:04:16 +03:00
Protesilaos b4978d83cb
Make denote-link--collect-identifiers remove duplicates
Thanks to 82Kang for reporting the bug in issue 694:
<https://github.com/protesilaos/denote/issues/694>.
2026-07-29 12:55:45 +03:00
Protesilaos c8aa01c56a
Add denote-slug-remove-accents function
This is based on the code originally written by Jean-Philippe Gagné
Guay in issue 603: <https://github.com/protesilaos/denote/issues/603#issuecomment-2869702877>.
I made stylistic changes to it to make it fit with the rest of denote.el.

I am adding this in response to issue 603 and 718:

- <https://github.com/protesilaos/denote/issues/603> with
  participation from Davi Ramos and Jean-Philippe Gagné Guay;
- <https://github.com/protesilaos/denote/issues/718> with
  participation from o-rxw and Alan Schmitt.

In implementing this, I am changing my mind that this is purely a
documentation issue. I realised it is better for us to have the main
function in denote.el, so that we can test it better.
2026-07-27 19:53:13 +03:00
Protesilaos 1004f735b7
Mention the SIGNATURE in the docstring of all front matter variables
Thanks to Alan Schmitt for telling me this was missing. It was done in
issue 714: <https://github.com/protesilaos/denote/issues/714>.
2026-07-07 22:56:49 +03:00
Protesilaos 65f1bbf1de
Acknowledge Pavlo V. Lysov for commit 72d90f4
This is about mentioning Pavlo's 'denote-solo' package in the Denote
manual.

Done in pull request 713: <https://github.com/protesilaos/denote/pull/713>.
2026-07-06 10:31:07 +03:00
Protesilaos 8c80d91d06
Merge pull request #713 from pavlo/main
Add a section for denote-solo package
2026-07-06 10:28:12 +03:00
Pavlo V. Lysov 72d90f474e Add a section for denote-solo package 2026-07-06 08:49:53 +03:00
Protesilaos cd422b1d22
Acknowledge Matthieu Muller for commit 35d3a2a
This was done in pull request 711: <https://github.com/protesilaos/denote/pull/711>.
The change is small, menaing that Matthieu does not need to assign
copyright to the Free Software Foundation.
2026-06-11 21:41:01 +03:00
Protesilaos 04c39a157f
Merge pull request #711 from matthieumuller/add-denote-paperless-to-docs
Add a section on denote-paperless.el in the documentation
2026-06-11 21:39:34 +03:00
Matthieu MULLER 35d3a2a724 Add a section on denote-paperless.el in the documentation 2026-06-11 14:12:31 -04:00
Protesilaos 9fd6692a32
Bump version number to trigger GNU ELPA package rebuild to include commit 420710f 2026-05-27 20:30:00 +03:00
Protesilaos 420710fb17
Ensure :get-file-type-function is called only when file exists
Otherwise we get an error upon creating the file.

Thanks to potchie-maker for reporting the bug in issue 709:
<https://github.com/protesilaos/denote/issues/709>.
2026-05-27 20:28:38 +03:00
Protesilaos 77813e9956
Bump version number to trigger GNU ELPA rebuild
I am bumping it straight to 4.2.2 because I had a tag earlier for
4.2.1 even though I forgot to update this header...
2026-05-23 23:15:15 +03:00
Protesilaos cf1c81cba9
Make stylistic tweak to denote-file-prompt--format-identifier 2026-05-23 23:12:49 +03:00
Protesilaos 32960f828b
Acknowledge Marco Baringer for commits d47464e, 6ba2097
Those were sent as part of pull request 708: <https://github.com/protesilaos/denote/pull/708>.

The changes are small, meaning that Marco does not need to assign
copyright to the Free Software Foundation.
2026-05-23 23:10:04 +03:00
Protesilaos 197b0acd38
Merge pull request #708 from segv/main
denote-open-or-create errors in directories with oddly-named files (#707)
2026-05-23 23:09:24 +03:00
Marco Baringer d47464e23b
Require non-empty captures in the four field regexps
denote-{identifier,signature,title,keywords}-regexp used a lazy
zero-or-more capture ([^.]*?), so they matched the bare separator
followed by an extension, e.g. __.js, --.org, ==.org, @@.org. Combined
with denote-file-has-denoted-filename-p, this meant such files were
treated as valid denote notes. lodash's node_modules ships __.js files,
which made a denote-directory containing a lodash checkout enumerate
junk candidates in the file prompt (and previously crash, see preceding
commit).

Switch to a non-empty lazy capture ([^.]+?) so the field must contain at
least one character.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
2026-05-23 16:20:49 +02:00
Marco Baringer 6ba209704d
Fix file-prompt crash when denote-directory contains files like __.js
Using denote in a directory that includes files matching '*/__.js'
breaks with "Wrong type argument: stringp, nil" on the file prompt.
lodash ships such files in node_modules, so accidentally pointing
denote at a lodash checkout (or having one under denote-directory)
triggers the error.

These files pass denote-file-has-denoted-filename-p because the empty
keywords section matches denote-keywords-regexp, but they have no
identifier, so denote-file-prompt--format-identifier passed nil to
propertize during affixation. Return nil in that case;
denote-file-prompt-affixate already substitutes "" for a nil prefix.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
2026-05-23 16:17:47 +02:00
Protesilaos 30c0d6536e
Be precise in the denote-file-prompt-extra-metadata docstring 2026-05-21 20:09:22 +03:00
Protesilaos 13b2164369
Update to Denote version 4.2.0 2026-05-20 15:41:08 +03:00
Protesilaos e40bdc8cdc
Remove spacing in denote--get-front-matter-rewrite-prompt 2026-05-20 15:24:30 +03:00
Protesilaos 3ef7380190
Remove the denote-sort-dired-focus alias
I want to reach a point where only denote-dired and related are used.
Maybe this is more appropriate for the next major version, but I can
do it here since this is a new command.
2026-05-20 12:37:13 +03:00
Protesilaos ea398e9a2a
Throw a user-error if denote-dired-focus is called in a Dired buffer without prior denote-dired 2026-05-20 12:35:57 +03:00
Protesilaos dbfe4b189a
Remove faulty 'or' from denote--dir-in-denote-directory-p
Thanks to Jean-Philippe Gagné Guay for pointing out the problem with
it in a comment to issue 705:
<https://github.com/protesilaos/denote/issues/705#issuecomment-4436808008>.
2026-05-13 11:12:45 +03:00
Protesilaos 3f5ede71d4
Reindent denote-valid-date-p 2026-05-12 13:26:37 +03:00
Protesilaos 1aedcff2d7
Make stylistic tweaks to denote--prepare-note 2026-05-12 13:25:01 +03:00
Protesilaos 59eea50d4b
Reindent denote--valid-file-type 2026-05-12 13:22:35 +03:00
Protesilaos 21b1c81d1a
Make denote--dir-in-denote-directory-p more robust
This is in response to a bug reported by Kevin Izevbigie in issue 705:
<https://github.com/protesilaos/denote/issues/705>.
2026-05-12 13:18:27 +03:00
Protesilaos d7dab477a1
Document the denote-lint package 2026-05-01 18:56:52 +03:00
Protesilaos 0ff9573362
Make stylistic refinements to the helpers introduced in 8e6d83c
I was testing them and was too eager to commit before refining them.
Will need to write tests eventually, but I do not have time right now.
2026-05-01 18:48:34 +03:00
Protesilaos 8e6d83c652
Make rename commands not interfere with existing front matter indentation
This is to address the comment posted by Morten Kjeldgaard in issue
703: <https://github.com/protesilaos/denote/issues/703>.
2026-05-01 18:40:39 +03:00
Protesilaos 06c520de36
Do for the keyword include/exclude commands the same as commit 9b8c96f 2026-04-28 23:31:03 +03:00
Protesilaos 9b8c96f5e8
Redefine denote-query-only-include-files and denote-query-exclude-files to use helper function
The macro we had before was okay, but this feels easier to reason about.
2026-04-28 23:27:03 +03:00
Protesilaos d78ad3f74e
Make denote-link-ol-store work in org-capture as well
This affects the org-capture specifiers that create a link such as %a
and %l.

Thanks to jarofromel for bringing this matter to my attention in
discussion 702: <https://github.com/protesilaos/denote/discussions/702>.
2026-04-28 22:56:36 +03:00
Protesilaos 8112e65bc3
Acknowledge nescias for commit c772378
This was sent to me as a patch via email. The change is small, meaning
that its author does not need to assign copyright the Free Software
Foundation.
2026-04-28 18:47:30 +03:00
nescias c7723784b9
Fix typos in documentation 2026-04-28 17:24:36 +03:00
Protesilaos b5be053380
Document the ~denote-wordcloud package 2026-04-27 23:16:11 +03:00
Protesilaos f113e49988
Document the denote-sections package by Samuel W. Flint
Thanks to Samuel for bringing this matter to my attenion in issue 701:
<https://github.com/protesilaos/denote/issues/701>.
2026-04-27 22:47:57 +03:00
Protesilaos 3cd8d47c00
Document the denote-regexp package by Samuel W. Flint
Thanks to Samuel for bringing this matter to my attenion in issue 701:
<https://github.com/protesilaos/denote/issues/701>.
2026-04-27 22:45:51 +03:00
Protesilaos 348d851eb4
Document the denote-project-notes package by Samuel W. Flint
Thanks to Samuel for bringing this matter to my attenion in issue 701:
<https://github.com/protesilaos/denote/issues/701>.
2026-04-27 22:36:42 +03:00
Protesilaos 7babe195ee
Document the denote-agenda package by Samuel W. Flint
Thanks to Samuel for bringing this matter to my attenion in issue 701:
<https://github.com/protesilaos/denote/issues/701>.
2026-04-27 22:32:25 +03:00
Protesilaos aedbb0cecd
Document the denote-journal-capture package by Samuel W. Flint
Thanks to Samuel for bringing this matter to my attenion in issue 701:
<https://github.com/protesilaos/denote/issues/701>.
2026-04-27 22:25:58 +03:00
Protesilaos 97ffb56320
Use "Protesilaos" instead of "Protesilaos Stavrou"
As I announced here: <https://protesilaos.com/news/2026-04-21-omitting-the-surname/>.
2026-04-24 13:26:01 +03:00
Protesilaos 7574b8cecd
Document in the manual the functions to get the file type for YAML and TOML 2026-04-23 21:25:34 +03:00
Protesilaos 29fd39a4d4
Make sure the denote-file-type function is registered in the function index 2026-04-23 21:25:14 +03:00
Protesilaos 87a4a02afa
Document denote-file-type function in the manual 2026-04-23 21:19:57 +03:00
Protesilaos dd4551ad9c
Rewrite the doc string of denote-file-type 2026-04-23 21:17:20 +03:00
Protesilaos 231d7d64e8
Write a test for denote-file-type 2026-04-23 21:02:08 +03:00
Protesilaos ee1ad314fc
Add :get-file-type-function to the denote-file-type function 2026-04-23 21:01:38 +03:00
Protesilaos 8b9a4e511d
Add a :get-file-type-function to the denote-file-types 2026-04-23 21:00:59 +03:00
Protesilaos 5281b7c3fc
Add a comment related to where denote--title-value-reverse-function is called 2026-04-23 19:55:38 +03:00
Protesilaos 207a365b83
Expand the TODO comment about denote-file-type 2026-04-23 19:30:51 +03:00
Protesilaos 568c807d8d
Add a TODO about denote-file-type 2026-04-23 19:27:16 +03:00
Protesilaos ec4fed24f7
Prevent denote-retrieve-xref-alist-for-backlinks from throwing an error if file type is nil 2026-04-23 19:09:09 +03:00
Protesilaos 383c52be8d
Acknowledge GuutBoy for reporting a bug in denote-markdown
This was done in issue 699: <https://github.com/protesilaos/denote/issues/699>.
2026-04-23 19:07:39 +03:00
Protesilaos Stavrou 5e995cfecc
Acknowledge gnuhack for commit aaa75e7
This was done as part of pull request 697: <https://github.com/protesilaos/denote/pull/697>.
The change is small, repurposing existing code, meaning that the
author does not need to assign copyright to the Free Software Foundation.
2026-04-21 08:38:09 +03:00
Protesilaos Stavrou 59e1304a67
Merge pull request #697 from gnuhack/patch-2
Macro for denote-query-exclude-files and denote-query-only-include-files
2026-04-21 08:37:08 +03:00
gnuhack aaa75e7f13
Macro for denote-query-exclude-files and denote-query-only-include-files
Replaced both functions with a new macro. Created the new functions through the macro.
2026-04-20 12:47:02 +02:00
Protesilaos Stavrou c3b60fcada
Replace "doc string" with "docstring" 2026-04-13 08:41:39 +03:00
Protesilaos Stavrou f6499cbf5c
Merge branch 'main' of github.com:protesilaos/denote 2026-04-09 21:16:03 +03:00
Protesilaos Stavrou 0993df4fbc
Fix typo about "keymap" 2026-04-09 21:11:40 +03:00
Protesilaos Stavrou b77b926505
Merge pull request #696 from gnuhack/patch-1
Fix typo
2026-04-09 08:19:36 +03:00
gnuhack 63c052e1ac
Fix typo 2026-04-09 00:09:56 +02:00
Protesilaos Stavrou 160444b853
Mention denote-dired-focus in the manual and expand its docstring 2026-04-07 12:11:54 +03:00
Protesilaos Stavrou 4483caee95
Update the manual's acknowledgements
This is about the idea behind denote-dired-focus, as discussed in
issue 693: <https://github.com/protesilaos/denote/issues/693>.
2026-04-07 12:03:23 +03:00
Protesilaos Stavrou b4924c853d
Make denote-sort-dired always produce a new buffer
Thanks to 82Kang for telling me about the use-case of maintaining
multiple Denote Dired buffers side-by-side. This is done as part of
issue 693: <https://github.com/protesilaos/denote/issues/693>.
2026-04-07 11:55:38 +03:00
Protesilaos Stavrou e5260315ec
Merge branch 'denote-dired-focus' of github.com:protesilaos/denote into denote-dired-focus 2026-04-07 11:39:37 +03:00
Protesilaos Stavrou 21b8c6d024
Implement prototype of denote-dired-focus
I am doing this in response to a question posted by 82Kang in issue
693: <https://github.com/protesilaos/denote/issues/693>.

We already have similar functionality for the denote-grep (and
related) buffers. This is an opportunity for me to also review all
that.
2026-04-07 11:39:28 +03:00
Protesilaos Stavrou fd4d20b472
Make small stylistic tweaks to denote-grep and a helper function 2026-04-07 11:32:30 +03:00
Protesilaos Stavrou 9dc7420031
Tweak the denote-grep-display-buffer-action documentation 2026-04-07 11:32:13 +03:00
Protesilaos Stavrou beb698f632
Deprecate the denote-grep-history 2026-04-07 11:22:26 +03:00
Protesilaos Stavrou 1058caea0c
Tweak the make-obsolete warnings for the grep prompt and its history 2026-04-07 11:19:46 +03:00
Protesilaos Stavrou dcb3daf81a
Add TODO for denote-grep and friends 2026-04-06 22:59:03 +03:00
Protesilaos Stavrou 3e8c2c835d
Make stylistic changes and minor refinements to the query include/exclude commands 2026-04-06 22:57:54 +03:00
Protesilaos Stavrou 37beb39c3b
Consolidate the query/grep prompts for a REGEXP 2026-04-06 22:57:20 +03:00
Protesilaos Stavrou 5e4b95a1b7
Make stylistic refinements to denote-query-focus-last-search 2026-04-06 22:30:03 +03:00
Protesilaos Stavrou d0252aff0c
Make stylistic refinements to denote-query-prompt 2026-04-06 22:29:51 +03:00
Protesilaos Stavrou 15415e7956
Refine how the prompt for query buffer narrowing is implemented 2026-04-06 22:23:39 +03:00
Protesilaos Stavrou 2dae5773f2
Rewrite the tests in the interest of clarity and expand them where necessary 2026-04-06 21:58:02 +03:00
Protesilaos Stavrou 7b9be290e5
Inhibit denote--regexp-in-file-p error in denote-file-type
In the case where the check returns nil, we want to move to the next
condition, so no need for an error here.
2026-04-06 21:57:15 +03:00
Protesilaos Stavrou acadd80426
Move denote--regexp-in-file-p further up 2026-04-06 21:56:59 +03:00
Protesilaos Stavrou 53bb758384
Rewrite denote-file-has-denoted-filename-p docstring for clarity 2026-04-06 21:56:43 +03:00
Protesilaos Stavrou ded4c50b8c
Make denote-directories--get-paths take an argument and do error checking 2026-04-06 21:56:24 +03:00
Protesilaos Stavrou 9d5711ea50
Update copyright years in denote-test.el 2026-04-06 20:01:49 +03:00
Protesilaos Stavrou 90d84d6501
Implement prototype of denote-dired-focus
I am doing this in response to a question posted by 82Kang in issue
693: <https://github.com/protesilaos/denote/issues/693>.

We already have similar functionality for the denote-grep (and
related) buffers. This is an opportunity for me to also review all
that.
2026-04-06 12:20:58 +03:00
Protesilaos Stavrou 627ed49989
Move denote--user-error-if-not-major-mode further up 2026-04-06 11:48:25 +03:00
Protesilaos Stavrou 75ef0f827a
Make small refinement to denote-sort-dired 2026-04-06 11:17:17 +03:00
Protesilaos Stavrou 8dfadbc085
Split up denote-sort-dired for legibility and fix a bug with revert-buffer 2026-04-06 10:43:04 +03:00
Protesilaos Stavrou 7852585578
Set denote-file-type explicitly to Org
Otherwise, the user will not necessarily get what they want if they
add to the denote-file-types.
2026-04-02 09:56:45 +03:00
Protesilaos Stavrou e6f6111d3d
Ensure denote--act-on-query-link get the buffer of denote-sort-dired 2026-03-24 14:51:55 +02:00
Protesilaos Stavrou 7f92fd4af3
Acknowledge bplubell for commit d8c2488
This was done in pull request 685: <https://github.com/protesilaos/denote/pull/685>
The change is small, meaning that the author does not need to assign
copyright to the Free Software Foundation.
2026-03-19 07:13:07 +02:00
Protesilaos Stavrou d93056137f
In denote-link--prepare-links pass the file-type to denote-get-link-description 2026-03-19 07:12:31 +02:00
Protesilaos Stavrou 6c0fb263c8
Merge pull request #685 from bplubell/fix-follow-markdown-link
Fix error when following non-Denote Markdown links
2026-03-19 07:09:52 +02:00
bplubell d8c2488622 Fix error when following non-Denote Markdown links
When following links in markdown-mode that are to non-Denote resources
like URLs, you would see the error:

    Cannot open ‘nil’ of unknown link type

That is because Denote adds denote-link-markdown-follow to
markdown-follow-link-functions, which eventually calls
denote--act-on-query-link with a nil value.

To solve this, we return nil from denote-link-markdown-follow when we do
not know how to handle the link. That lets markdown-mode try its link
handling. Per the markdown-follow-link-functions documentation, we
should "return non-nil if [we] followed the link, or nil if not."
2026-03-18 15:46:12 -07:00
Protesilaos Stavrou 76c2e27e80
Document how users can have a custom identifier without "T" in it 2026-03-06 19:23:10 +02:00
Protesilaos Stavrou e1d16ba77b
Make stylistic refinements to denote-link-preview-file
We use a similar approach in related functions for the Org link
mechanism.

This builds on top of the contribution of Samuel W. Flint in pull
request 683: <https://github.com/protesilaos/denote/pull/683>.
2026-02-28 22:22:37 +02:00
Protesilaos Stavrou 2ca985d57b
Acknowledge Samuel W. Flint for commit 3d24ea5
The change is small, meaning that Samuel does not need to assign
copyright to the Free Software Foundation.

This change was done in pull request 683: <https://github.com/protesilaos/denote/pull/683>.
2026-02-28 21:31:01 +02:00
Protesilaos Stavrou 6f3649eff4
Merge pull request #683 from swflint/enable-preview
Enable preview of denote links
2026-02-28 21:29:01 +02:00
Protesilaos Stavrou e7478b1627
Simplify how denote-get-link-description checks for function arity
I found func-arity by chance and immediately thought of this. What I
had before was ugly by comparison, even though its idea made sense.
2026-02-28 21:16:40 +02:00
Samuel W. Flint 3d24ea54eb Enable preview of denote links
Preview will only happen if there is one file with the denote ID/path,
and will work with any format supported by `org-link-preview-file`.
2026-02-24 10:13:06 -06:00
Protesilaos Stavrou 9f5a16f625
Tweak how denote--get-common-root-directory checks absolute paths to also work on Windows
I do not have a Windows machine to test this, though it seems
reasonable. I am doing this in response to issue 682 by Pratik-Mishra-497:
<https://github.com/protesilaos/denote/issues/682>.
2026-02-23 17:50:39 +02:00
Protesilaos Stavrou da0685d48d
Expand the manual with how to auto-encrypt new notes with a custom file type
I did this in response to issue 681 by Michael Jones:
<https://github.com/protesilaos/denote/issues/681>.
2026-02-13 13:52:34 +02:00
Protesilaos Stavrou e5d5a4f2d9
Clarify that denote-sequence is its own package
It used to be part of denote.git, but I moved it to its own repository.
2026-02-07 16:09:15 +02:00
Protesilaos Stavrou 2a542e20ff
Link to a more specific section in the manual about "-with-command" commands 2026-01-23 09:30:43 +02:00
Protesilaos Stavrou 3af6cbeb39
Mention denote-link-or-create-with-command in the manual
Thanks to Matthew Batson for the contribution in pull request 674:
<https://github.com/protesilaos/denote/pull/674>.

Matthew has assigned copyright to the Free Software Foundation.
2026-01-23 09:29:27 +02:00
Protesilaos Stavrou 0db5c56a8d
Adjust the spaces in denote-link-or-create-with-command
Thanks to Matthew Batson for the contribution in pull request 674:
<https://github.com/protesilaos/denote/pull/674>.

Matthew has assigned copyright to the Free Software Foundation.
2026-01-23 09:25:06 +02:00
Protesilaos Stavrou 8a573f8247
Merge pull request #674 from mbatson/add-denote-link-or-create-with-command
[Feature Proposal] Add denote-link-or-create-with-command
2026-01-23 09:20:43 +02:00
Protesilaos Stavrou 7b5fb18fab
Acknowledge gvalson for commit 9a9f71d
This was done in pull request 676: <https://github.com/protesilaos/denote/pull/676>.

The change is small, meaning that gvalson does not need to assign
copyright to the Free Software Foundation.
2026-01-23 08:52:03 +02:00
Protesilaos Stavrou 9f70a619db
Merge pull request #676 from gvalson/main
Add reference to the mir package in the manual
2026-01-23 08:50:19 +02:00
gvalson 9a9f71d109 Add reference to the mir package in the manual 2026-01-22 20:22:51 -05:00
Matthew Batson 51cbb47311 Add denote-link-or-create-with-command to the menu bar
The code in this commit was originally written by Protesilaos Stavrou
in commit 69391aa.
2026-01-21 18:38:59 +11:00
Matthew Batson 6ffa6881ce Add denote-link-or-create-with-command 2026-01-21 17:13:11 +11:00
Protesilaos Stavrou e9c44eec58
Use insert-buffer-substring instead of insert-buffer in denote--file-with-temp-buffer
The function insert-buffer is meant to be for interactive use only.

This follows the change made by duli in commit 0f71f12 via pull
request 672: <https://github.com/protesilaos/denote/pull/672>. The
author of the original change has assigned copyright to the Free
Software Foundation.

Also thanks to Jean-Philippe Gagné Guay for reviewing the change and
for reporting a problem with an earlier version of the code in issue
670: <https://github.com/protesilaos/denote/issues/670>.
2026-01-18 09:08:27 +02:00
Protesilaos Stavrou 927c862685
Reword the doc string of denote--file-with-temp-buffer
This follows the change made by duli in commit 0f71f12 via pull
request 672: <https://github.com/protesilaos/denote/pull/672>. The
author of the original change has assigned copyright to the Free
Software Foundation.

Also thanks to Jean-Philippe Gagné Guay for reviewing the change and
for reporting a problem with an earlier version of the code in issue
670: <https://github.com/protesilaos/denote/issues/670>.
2026-01-18 09:03:39 +02:00
Protesilaos Stavrou 159134fee1
Merge pull request #672 from kilesduli/fix-file-not-saved-but-need-rename
Fix front-matter retrieving when buffer is unsaved or file missing
2026-01-18 09:01:53 +02:00
duli 0f71f126cc
Fix front-matter retrieving when buffer is unsaved or file missing
This addresses a regression where
'denote-rename-file-using-front-matter' would fail to recognize changes
in an unsaved buffer, or fail entirely if the file had not yet been
created on disk (as described in
https://github.com/protesilaos/denote/pull/670).

The logic now consistently prioritizes the content of an open buffer
over the file on disk. Previously, the code would revert to reading the
file if the buffer was marked as modified; however, since we cannot
reliably detect if a modification affects the front-matter, it is safe
to always use the live buffer state.

* (denote--file-with-temp-buffer-subr): Remove.
(denote--file-with-temp-buffer): Refactor to prioritize buffer content
and remove the dependency on the internal subr.

Fixes: https://github.com/protesilaos/denote/pull/670
2026-01-17 23:17:14 +08:00
Protesilaos Stavrou 3563d2b3fe
Acknowledge Matthew Batson for commit a31969f
The change is small, meaning that Matthew does not need to assign
copyright to the Free Software Foundation.
2026-01-17 07:18:53 +02:00
Protesilaos Stavrou 7649f42c88
Merge pull request #671 from mbatson/fix-denote-query-extract-title-docstring
Fix docstring of denote-query-extract-title
2026-01-17 07:15:31 +02:00
Matthew Batson a31969fea2 Fix docstring of denote-query-extract-title
Docstring says function returns denote-grep-untitled-string, but it
actually returns denote-query-untitled-string. This commit corrects
the name of the variable in the docstring.
2026-01-17 14:56:52 +11:00
Protesilaos Stavrou 07dcaeebb9
Merge pull request #666 from kilesduli/refactor-denote-sort-dired
Refactor denote-sort-dired and remove the helper function
2026-01-15 08:56:50 +02:00
Protesilaos Stavrou bcbc805f4f
Fix typo in latest commit 1d1732f 2026-01-14 20:57:23 +02:00
Protesilaos Stavrou 1d1732fb57
Acknowledge duilkiles for commits 8a88fcd, e9e8f6f
The author has assigned copyright to the Free Software Foundation.
2026-01-14 20:54:06 +02:00
Protesilaos Stavrou eaedec7463
Merge pull request #669 from kilesduli/fix-input-gpg-password-too-many-times
Fix denote--define-retrieve-front-matter not reusing opened buffer
2026-01-14 20:52:01 +02:00
Protesilaos Stavrou 7ab5f4e9b5
Merge pull request #668 from kilesduli/make-rename-buffer-check-early
Make rename buffer check early
2026-01-14 20:31:38 +02:00
duli 8a88fcde81
Fix denote--define-retrieve-front-matter not reusing opened buffer
In earlier commits, `denote-rename-buffer' could open the same file
multiple times when retrieving front matter, as described in
https://github.com/protesilaos/denote/issues/652 .

This occurred because the subroutine `denote--file-with-temp-buffer-subr',
used in the definition of `denote--define-retrieve-front-matter',
contained incorrect conditional logic. As a result, files were reopened
instead of reusing already opened buffers.

Fixes: https://github.com/protesilaos/denote/issues/652

* (denote--file-with-temp-buffer-subr):
2026-01-15 00:23:23 +08:00
duli e9e8f6f91e
Make rename buffer check early
When users customize `denote-rename-buffer-function' without checking
whether the current buffer is a Denote buffer, `find-file-hook' may
trigger unintended renames.

Because `denote-rename-buffer' accepts an optional buffer argument, the
Denote buffer check must be performed twice.

* (denote-rename-buffer-rename-function-or-fallback):
2026-01-14 21:52:03 +08:00
duli b92f185818
Refactor denote-sort-dired and remove the helper function
This function is extremely slow because calling (dired (cons directory
files)) triggers ls for every file. When there are a large number of
files, The `call-process' becomes expensive. There is no other way to
change this behavior in dired. We should use Emacs’s built-in ls
implementation (ls-lisp). On my machine, with around 200 files, this
reduces execution time by about 6x.

Additionally, prepare-buffer seems unnecessary. It is a private
function (indicated by the double dash) and is not intended for user
access or other use cases. It calls files-fn twice, which is redundant.
We should instead set the revert-function directly in a single function
to make its purpose explicit.

* (denote-sort-dired): refactor
* (denote-sort-dired--prepare-buffer): remove
2026-01-14 20:30:09 +08:00
Protesilaos Stavrou 47207e9cb2
Add missing part from commit c94a848 2026-01-14 09:44:22 +02:00
Protesilaos Stavrou c94a8484ca
Use let* instead of needless when-let* in one instance 2026-01-14 09:43:22 +02:00
Protesilaos Stavrou 23e1e8642b
Tweak the denote--get-common-root-directory error check 2026-01-14 09:37:18 +02:00
Protesilaos Stavrou 1786ebcd0f
Make two stylistic changes to denote--get-common-root-directory 2026-01-14 09:36:08 +02:00
Protesilaos Stavrou d90f3633de
Rewrite denote--get-common-root-directory and include a test for it 2026-01-14 09:19:34 +02:00
Protesilaos Stavrou 0afdc6af14
Acknowledge Matto Fransen for commit b9ff7e6
The change is small which means that Matto does not need to assign
copyright to the Free Software Foundation.
2026-01-12 22:49:32 +02:00
Matto Fransen b9ff7e6617
Add reference to denote-review package in the manual 2026-01-12 22:48:49 +02:00
Protesilaos Stavrou 301575c318
Add another condition to denote-file-type to fall back to user's preferred file type 2026-01-11 19:06:39 +02:00
Protesilaos Stavrou a0b834f53b
Update copyright years 2026-01-11 11:30:27 +02:00
Protesilaos Stavrou 0a076981a9
Acknowledge Alvin Hsu for commit 46c49e5
This was done in pull request 664: <https://github.com/protesilaos/denote/pull/664>.
The change is small, meaning that Alvin does not need to assign
copyright to the Free Software Foundation,
2026-01-09 10:03:47 +02:00
Protesilaos Stavrou 89875abad6
Merge pull request #664 from aurtzy/fix-denote-sort-dired
Fix error in denote-sort-dired when regexp is a subdirectory
2026-01-09 10:01:36 +02:00
Alvin Hsu 46c49e51ee Fix error in denote-sort-dired when regexp is a subdirectory
In the DIRNAME list argument to `dired', the first element is treated as a
directory name, with the rest being file paths relative to that directory.
`dired' appears to fall back to the parent directory when DIRED-NAME does not
match any subdirectory, resulting in expected correct behavior; however, when
there is a matched directory, it will attempt to search for files relative to
that directory instead, which may result in file-not-found errors.

Thus, we remove and replace DIRED-NAME such that we always use the directory
that the files are supposed to be relative to.

Fixes: #662
2026-01-08 20:59:31 +08:00
Protesilaos Stavrou 9e02bf4bd0
Merge pull request #661 from jeanphilippegg/directories-parameter
Fix #654
2026-01-08 07:43:28 +02:00
Jean-Philippe Gagné Guay 786c86f567 Add denote--get-file-name-relative-to-directories 2026-01-04 19:42:08 -05:00
Jean-Philippe Gagné Guay 65255f46df Make denote-directory-get-files private 2026-01-04 19:18:04 -05:00
Jean-Philippe Gagné Guay b8be7d7bf0 Remove directories parameter from some functions 2026-01-04 19:17:55 -05:00
Protesilaos Stavrou cf2a6b082b
BREAKING: make denote-fontify-links-mode only work in plain text
Check what I am doing in denote-fontify-links-mode to make it work
only in some places and to work around the default behaviour of
toggling a minor mode interactively.
2026-01-03 08:33:48 +02:00
Protesilaos Stavrou 40192c9fcc
Rename the keymap used by denote-fontify-links-mode 2026-01-03 08:33:48 +02:00
Protesilaos Stavrou dc50c92ac8
Expand the doc string of denote-fontify-links-mode 2026-01-03 08:33:48 +02:00
Protesilaos Stavrou 2d83bf12a3
Make denote-fontify-links-mode-maybe also cover markdown-mode
This is because of commit 72e3c01, which makes Markdown mode buffers
work with all Denote links (direct links and query links).
2026-01-03 08:33:48 +02:00
Protesilaos Stavrou 3a66793dd0
Add alias for denote-add-links 2026-01-03 08:33:48 +02:00
Protesilaos Stavrou d8cd571f91
Clarify the doc string of denote-add-links 2026-01-03 08:33:48 +02:00
Protesilaos Stavrou d16465816e
Mention the link to contents in denote-add-links 2026-01-03 08:33:48 +02:00
Protesilaos Stavrou f55b84317a
Mention the link to contents command in the "Getting started with Denote" 2026-01-03 08:33:48 +02:00
Protesilaos Stavrou 730d3d9734
Reword doc string of denote--command-with-features
Just so that it is imperative.
2026-01-03 08:33:48 +02:00
Protesilaos Stavrou b42fc5fea4
Fix error with nil values for the affix function
When the helpers there return nil I am getting an error because the
completion expects a string.
2026-01-02 11:18:31 +02:00
Protesilaos Stavrou 9b907d5457
Acknowledge alvmts for commit 7f91907
This was done in pull request 658: <https://github.com/protesilaos/denote/pull/658>.
The change is small, meaning that alvmts does not need to assign
copyright to the Free Software Foundation.
2026-01-02 08:25:04 +02:00
Protesilaos Stavrou 2aacd8f90d
Merge pull request #658 from alvmts/alvmts-patch-1
Fix trimming of Org links in `denote-link-ol-follow'
2026-01-02 08:23:54 +02:00
alvmts 7f91907a79
Simplify regexp in `denote-link-ol-follow' 2026-01-01 02:10:43 -05:00
alvmts 54494edf5a
Fix trimming of Org links in `denote-link-ol-follow'
This patch makes it so only search options in Org links get trimmed when checking whether the linked file exists.

The old regex erroneously truncates filenames containing a single colon, so "/tmp/foo:bar/file.ext" becomes "/tmp/foo".
2026-01-01 01:39:22 -05:00
Protesilaos Stavrou a576d8917c
Clarify that denote-org-capture-with-prompts SIGNATURE is part of the current development target 2025-12-29 07:39:49 +02:00
Protesilaos Stavrou 06cc35ab80
Fix wrapping in commit 1c3f404 and acknowledge Tobias Lidman-Strauss for it
The commit was done in merge request 2 on the GitLab mirror:
<https://gitlab.com/protesilaos/denote/-/merge_requests/2>.
2025-12-28 08:43:46 +02:00
Protesilaos Stavrou e3a363f367 Merge branch 'drostan-main-patch-47068' into 'main'
Function denote-org-capture-with-prompts updated to accept signature prompt (new try)

See merge request protesilaos/denote!2
2025-12-28 08:39:22 +02:00
Tobias Lidman-Strauss 1c3f4042f9 Function denote-org-capture-with-prompts updated to accept signature prompt (new try) 2025-12-28 08:39:22 +02:00
Protesilaos Stavrou 1d0b6fb5d4
Reimplement commit be6e713 without removing HAS-IDENTIFIER from denote-directory-files
Thanks to Jean-Philippe Gagné Guay for reminding me that
HAS-IDENTIFIER is for use-cases we support. This was done in issue
655: <https://github.com/protesilaos/denote/issues/655>
2025-12-28 08:10:09 +02:00
Protesilaos Stavrou bea7718049
Revert "REMOVE the has-identifier from denote-directory-files and make obsolete denote-directory-get-files-function"
This reverts commit be6e713d88.

Thanks to Jean-Philippe Gagné Guay for reminding me that this change
breaks some of the use-cases we support. This was done in issue 655:
<https://github.com/protesilaos/denote/issues/655>
2025-12-28 07:49:09 +02:00
Protesilaos Stavrou be6e713d88
REMOVE the has-identifier from denote-directory-files and make obsolete denote-directory-get-files-function
This was making things too complex for our purposes. Users who need to
do something else should write an advice for this function.

I am also adding an optional DIRECTORIES parameter in the spirit of
commit 5203bc0.
2025-12-22 06:59:43 +02:00
Protesilaos Stavrou 5203bc00cf
Ensure that denote-directories is not computed multiple times 2025-12-22 06:41:04 +02:00
Protesilaos Stavrou 916dde6ba7
Throw error if denote-get-file-name-relative-to-denote-directory FILE is not absolute 2025-12-22 05:47:53 +02:00
Protesilaos Stavrou 6751c1b999
Use file prompt metadata for denote-select-from-files-prompt as well 2025-12-22 05:24:59 +02:00
Protesilaos Stavrou 0dfaf46a68
Make affixation for file prompt also cover custom identifiers and signatures 2025-12-22 05:18:55 +02:00
Protesilaos Stavrou 09a382fc46
Add FIXME about the group-function breaking the completion highlight of match visible words
I cannot tell why this is happening. Will need to investigate further.
I thought it might have to do with 'denote-retrieve-filename-title'
changing the match data. But the problem persists even if I put a
regular string in its case which is also found in the completion
candidates I am testing it against.
2025-12-16 17:55:51 +02:00
Protesilaos Stavrou badafe9782
Simplify the denote-file-prompt group-function 2025-12-16 17:54:24 +02:00
Protesilaos Stavrou f6243f1ecb
Make stylistic change to an if-let in denote-file-prompt-group 2025-12-16 09:25:32 +02:00
Protesilaos Stavrou fde5e924fc
Tone down the directory component (see commit cdfffba) 2025-12-16 08:47:06 +02:00
Protesilaos Stavrou cdfffbaeaa
Account for subdirs in denote-file-prompt-group function 2025-12-16 08:45:10 +02:00
Protesilaos Stavrou 5f082c5a07
Use as Commentary what I have in the README.md and on my website 2025-12-16 07:37:35 +02:00
Protesilaos Stavrou 75c75a90e3
Use 'denote-file' completion category and make icons' packages know about it 2025-12-16 06:30:22 +02:00
Protesilaos Stavrou ce86684870
Avoid calling the denote-directories twice when single-dir-p is relevant 2025-12-15 18:23:49 +02:00
Protesilaos Stavrou 1064cc2f38
Make stylistic change to denote-sort-component-prompt 2025-12-15 09:52:11 +02:00
Protesilaos Stavrou bc5f10d963
Use completion table for denote-command-prompt 2025-12-15 09:51:59 +02:00
Protesilaos Stavrou 8ea5ac5cd9
Expand the completion metadata of the denote-file-prompt 2025-12-15 09:51:17 +02:00
Protesilaos Stavrou cc83feb3ba
Include denote-rename-file-identifier in the manual
Thanks to jarofromel for telling me about its absence in issue 646:
<https://github.com/protesilaos/denote/issues/646>.
2025-12-14 09:29:22 +02:00
Protesilaos Stavrou f7e6f4d442
Define group function and display-sort-function for denote-file-prompt 2025-12-14 09:12:29 +02:00
Protesilaos Stavrou ee0685ccc7
Rewrite the denote-subdirectory-prompt and add relevant comments 2025-12-14 08:07:56 +02:00
Protesilaos Stavrou d9537e2c9d
Add FIXME about denote-get-file-name-relative-to-denote-directory 2025-12-14 08:07:44 +02:00
Protesilaos Stavrou d9ecf5a988
Add optional DIRECTORIES to denote-directory-subdirectories and relevant FIXME 2025-12-14 08:04:45 +02:00
Protesilaos Stavrou a2476e9ac7
Add FIXME comment about denote-directory-get-files 2025-12-14 08:02:57 +02:00
Protesilaos Stavrou 7cc62eb5fb
Make denote--directory-all-files-recursively accept DIRECTORIES and add FIXME about it 2025-12-14 08:01:43 +02:00
Protesilaos Stavrou 68a5c712d5
Add optional DIRECTORIES to denote-directories-get-common-root 2025-12-14 07:59:50 +02:00
Protesilaos Stavrou 4fe3cf165e
Define denote-get-completion-table and use it 2025-12-14 07:18:09 +02:00
Protesilaos Stavrou 220644d97c
Add missing reference to denote-query-format-heading-function in the manual 2025-12-13 05:26:17 +02:00
Protesilaos Stavrou 72e3c01a7b
Change how we integrate with markdown-follow-link-functions and explain why
I hope this does not comes back to bite me but we will find out in
time. It looks safe.
2025-12-13 05:19:29 +02:00
Protesilaos Stavrou 04f604877e
Make small refinements to denote-fontify-links 2025-12-13 05:19:00 +02:00
Protesilaos Stavrou 4497f11b35
Remove wrong key binding from denote-link-mouse-map 2025-12-13 05:18:26 +02:00
Protesilaos Stavrou 74c7aeeb1b
Explain why denote-grep display-buffer action is different 2025-12-13 05:18:03 +02:00
Protesilaos Stavrou 42a3f393e2
Use consistent display-buffer actions for backlinks and query links 2025-12-13 05:17:36 +02:00
Protesilaos Stavrou e45fde09c1
Use diffent fn for denote-query-format-heading-function value and update docstring 2025-12-13 05:16:30 +02:00
Protesilaos Stavrou d86cb70426
Make sure denote-get-link-description issues a warning only when it must
Otherwise it warns every time a link is inserted, which is wrong.

Thanks to Oliver Epper for reporting the problem in issue 651:
<https://github.com/protesilaos/denote/issues/651>.
2025-11-29 07:08:11 +02:00
Protesilaos Stavrou 529148eba6
Elaborate where I learnt about wrong-number-of-arguments error type 2025-11-24 12:23:56 +02:00
Protesilaos Stavrou 133439ba1e
Bump version number to trigger GNU ELPA update
There have been some fixes that I want to include in the package.
Otherwise I will need to delay those until version 4.2.0, which might
be released next year...
2025-11-23 05:36:49 +02:00
Protesilaos Stavrou c4a6ec07e6
Add a comment about how I discovered wrong-number-of-arguments
We would probably be okay with just ignoring 'error' but what I did
there with wrong-number-of-arguments seems more precise.
2025-11-23 05:15:45 +02:00
Protesilaos Stavrou a3109ed9b4
Call function of denote-link-description-format with two arguments
I still support the old calling convention to not break existing code,
but we should move to the new one eventually. This way we can pass the
file type as an argument to not have to calculate it more than once
while calling 'denote-link' and related.
2025-11-23 05:12:04 +02:00
Protesilaos Stavrou b30cfcb5c9
Make stylistic change to let binding of denote--delete-active-region-content 2025-11-22 12:11:14 +02:00
Protesilaos Stavrou df76615cf9
Make stylistic change to let binding of denote--get-active-region-content 2025-11-22 12:10:43 +02:00
Protesilaos Stavrou 0f93eee66f
Make denote--get-active-region-content return non-blank string 2025-11-22 07:17:02 +02:00
Protesilaos Stavrou 7851a3b97e
Add FIXME to avoid duplication in denote-link-description-with-signature-and-title 2025-11-22 06:54:47 +02:00
Protesilaos Stavrou dda6c5a9f7
Show directory in denote-file-prompt only when denote-directory has many
The idea is that if the user has configured denote-directory to a list
of directories, then we want to inform them where the file prompt is
at. For a single directory, this is superfluous.
2025-11-18 19:40:42 +02:00
Protesilaos Stavrou eff64968fa
Remove some old obsolescence warnings
They have been there for close to two years now. I think we can safely
get rid of them now.
2025-11-04 12:53:27 +02:00
Protesilaos Stavrou 37e9a74f77
Use define-obsolete-function-alias instead of make-obsolete for two obsolescence warnings 2025-11-04 12:51:27 +02:00
Protesilaos Stavrou 9f1042f4f6
Document denote-rename-file-identifier behaviour about not breaking backlinks
Thanks to jarofromel for pointing out that the documentation and error
message could be improved. This was done in issue 646:
<https://github.com/protesilaos/denote/issues/646>.
2025-11-01 07:45:13 +02:00
Protesilaos Stavrou c4cb46f592
Rename a binding in denote-sort-dired for clarity and consistency 2025-10-30 13:38:02 +02:00
Protesilaos Stavrou d94e942ac0
Make sure the denote-file-prompt uses what it got already from denote-has-single-denote-directory-p 2025-10-30 13:36:45 +02:00
Protesilaos Stavrou 252908697a
Make denote-link--buffer-file-prompt only check for denote-directory once 2025-10-30 13:36:22 +02:00
Protesilaos Stavrou cce09d2a25
Make denote-select-from-files-prompt only check for denote-directory once 2025-10-30 13:32:47 +02:00
Protesilaos Stavrou c3675d20e3
Remove trailing spaces from denote-md-link-in-context-regexp 2025-10-30 07:17:09 +02:00
Protesilaos Stavrou 0fb25e6770
Make hash table test function sharp quoted 2025-10-30 06:17:25 +02:00
Protesilaos Stavrou 84aa0d3bb7
Reword the denote-directory doc string to avoid two pedantic warnings 2025-10-30 06:16:53 +02:00
Protesilaos Stavrou 8dd6f868be
Make stylistic changes to denote-sluggify-and-apply-rules
I think this makes it easier to read. Besides, I found my first
legitimate use of 'thread-first'... party time!
2025-10-29 19:04:21 +02:00
Protesilaos Stavrou 50f9496734
Use the correct :type for user options that expect regexp or nil
Thanks to Stefan Monnier for pointing this out on the emacs-devel
mailing list: <https://lists.gnu.org/archive/html/emacs-devel/2025-10/msg00683.html>.
2025-10-26 14:13:44 +02:00
Protesilaos Stavrou cd6dd03f80
Merge branch 'changes-for-4.2.0' 2025-10-25 17:20:08 +03:00
Protesilaos Stavrou 13a4de04c8
Bump version number to trigger GNU ELPA rebuild for commit 9e638cc 2025-10-18 07:57:49 +03:00
Protesilaos Stavrou 9e638cc72f
Use 'define-obsolete-variable-alias' instead of 'make-obsolete-variable' for two that are still used
Thanks to Matthias Fuchs for informing me about a package that
depended on the old symbols. This was done in issue 640:
<https://github.com/protesilaos/denote/issues/640>.
2025-10-18 07:56:57 +03:00
Protesilaos Stavrou d69a679b2c
Make denote-infer-keywords enforce a controlled vocabulary when nil
This was always the implied use-case, but we were not enforcing it at
the minibuffer prompt.
2025-10-18 07:16:37 +03:00
Protesilaos Stavrou fcf5bccfd5
Use a more obvious name for denote-excluded-keywords-regexp 2025-10-18 07:00:06 +03:00
Protesilaos Stavrou c1250c9434
Update the documentation of denote-directory to better explain what it is about 2025-10-18 06:24:38 +03:00
Protesilaos Stavrou ff373d18e4
Fix a link in the latest CHANGELOG.org 2025-10-17 09:52:15 +03:00
Protesilaos Stavrou d4ba0eb290
Update to Denote version 4.1.0 2025-10-17 09:32:59 +03:00
Protesilaos Stavrou 0cc7a0d918
Fix a typo in the manual 2025-10-16 19:15:07 +03:00
Protesilaos Stavrou e9bfd528d5
Add missing last-modified from the :type of denote-sort-dired-default-sort-component 2025-10-16 19:14:33 +03:00
Protesilaos Stavrou 451e5009fb
Merge branch 'main' of github.com:protesilaos/denote 2025-10-07 18:32:41 +03:00
Protesilaos Stavrou b89d30de21
Try a simpler implementation of denote--file-has-backlinks-p
I discussed this with Yann Dutrieux in the follow-up to pull request
637: <https://github.com/protesilaos/denote/pull/637>.
2025-10-07 07:58:43 +03:00
Protesilaos Stavrou 679c13c5d9
Make stylistic change to denote-link--map-over-notes for readability 2025-10-06 20:20:00 +03:00
Protesilaos Stavrou 0d5ce4f22b
Make stylistic change to denote-subdirectory-prompt 2025-10-06 20:14:20 +03:00
Protesilaos Stavrou 7482fbc487
Acknowledge Yann Dutrieux for commit d509565
This was done in pull request 637: <https://github.com/protesilaos/denote/pull/637>.

The change is small, meaning that Yann does not need to assign
copyright to the Free Software Foundation.
2025-10-06 18:36:09 +03:00
Protesilaos Stavrou d509565e6b
Merge pull request #637 from dizzyyogi/gh_issue_636_dizzyyogi
Check in denote--file-has-backlinks-p whether link matches file id
2025-10-06 18:34:39 +03:00
Yann Dutrieux f42b6d663b Check in denote--file-has-backlinks-p whether link matches file id 2025-10-05 19:34:10 +02:00
Protesilaos Stavrou 444db90dab
Add link to "Getting started" section of the manual in the README.md 2025-09-26 08:27:54 +03:00
Protesilaos Stavrou e1fe1278eb
Include a "Getting started with Denote" section in the manual 2025-09-26 08:23:46 +03:00
Protesilaos Stavrou d1dcab874e
Make denote-query-sorting docs more consistent between manual and docstring 2025-09-24 13:20:33 +03:00
Protesilaos Stavrou e19538b5c5
Add the missing function :type from the user option denote-query-sorting 2025-09-24 13:20:12 +03:00
Protesilaos Stavrou 73c2ada5d2
Make small rewording in the manual 2025-09-24 13:09:30 +03:00
Protesilaos Stavrou fafe2b610f
Add custom identifier example: like the default plus capital letter for day of week 2025-09-24 07:41:14 +03:00
Protesilaos Stavrou 83dd0fefb1
Mention the custom identifier with a prompt in the denote-prompts section of the manual 2025-09-19 11:27:32 +03:00
Protesilaos Stavrou 747bbb914f
Document the user of 'denote-prompts' for custom identifiers 2025-09-19 11:26:34 +03:00
Protesilaos Stavrou 02193f9477
Remove the "identifier as number" from denote.el and put it in the manual
We are not using it internally and we do not need to provide it as
part of denote.el. Users who want custom identifiers will eventually
ask for all sorts of variations on this theme. We can keep everything
documented in the manual where we also have the freedom to add more
things to accommodate each use-case.
2025-09-19 11:12:17 +03:00
Protesilaos Stavrou 89b5275a52
Add another custom identifier example in the manual 2025-09-19 11:03:03 +03:00
Protesilaos Stavrou 9960ca320f
Flesh out the custom identifier code sample 2025-09-18 19:33:21 +03:00
Protesilaos Stavrou a39a0e0d1d
Add WORK-IN-PROGRESS example of a custom identifier scheme 2025-09-18 15:32:36 +03:00
Protesilaos Stavrou c9a13ee59e
Make small refinement to denote--link-at-point-get-data 2025-09-15 07:30:48 +03:00
Protesilaos Stavrou fec1a41e2e
Make denote-fontify-links compute its data only once
Otherwise we get font-lock to always call 'denote-filetype-heuristics'
on the buffer.
2025-09-15 07:23:31 +03:00
Protesilaos Stavrou e8eb15625d
Make denote--file-has-backlinks-p exit as soon as it finds a single backlink
This should be faster than before most of the times (well, unless the
file containing the links is the last on the list).
2025-09-10 12:02:53 +03:00
Protesilaos Stavrou 667dc1eb9b
Remove some needless pcase-let 2025-08-19 21:37:53 +03:00
Protesilaos Stavrou 5d5c29dd77
Remove needless comment in denote-fontify-links 2025-08-19 18:51:48 +03:00
Protesilaos Stavrou a4d6f321b4
Make denote-link-ol-help-echo more robust 2025-08-19 18:44:04 +03:00
Protesilaos Stavrou f4b9028178
Make denote-get-link-identifier-or-query-term-at-point more robust 2025-08-19 18:41:14 +03:00
Protesilaos Stavrou d58a684f0f
Make denote--get-link-file-path-at-point more robust 2025-08-19 18:37:22 +03:00
Protesilaos Stavrou 51fb9c7a4c
Clarify the use of denote--link-at-point-get-data in its docstring 2025-08-19 18:32:57 +03:00
Protesilaos Stavrou 0d696e7c35
Change how the helpers of "link at point" get the position
It is better for helper functions to expect an argument, because then
we can adapt them to our needs. Here we use '(point)', but we may have
another approach elsewhere.
2025-08-19 18:24:34 +03:00
Protesilaos Stavrou 4905da57ae
Make denote--link-open-at-point-subr more robust (see commit 76c1345)
Thanks to Bhargav Kulkarni for reporting the bug in issue 631 and for
Jean-Philippe Gagné Guay for commenting on how best to approach the
problem: <https://github.com/protesilaos/denote/issues/631>.
2025-08-17 18:09:03 +03:00
Protesilaos Stavrou 76c13454ae
Define helper functions to test if point is inside link regexp
The 'denote--inside-link-regexp-p' is based on the function
'org-in-regexp' that I found in the org-macs.el file of Org version
9.7.11.

Thanks to Jean-Philippe Gagné Guay for the feedback in issue 631 that
helped refine 'denote--inside-link-regexp-p':
<https://github.com/protesilaos/denote/issues/631#issuecomment-3194420425>.
2025-08-17 18:02:07 +03:00
Protesilaos Stavrou 7f5d9974f2
Fix package version in make-obsolete message about '(denote-directory)'
Thanks to Jean-Philippe Gagné Guay for pointing this out:
<https://github.com/protesilaos/denote/pull/632#issuecomment-3193637023>.
2025-08-16 15:35:47 +03:00
Protesilaos Stavrou 9b6f3ecee7
Add a missing space from the default denote-file-prompt text 2025-08-16 08:01:41 +03:00
Protesilaos Stavrou 12090237bc
Make the denote-directory function obsolete
I have gone back and forth on this issue. Jean-Philippe Gagné Guay
convinced me that it is better to deprecate it because this way the
users will be more informed about what is happening.

This is done in a comment and was then reminded it of it again in pull
request 632:

- <947f0be070>.
- <https://github.com/protesilaos/denote/pull/632>
2025-08-16 07:20:09 +03:00
Protesilaos Stavrou 70a473d41b
Merge pull request #632 from jeanphilippegg/readme
Various precisions in the manual
2025-08-16 07:19:39 +03:00
Jean-Philippe Gagné Guay ef31105cd8 Various precisions in the manual 2025-08-15 23:22:50 -04:00
Protesilaos Stavrou 80be3d309b
Make stylistic change in one comment 2025-08-09 12:04:15 +03:00
Protesilaos Stavrou 0b3fdcecb6
Do not try to prompt for 'denote-directories' and use 'denote-directory' instead
What I was trying to do earlier with the "maybe prompt" was not a good
idea, as pointed out by Jean-Philippe Gagné Guay:
<947f0be070 (commitcomment-163492171)>.

We do not want to compromise the Lisp calls to the relevant functions:
those should remain non-interactive.

The 'denote-prompts' can be configured to prompt for a directory,
which I forgot worked for parent level directories as well.

About the function 'denote-directory', I have gone back and forth
regarding whether to deprecate it or not. I think it is better to keep
it than have '(car (denote-directories))' everywhere: if we ever need
to change anything, then we can rely on it propagating elsewhere,
including to code that users will likely have.
2025-08-09 11:57:58 +03:00
Protesilaos Stavrou 947f0be070
Prompt for directory among 'denote-directories' if needed
The idea is to stop relying on the '(car (denote-directories))' pattern.
2025-08-05 14:46:33 +03:00
Protesilaos Stavrou 54d9946333
Use the new function to get the common root in the manual's sample code 2025-08-05 07:42:43 +03:00
Protesilaos Stavrou 85ccf5998d
Document the denote-directories function and make related changes to the manual 2025-08-05 07:41:33 +03:00
Protesilaos Stavrou 1fa853acc0
Introduce the function denote-directories-get-common-root 2025-08-05 07:40:53 +03:00
Protesilaos Stavrou 658659c83e
Stop declaring the denote-directory function as obsolete
There are plenty of custom functions that still use it. We will
improve things internally, but I see this function continuing to be
useful long-term.
2025-08-05 07:37:48 +03:00
Protesilaos Stavrou a234f7a592
Add FIXME for the function denote-directory 2025-08-05 07:23:54 +03:00
Protesilaos Stavrou 307db01003
Make denote--prepare-note only error if an existing file is not empty
This way we avoid cases where some other function saves the buffer
before we get to operate on it. One such example is 'lsp-auto-touch-files',
as noted by wuzhihao in issue 627: <https://github.com/protesilaos/denote/issues/627>.
2025-08-02 19:12:00 +03:00
Protesilaos Stavrou 955618e75c
Make small tweaks to two doc strings 2025-08-02 19:07:32 +03:00
Protesilaos Stavrou 49246e443f
Acknowledge Ashish Panigrahi for commit 2103ee1
This was done in pull request 625: <https://github.com/protesilaos/denote/pull/626>.

The change affects a single word, meaning that Ashish does not need to
assign copyright to the Free Software Foundation.
2025-08-01 14:21:57 +03:00
Protesilaos Stavrou a416c5b114
Merge pull request #626 from paniash/patch-1
Fixed typo
2025-08-01 14:21:12 +03:00
Protesilaos Stavrou e2c77a5476
Update the comment about denote--file-has-backlinks-p
This is an important thing to work on. What we have now is too
expensive for a feature that is small.
2025-08-01 12:43:21 +03:00
Protesilaos Stavrou 94546c048f
Make denote-get-backlinks produce error earlier if needed
If the file has no identifier, we do not want to check if it is in our
directories, anyway.
2025-08-01 12:28:52 +03:00
Protesilaos Stavrou 29e9436349
Remove some needless text from the manual about denote-rename-buffer-format 2025-08-01 12:24:47 +03:00
Protesilaos Stavrou 2a6bbd5ede
Remove the backlinks from the default denote-rename-buffer-format
This is because the way we handle the check for backlinks is to go
through ALL files. Given the way the denote-rename-buffer-mode works,
we do this EACH TIME we open or create a Denote file. This is inefficient.

The goal is to improve how we handle the retrieval of backlinks.
Though independent of that project, I think a simpler name for buffers
is a better default. Users who need to see an indicator for backlinks
can opt in to it (for example, users may not even be using direct
links, as they rely on query links instead).
2025-08-01 12:21:19 +03:00
Protesilaos Stavrou 81d392bf33
Check for existing file earlier in denote--prepare-note 2025-08-01 12:19:58 +03:00
Ashish Panigrahi 2103ee198c
Fixed typo
Fixed a typo in the documentation. Denote was mispelled as "Deonte".
2025-07-31 14:14:48 +03:00
Protesilaos Stavrou a7c562e4bc
Merge pull request #625 from jeanphilippegg/cleanup
Various adjustments
2025-07-27 12:53:59 +03:00
Protesilaos Stavrou 7707c2681d
Make stylistic change to denote-grep-file-regexp-prompt 2025-07-27 12:37:32 +03:00
Protesilaos Stavrou 6c3423fc85
Make stylistic change to denote-grep-query-prompt 2025-07-27 12:37:06 +03:00
Protesilaos Stavrou 35fb700d8c
Consolidate the user-error of the various query commands 2025-07-27 12:31:21 +03:00
Protesilaos Stavrou 32eb10d2e7
Make stylistic change to denote-make-links-buffer 2025-07-27 12:24:50 +03:00
Protesilaos Stavrou 8fc130cec6
Make stylistic change to denote-make-backlinks-buffer 2025-07-27 12:23:07 +03:00
Protesilaos Stavrou 4d4a8c57e0
Make stylistic change to denote-get-backlinks 2025-07-27 12:21:57 +03:00
Protesilaos Stavrou 447930e410
Make denote-get-backlinks only work in a denote directory
Otherwise, we are trying to check if a file anywhere in the file
system has backlinks in the 'denote-directory'. Those links should not
happen, as 'denote:' links only work for identifiers in the 'denote-directory'.
2025-07-27 12:09:10 +03:00
Jean-Philippe Gagné Guay e8fa213409 Obsolete denote-filename-is-note-p and denote-file-is-note-p 2025-07-19 00:16:21 -04:00
Jean-Philippe Gagné Guay 38c7c8f195 Remove comment in denote-generate-identifier-automatically 2025-07-19 00:16:21 -04:00
Jean-Philippe Gagné Guay 9f0d027609 Add has-identifier parameter to denote-directory-files and denote-file-prompt 2025-07-19 00:16:21 -04:00
Jean-Philippe Gagné Guay 46d1825bf2 Use denote-file-has-denoted-filename-p in denote-directory-get-files 2025-07-19 00:16:21 -04:00
Jean-Philippe Gagné Guay ef97da673c Add identifier sluggification 2025-07-18 22:45:55 -04:00
Jean-Philippe Gagné Guay f3f10462f4 Add denote-identifier-delimiter-always-present-in-file-name 2025-07-18 22:34:32 -04:00
Jean-Philippe Gagné Guay 5f9dd9a90d Remove comment in denote-format-file-name 2025-07-18 22:33:23 -04:00
Jean-Philippe Gagné Guay 444836c396 Remove unnecessary code in denote--find-first-unused-id-as-number 2025-07-18 22:03:43 -04:00
Jean-Philippe Gagné Guay 20dc124e88 Add comments to denote-generate-identifier-as-number 2025-07-18 22:03:43 -04:00
Protesilaos Stavrou 24b88f1fb5
Use correct wording in doc string of denote-make-backlinks-buffer 2025-07-17 11:47:57 +03:00
Protesilaos Stavrou b9ee610cbe
Use split-string instead of string-split
The latter is an alias introduced in Emacs 29. We do not want to
depend on Emacs 29 for something like this.
2025-07-16 09:26:28 +03:00
Protesilaos Stavrou ad1537d22a
Merge pull request #624 from jeanphilippegg/custom-identifiers
Custom identifier formats
2025-07-15 13:14:12 +03:00
Jean-Philippe Gagné Guay f704b49df4 Allow custom identifier formats 2025-07-12 23:10:01 -04:00
Jean-Philippe Gagné Guay 486abe9dbf Fix docstring of denote-backlinks 2025-07-12 23:10:01 -04:00
Jean-Philippe Gagné Guay 491ad9a788 Use denote-make-backlinks-buffer in denote-backlinks 2025-07-12 23:10:01 -04:00
Jean-Philippe Gagné Guay 76ecfd24d6 Use denote-retrieve-xref-alist-for-backlinks in denote-get-backlinks 2025-07-12 23:10:01 -04:00
Jean-Philippe Gagné Guay 99d5eda377 Add denote-make-backlinks-buffer 2025-07-12 23:10:01 -04:00
Jean-Philippe Gagné Guay b43149df38 Add denote-retrieve-xref-alist-for-backlinks
Also add denote--get-files-by-file-type and denote--get-all-backlinks
2025-07-12 23:10:01 -04:00
Jean-Philippe Gagné Guay 5ae68fcc19 Add :link-retrieval-format in denote-file-types 2025-07-12 23:10:01 -04:00
Protesilaos Stavrou 7c73cbbd52
Merge pull request #623 from brabalan/patch-2
documentation change for denote-rename-file
2025-07-11 15:47:56 +03:00
Alan Schmitt 7d82c434e9
documentation change for denote-rename-file
Added the information that denote-rename-file can use `'keep-current` for the identifier as well
2025-07-11 12:04:19 +00:00
Protesilaos Stavrou 770c5e41f2
Include a separator line in denote-dired-empty-mode 2025-07-10 06:41:52 +03:00
Protesilaos Stavrou 91c32fb3c1
Write sample code in the manual to retroactively reorder file name components 2025-07-09 15:56:28 +03:00
Protesilaos Stavrou 8ab4fac181
Use a major mode instead of a function that sets up special-mode
It is about the same code plus we can easily have a keymap there, get
the option of a hook, and potentially are more flexible with what we
can do.
2025-07-08 10:47:30 +03:00
Protesilaos Stavrou a1148a5da5
Use special-mode instead of fundamental-mode in denote-sort-dired--revert-to-empty
This is discussed with Alan Schmitt in issue 618: <https://github.com/protesilaos/denote/issues/618>.

Alan suggests a keymap to quit the window and kill the buffer. Maybe
we do not need that and can get away with just the special-mode.
2025-07-08 10:30:27 +03:00
Protesilaos Stavrou dd662876d4
Untabify and reindent file 2025-07-08 07:08:49 +03:00
Protesilaos Stavrou 79fc1d2cff
Make denote-sort-dired revert to an empty buffer if no matching files
This is discussed with Alan Schmitt and Rory Molinari in issue 618:
<https://github.com/protesilaos/denote/issues/618>.

I am using a bespoke buffer because I cannot find a way to achieve the
same result with a call to (dired (cons DIR FILES)). If that is
possible, then I am happy to switch to it. But this will do for the
time being.
2025-07-08 07:06:17 +03:00
Protesilaos Stavrou 5a473f9a8b
Clarify that the "empty files" variants of denote-sort-dired depend on current dev version 2025-07-07 16:42:40 +03:00
Protesilaos Stavrou ba9f164b8b
Update the sample denote-sort-dired variants for empty files 2025-07-07 16:37:50 +03:00
Protesilaos Stavrou 693c43ede8
Quote the lambda used in denote-sort-dired
Because of lexical-binding, the return value was fixed. But if a user
copies the code into the scratch buffer, renames the function, and
evaluates it, the lambda will be subject to dynamic scoping. This way,
we protect users from a faulty revert-buffer-function.
2025-07-07 16:36:20 +03:00
Protesilaos Stavrou 35f79506d1
Avoid repetition in the denote-sort-dired helpers 2025-07-07 13:53:06 +03:00
Protesilaos Stavrou e37c18d843
Make denote-sort-dired use a unique buffer each time
When we were passing the directory as (dired (cons DIRECTORY FILES))
we were inadvertently setting up Dired to re-use the buffer it
produced. Whereas we always want to have a new one for distinct
searches.

This is how we were doing it in the past but we had issues with the
revert-buffer function. Maybe we are good now.
2025-07-07 13:39:42 +03:00
Protesilaos Stavrou 73456765f1
Make some further refinements to the denote-sort-dired (extend commit c6c02ef) 2025-07-07 13:22:31 +03:00
Protesilaos Stavrou c6c02ef2df
Make denote-sort-dired more abstract
The idea is to make it easier to write custom variations of the
denote-sort-dired.
2025-07-07 13:09:04 +03:00
Protesilaos Stavrou 5b0a02d162
Revise denote-sort-dired buffer setup
We want the buffer to revert properly. Files that do not exist anymore
should not inhibit it and subsequent calls to 'denote-sort-dired'
should use their own separate buffer.

This was discussed at length in issue 618 with the participation of
Alan Schmitt and Rory Molinari: <https://github.com/protesilaos/denote/issues/618>.
2025-07-07 10:54:10 +03:00
Protesilaos Stavrou 9885bc6a08
Make small rewording to the docs of denote-get-identifier-function 2025-07-07 06:50:50 +03:00
Protesilaos Stavrou 0728da8a28
Use correct revert-buffer-function in denote--display-buffer-from-xref-alist
The code was submitted by Jean-Philippe Gagné Guay as part of the
larger pull request 621: <https://github.com/protesilaos/denote/pull/621>.
2025-07-06 20:49:07 +03:00
Protesilaos Stavrou d8fd1cb253
Merge pull request #621 from jeanphilippegg/cleanup
Various commits
2025-07-06 20:43:27 +03:00
Jean-Philippe Gagné Guay afb4a9807e Revert "Make optional the parameters of denote-generate-identifier-as-{date,number}"
This reverts commit 9549d977d5.
2025-07-05 22:15:29 -04:00
Jean-Philippe Gagné Guay dfe3608857 Obsolete denote-retrieve-filename-identifier-with-error 2025-07-05 22:15:29 -04:00
Jean-Philippe Gagné Guay b8f1a589e1 Add denote--display-buffer-from-xref-alist 2025-07-05 21:13:58 -04:00
Protesilaos Stavrou c69210be6c
Put two spaces after a dot in a doc string 2025-07-03 19:10:14 +03:00
Protesilaos Stavrou cad687b9e6
Make denote-directories return a list when silo is set to obsolete 'default-directory' or `local'
We will keep warning users about those values, but we still want them
to work.
2025-07-03 09:24:32 +03:00
Protesilaos Stavrou a419ce1c47
Revert "Fix denote--dir-in-denote-directory-p"
This reverts commit 6dd9a135b7.

What I did is wrong because now a subdirectory will never satisfy this
condition. Thanks to oatmealm for reporting the bug in issue 620:
<https://github.com/protesilaos/denote/issues/620>.
2025-07-02 22:42:24 +03:00
Protesilaos Stavrou 0001bc9d8c
Make denote-grep-query-prompt use optional PROMPT-TEXT instead of special TYPE
We still support TYPE for the foreseeable future, but it is more
flexible to just have a string there.
2025-06-30 10:32:02 +03:00
Protesilaos Stavrou 8694b092b7
Make denote--revert-dired take a second param to avoid re-running 'current-buffer' 2025-06-25 20:29:25 +03:00
Protesilaos Stavrou fb5b4e31f6
Add optional "last modified" sort to denote-dired and denote-query-sorting 2025-06-25 18:02:39 +03:00
Protesilaos Stavrou a49aa81cfe
Make the sample denote-sort-dired with/without empty files work as expected
Bringing them up to speed with what we had for Denote version 4.

Maybe we want to extend them further so that they work with a list
value for denote-directory, but let's keep it like this for the time being.
2025-06-23 21:27:13 +03:00
Protesilaos Stavrou 3785194e0e
Merge branch 'main' of github.com:protesilaos/denote 2025-06-23 21:07:09 +03:00
Protesilaos Stavrou 5d8738f4bb
Add FIXME for outdate code samples of denote-sort-dired 2025-06-23 21:05:40 +03:00
Protesilaos Stavrou 318e10d8e7
Remove useless denote-sort--dired-buffer variable
I am not sure why that was there. Maybe we were relying on it at some
point but our code is not doing anything with it right now.
2025-06-23 21:03:29 +03:00
Protesilaos Stavrou 272e939417
Merge pull request #617 from jeanphilippegg/fix-renaming-command
Fix denote--rename-file for files without an identifier
2025-06-21 09:30:55 +03:00
Jean-Philippe Gagné Guay d3a8582c91 Fix denote--rename-file for files without an identifier 2025-06-19 22:54:20 -04:00
Protesilaos Stavrou 3dc772f683
Split denote-directories into helper and public functions
This way we can, in principle, re-use what we have there.

The original code was contributed by Jean-Philippe Gagné Guay in pull
request 613: <https://github.com/protesilaos/denote/pull/613>.
2025-06-19 17:55:54 +03:00
Protesilaos Stavrou 877252b77e
Introduce denote-directory-get-files-function
This is for users who need to customise the behaviour of
'denote-directory-files'. I am adding it in response to issue 5 on the
denote-org repository about the performance of Org dynamic
blocks (where a custom function could help):
<https://github.com/protesilaos/denote-org/issues/5>.
2025-06-19 12:39:24 +03:00
Protesilaos Stavrou 4c20bf0a57
Make denote-directory-get-files public 2025-06-19 12:39:04 +03:00
Protesilaos Stavrou 9549d977d5
Make optional the parameters of denote-generate-identifier-as-{date,number}
The original code was contributed by Jean-Philippe Gagné Guay in pull
request 613: <https://github.com/protesilaos/denote/pull/613>.
2025-06-18 13:21:28 +03:00
Protesilaos Stavrou dd86eebffb
Remove obsolete denote-prompt-for-date-return-id 2025-06-18 13:20:42 +03:00
Protesilaos Stavrou 48338bce07
Make the denote-get-identifier-function public
The original code was contributed by Jean-Philippe Gagné Guay in pull
request 613: <https://github.com/protesilaos/denote/pull/613>.
2025-06-18 13:19:25 +03:00
Protesilaos Stavrou 1181c734b5
Document the denote-directory option with its new possible list value
This feature was contributed by Jean-Philippe Gagné Guay in pull
request 609: <https://github.com/protesilaos/denote/pull/609>.

Jean-Philippe has assigned copyright to the Free Software Foundation
and is a long-time contributor to Denote.
2025-06-13 12:35:22 +03:00
Protesilaos Stavrou 6dd9a135b7
Fix denote--dir-in-denote-directory-p
The previous design would fail if DIRECTORY did not end with a slash.
Given the 'string-prefix-p', I assume this is the intended expression.
2025-06-13 12:31:11 +03:00
Protesilaos Stavrou 0dc8cb710c
Clarify that a custom grep is not needed in light of denote-grep 2025-06-13 12:10:31 +03:00
Protesilaos Stavrou 1299a416ed
Merge pull request #613 from jeanphilippegg/date-and-identifier
Make the date and identifiers independent and new identifier prompt
2025-06-13 11:57:17 +03:00
Protesilaos Stavrou 9f91b9b6a9
Revise how denote-link-ol-export converts links to files in HTML
The previous design assumed that every file that is linked to will get
an ".html" extension. But this is not correct, such as with PDF files.

Thanks to Morten Kjeldgaard for reporting the bug in issue 614:
<https://github.com/protesilaos/denote/issues/614>.
2025-06-13 11:28:36 +03:00
Jean-Philippe Gagné Guay a4d50fbf71 Make identifier and date independent 2025-06-12 23:42:30 -04:00
Protesilaos Stavrou d03f323a39
Use the correct conventions in two doc strings 2025-06-09 07:25:38 +03:00
Protesilaos Stavrou dde56db8c0
Make small edits to the documentation of denote-kill-buffers 2025-06-09 07:20:41 +03:00
Protesilaos Stavrou 6e8e321c1b
Reword the documentation of denote-save-buffers 2025-06-09 07:20:22 +03:00
Jean-Philippe Gagné Guay 2551221933 Add denote-identifier-prompt 2025-06-07 22:45:47 -04:00
Jean-Philippe Gagné Guay 11bbb6b9a1 Use denote-identifier-regexp in denote-retrieve-filename-identifier 2025-06-07 22:45:21 -04:00
Jean-Philippe Gagné Guay 40f2bf5569 Rename denote-id-regexp and denote-id-format 2025-06-07 22:45:10 -04:00
Protesilaos Stavrou d4804f87ab
Make denote-sort-dired work with multiple directories of denote-directory
This build on top of the new feature that allows the user option
'denote-directory' to accept a list of directories. It was contributed
by Jean-Philippe Gagné Guay in pull request 609: <https://github.com/protesilaos/denote/pull/609>.
2025-06-06 10:52:51 +03:00
Protesilaos Stavrou 55e3f9b6b3
Merge pull request #609 from jeanphilippegg/denote-directories
Make denote-directory accept a list of directories
2025-06-06 10:51:45 +03:00
Jean-Philippe Gagné Guay 5c7208e4ed Make denote-directory accept a list of directories 2025-06-02 00:03:11 -04:00
Protesilaos Stavrou e57f38f25b
Clarify that denote-sluggify-and-apply-rules is the new name of denote-sluggify
This was done in commits 2f9ef0c and e0a4bb4, which were contributed
by Jean-Philippe Gagné Guay in pull request 607: <https://github.com/protesilaos/denote/pull/607>.

Jean-Philippe has assigned copyright to the Free Software Foundation.
2025-05-25 17:34:13 +03:00
Protesilaos Stavrou d54c41e179
Merge pull request #607 from jeanphilippegg/fix-sluggification
Ensure sluggification of signature in front matter obey denote-file-name-slug-functions
2025-05-25 17:31:59 +03:00
Jean-Philippe Gagné Guay 2f9ef0cad8 Rename denote-sluggify function 2025-05-24 23:31:08 -04:00
Jean-Philippe Gagné Guay e0a4bb42b1 Use user-specified sluggification for front matter signatures. 2025-05-24 23:24:57 -04:00
Protesilaos Stavrou 2b1625a9c6
Revert "Add user option 'denote-sluggify-signature-in-frontmatter'"
This reverts commit 5b0eee109d.

I was trying it out but did not mean to commit it. We are discussing
this with the author in pull request 606: <https://github.com/protesilaos/denote/pull/606>.
2025-05-21 13:40:44 +03:00
Protesilaos Stavrou 77ecfa0805
Make denote-id-to-date public 2025-05-21 13:40:12 +03:00
Protesilaos Stavrou e1954dda30
Fix typo in denote-format-link
This was changed by Jean-Philippe Gagné Guay in pull request 596:
<https://github.com/protesilaos/denote/pull/596>.
2025-05-21 13:39:22 +03:00
Protesilaos Stavrou da5b7f360a
Merge branch 'main' of github.com:protesilaos/denote 2025-05-21 13:23:09 +03:00
Protesilaos Stavrou 3f1e934f2b
Merge pull request #596 from jeanphilippegg/linking-functions
Remove include-date parameter from linking functions
2025-05-21 13:22:43 +03:00
Hanwen Guo 5b0eee109d
Add user option 'denote-sluggify-signature-in-frontmatter'
This user option controls whether signature should be sluggified or keep the
user input as-is in frontmatter (not filename), as some users may prefer.
2025-05-20 12:23:21 +03:00
Protesilaos Stavrou d7c4046f16
Reword the note about 'denote-use-template' with regard to 'denote-org-capture-specifiers'
The original was provided by Ryota in pull request 598:
<https://github.com/protesilaos/denote/pull/598>.
2025-05-08 07:24:28 +03:00
Protesilaos Stavrou 86ee5cbc4a
Do not mention the 'denote-use-*' in the section about Org capture and link to it instead
Otherwise we might have information in two places that is out of sync
with each other.
2025-05-08 07:21:06 +03:00
Protesilaos Stavrou 5a0cfd07dc
Document the 'denote-use-*' variables in their own section of the manual
This way it is easier to find them.
2025-05-08 07:20:58 +03:00
Protesilaos Stavrou 11726dae4b
Merge pull request #598 from rytswd/main
Add note about denote-use-template duplicate
2025-05-08 07:10:20 +03:00
Protesilaos Stavrou b54229c724
Merge pull request #599 from mjkalyan/prefix
De-duplicate code in ‘denote-format-buffer-name’
2025-05-08 06:56:11 +03:00
James Kalyan 6c2295e75e
De-duplicate code in ‘denote-format-buffer-name’
i.e. Just make the format string conditional, not the whole format.
2025-05-07 13:05:10 -06:00
Ryota be2eb704a0
Add note about denote-use-template duplicate
This fixes #545.
2025-05-07 13:11:38 +01:00
Protesilaos Stavrou 8f7099eeb8
Document the new user option denote-buffer-name-prefix
This builds on top of commit 8e1341d by James Kalyan, which was done
in pull request 597: <https://github.com/protesilaos/denote/pull/597>.

James is in the process of assigning copyright to the Free Software
Foundation.
2025-05-07 09:41:39 +03:00
Protesilaos Stavrou afa3b9495f
Reword the doc string of denote-buffer-name-prefix
This builds on top of commit 8e1341d by James Kalyan, which was done
in pull request 597: <https://github.com/protesilaos/denote/pull/597>.

James is in the process of assigning copyright to the Free Software
Foundation.
2025-05-07 09:35:07 +03:00
Protesilaos Stavrou ffb65405e7
Acknowledge James Kalyan for commit 8e1341d
This is related to pull request 597: <https://github.com/protesilaos/denote/pull/597>.
James is in the process of assigning copyright to the Free Software
Foundation.
2025-05-07 07:28:09 +03:00
Protesilaos Stavrou 0150e8ed94
Make stylistic changes to how denote-buffer-name-prefix is used
This builds on top of commit 8e1341d by James Kalyan, which was done
in pull request 597: <https://github.com/protesilaos/denote/pull/597>.

James is in the process of assigning copyright to the Free Software
Foundation.
2025-05-07 07:26:12 +03:00
Protesilaos Stavrou 5f262d0541
Merge pull request #597 from mjkalyan/prefix
Implement ‘denote-buffer-name-prefix’ discussed as an aside in #595
2025-05-07 07:10:30 +03:00
James Kalyan 8e1341d946
Implement ‘denote-buffer-name-prefix’ discussed as an aside in #595
This approach defines ‘denote-buffer-name-prefix’ as a customizable variable
defaulting to "[D] ".

Then I define ‘denote-buffer-name’ as a function to wrap buffer names in such
that they use ‘denote-buffer-name-prefix’. ‘denote-buffer-name’ also takes the
opportunity to allow designating buffers as "special/temporary" or not which
adds surrounding asterisks.

Lastly, I have wrapped all the Denote-related buffer names with
‘denote-buffer-name’ so commands like ‘denote-sort-dired’, ‘denote-backlinks’,
and ‘denote-grep’ will all use ‘denote-buffer-name-prefix’.

BEFORE MERGING:

- Fix my placement of the definitions inside denote.el. I'm not sure what makes
most sense to you.

- decide on a package-version for the introduction of
‘denote-buffer-name-prefix’. I have it set to "TODO" at the moment.
2025-05-06 14:07:57 -06:00
Protesilaos Stavrou e8f9e22892
Remove the custom revert-buffer-function of denote-sort-dired
I think we do not need it anymore and we had a FIXME for it, anyway.

Thanks to mjkalyan for reporting the problem with revert-buffer and
for testing this change: <https://github.com/protesilaos/denote/pull/595#issuecomment-2853268654>.
2025-05-06 08:00:40 +03:00
Protesilaos Stavrou 5e144fc77e
Rename the functions to get links/backlinks
The old names are from a time when we defined the linking
functionality in a separate file.
2025-05-05 12:46:26 +03:00
Protesilaos Stavrou b6e8701f29
Make denote--link-in-context-regexp always check for ID-only links as well
This is because a file may have both.
2025-05-05 12:38:37 +03:00
Protesilaos Stavrou 0900b9461f
Reorder some lines in the denote-query-mode-map
It is easier for me to read it this way.
2025-05-05 08:29:14 +03:00
Protesilaos Stavrou a99d59ad58
Expand the menu bar contents with the various denote-query-* commands 2025-05-05 08:27:48 +03:00
Protesilaos Stavrou 0f99c17e23
Add denote-grep to the menu bar contents 2025-05-05 08:18:16 +03:00
Lucas Quintana 34103b2b3a
Make sure 'denote--menu-contents' has a string as its first element
This fixes the bug where 'denote-context-menu' would completely
disable the 'context-menu-mode', as reported by artelse in issue 592:
<https://github.com/protesilaos/denote/issues/592>.
2025-05-05 08:12:15 +03:00
Protesilaos Stavrou 77371ac78a
Fix long-standing issue with denote-sort-dired buffer name
The 'dired' function cannot be called with a 'cons' whose 'car'
contains a forward slash because that breaks the resulting buffer. By
renaming the buffer after it is created, we circumvent this problem
and can thus use the format we want.

Given this opportunity, the format of the buffer name is subject to a
variable that users can modify. I am doing this in response to pull
request 595 by mjkalyan: <https://github.com/protesilaos/denote/pull/595>.
2025-05-05 08:06:18 +03:00
Jean-Philippe Gagné Guay 5dbc394316 Remove include-date parameter from linking functions 2025-05-04 23:21:39 -04:00
Protesilaos Stavrou a6925b1edf
Tweak the doc string of denote-query-sort-last-search
The functionality to sort query buffers was introduced by Lucas
Quintana in pull request 594: <https://github.com/protesilaos/denote/pull/594>.

Lucas has assigned copyright to the Free Software Foundation.
2025-05-04 12:49:07 +03:00
Protesilaos Stavrou 5ce665d9e4
Make stylistic change to denote-retrieve-xref-alist
The functionality to sort query buffers was introduced by Lucas
Quintana in pull request 594: <https://github.com/protesilaos/denote/pull/594>.

Lucas has assigned copyright to the Free Software Foundation.
2025-05-04 12:46:05 +03:00
Protesilaos Stavrou 14259e58ca
Document denote-query-sorting and denote-query-sort-last-search
The functionality to sort query buffers was introduced by Lucas
Quintana in pull request 594: <https://github.com/protesilaos/denote/pull/594>.

Lucas has assigned copyright to the Free Software Foundation.
2025-05-04 12:45:39 +03:00
Protesilaos Stavrou 354d29db27
Make small change to the doc string of denote-query-sorting
The functionality to sort query buffers was introduced by Lucas
Quintana in pull request 594: <https://github.com/protesilaos/denote/pull/594>.

Lucas has assigned copyright to the Free Software Foundation.
2025-05-04 12:34:15 +03:00
Protesilaos Stavrou 4abffa78c3
Declare denote-query-sorting before its first use
The functionality to sort query buffers was introduced by Lucas
Quintana in pull request 594: <https://github.com/protesilaos/denote/pull/594>.

Lucas has assigned copyright to the Free Software Foundation.
2025-05-04 12:25:58 +03:00
Protesilaos Stavrou a9621ff851
Merge pull request #594 from lmq-10/sort-query-buffer
Add support for sorting files in query buffers
2025-05-04 12:20:09 +03:00
Lucas Quintana 8a61780089 Use denote-query--last-files instead of all files when sorting 2025-05-03 20:38:04 -03:00
Lucas Quintana 921cb936f3 Add support for sorting query buffers 2025-05-03 20:16:18 -03:00
Lucas Quintana fcf83579a6 Fix small issues with query buffers
- Clearing filters and excluding/including files should always replace
current window and reuse buffer name.

- As query buffers are special buffers, they should be enclosed with
asterisks (we already do that for backlink buffers).
2025-05-03 19:37:11 -03:00
Protesilaos Stavrou f543f305ad
Add annotation function to denote-sort-component-prompt 2025-05-03 15:20:17 +03:00
Protesilaos Stavrou ffd3bef12b
Add 'random' order for denote-sort functions
This applies to the command 'denote-sort-dired' ('denote-dired'), as
well as the Org dynamic blocks defined in the package denote-org.

Thanks to experimental-code-86 for making the suggestion in issue 572:
<https://github.com/protesilaos/denote/issues/572>.
2025-05-03 15:20:06 +03:00
Protesilaos Stavrou 807395fcb1
Add command denote-find-backlink-with-location
This is in response to issue 471 as reported by johkneisl:
<https://github.com/protesilaos/denote/issues/471>.
2025-04-29 08:54:20 +03:00
Protesilaos Stavrou 7d18f17a19
Make denote-link-return-links accept optional FILES 2025-04-29 08:04:15 +03:00
Protesilaos Stavrou aaa5d30a7c
Make obsolete the unused denote-link--expand-identifiers
I know we use it in denote-org, but I will move it there and then
refine it.
2025-04-29 07:54:39 +03:00
Protesilaos Stavrou 5b7157019b
Use custom prompt text in denote-find-link and denote-find-backlink 2025-04-29 07:48:07 +03:00
Protesilaos Stavrou 8e973f12ad
Use format-prompt in denote-select-from-files-prompt 2025-04-29 07:47:49 +03:00
Protesilaos Stavrou 590787e148
Add two TODO for denote-link-dired-marked-notes 2025-04-29 07:42:45 +03:00
Protesilaos Stavrou 7b50b22f63
Use expand-file-name in denote-link--buffer-file-prompt 2025-04-29 07:40:57 +03:00
Protesilaos Stavrou b78efdcab8
Use expand-file-name instead of concat in denote-file-prompt
I think this is the proper way of constructing a full file system path.
2025-04-29 07:38:42 +03:00
Protesilaos Stavrou 861f544562
Rename+extend denote-select-linked-file-prompt to denote-select-from-files-prompt 2025-04-29 07:35:53 +03:00
Protesilaos Stavrou d964b567f2
Make denote-select-linked-file-prompt return absolute path
This extends the work done in commits 266207d, 81e529d.
2025-04-29 07:30:53 +03:00
Protesilaos Stavrou 34fd0bfc64
Add variable to inhibit front matter rewrite via a 'let'
We discussed this with Jean-Philippe Gagné Guay in issue 589:
<https://github.com/protesilaos/denote/issues/589>.
2025-04-29 07:18:54 +03:00
Protesilaos Stavrou 266207d8b9
Simplify denote-find-backlink 2025-04-28 17:24:39 +03:00
Protesilaos Stavrou 81e529d8f3
Simplify denote-find-link 2025-04-28 17:24:39 +03:00
Protesilaos Stavrou cdb44a2d31
Remove needless helper function of denote-fontify-links
The helper was there because I was originally using it for two functions.
2025-04-23 14:28:44 +03:00
6 changed files with 4715 additions and 1957 deletions

File diff suppressed because it is too large Load diff

View file

@ -632,7 +632,7 @@ state the exclusion of warranty; and each file should have at least
the "copyright" line and a pointer to where the full notice is found.
<one line to give the program's name and a brief idea of what it does.>
Copyright (C) 2021 Protesilaos Stavrou
Copyright (C) 2021 Protesilaos
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
@ -652,7 +652,7 @@ Also add information on how to contact you by electronic and paper mail.
If the program does terminal interaction, make it output a short
notice like this when it starts in an interactive mode:
<program> Copyright (C) 2021 Protesilaos Stavrou
<program> Copyright (C) 2021 Protesilaos
This program comes with ABSOLUTELY NO WARRANTY; for details type `show w'.
This is free software, and you are welcome to redistribute it
under certain conditions; type `show c' for details.

View file

@ -1,5 +1,10 @@
# denote: Simple notes with an efficient file-naming scheme
New to Denote? Start reading this from the manual:
<https://protesilaos.com/emacs/denote#h:c54bedb4-5377-4dbd-853c-5870ace6eb33>.
* * *
Denote is a simple note-taking tool for Emacs. It is based on the idea
that notes should follow a predictable and descriptive file-naming
scheme. The file name must offer a clear indication of what the note is

1802
README.org

File diff suppressed because it is too large Load diff

3165
denote.el

File diff suppressed because it is too large Load diff

View file

@ -1,9 +1,9 @@
;;; denote-test.el --- Unit tests for Denote -*- lexical-binding: t -*-
;; Copyright (C) 2023-2025 Free Software Foundation, Inc.
;; Copyright (C) 2023-2026 Free Software Foundation, Inc.
;; Author: Protesilaos Stavrou <info@protesilaos.com>
;; Maintainer: Protesilaos Stavrou <info@protesilaos.com>
;; Author: Protesilaos <info@protesilaos.com>
;; Maintainer: Protesilaos <info@protesilaos.com>
;; URL: https://github.com/protesilaos/denote
;; This file is NOT part of GNU Emacs.
@ -37,21 +37,68 @@
(require 'denote)
(ert-deftest dt-denote-directories--get-paths ()
"Test that `denote-directories--get-paths' returns a list of paths."
(let ((path "~/Documents/notes"))
(should (equal
(denote-directories--get-paths path)
(list (file-name-as-directory (expand-file-name path))))))
(let ((paths (list "~/Documents/notes" "~/Documents/books")))
(should (equal
(denote-directories--get-paths paths)
(mapcar
(lambda (path)
(file-name-as-directory (expand-file-name path)))
paths)))
(should (seq-every-p
(lambda (path)
(string-suffix-p "/" path))
(denote-directories--get-paths paths)))
(should-not (null (denote-directories--get-paths paths))))
(should-error (denote-directories--get-paths 'hello))
(should-error (denote-directories--get-paths '(hello)))
(should-error (denote-directories--get-paths '(1 2 3))))
(ert-deftest dt-denote--make-denote-directory ()
"Test that `denote--make-denote-directory' creates the directory."
(should (null (denote--make-denote-directory))))
(let* ((names (list "denote-test-made-directory-1" "denote-test-made-directory-2"))
(directories (mapcar
(lambda (directory)
(file-name-as-directory (expand-file-name directory temporary-file-directory)))
names)))
(should-not (denote-directories--make-paths directories))
(should (seq-every-p #'file-name-directory directories))
(dolist (directory directories)
(delete-directory directory))))
(ert-deftest dt-denote-directory ()
"Test that variable `denote-directory' returns an absolute directory name."
(let ((path (denote-directory)))
(should (and (file-directory-p path)
(file-name-absolute-p path)))))
(ert-deftest dt-denote-directories ()
"Test that `denote-directories' returns list of directories.
It does so by expanding the value of the user option `denote-directory'.
Also see `denote-test--denote--make-denote-directory',
`denote-test---denote-directories--get-paths'."
(let ((denote-directory "/tmp/denote-test-notes"))
(should
(equal
(denote-directories)
(list (file-name-as-directory (expand-file-name denote-directory)))))
(should (and (file-directory-p denote-directory)
(file-name-absolute-p denote-directory))))
(let ((denote-directory (list "/tmp/denote-test-notes-1" "/tmp/denote-test-notes-2")))
(should
(equal
(denote-directories)
(mapcar
(lambda (directory)
(file-name-as-directory (expand-file-name directory)))
denote-directory)))
(should (and (seq-every-p #'file-directory-p denote-directory)
(seq-every-p #'file-name-absolute-p denote-directory)))))
(ert-deftest dt-denote-sluggify-title ()
"Test that `denote-sluggify-title' removes punctuation from the string.
Concretely, remove anything specified in `denote-sluggify-title'."
(should (equal (denote-sluggify-title "this-is-!@#test")
"this-is-test")))
(should (equal (denote-sluggify-title "this-is-!@#test") "this-is-test")))
(ert-deftest dt-denote-slug-keep-only-ascii ()
"Test that `denote-slug-keep-only-ascii' removes non-ASCII characters."
@ -63,101 +110,89 @@ Concretely, remove anything specified in `denote-sluggify-title'."
"Test that `denote-slug-hyphenate' hyphenates the string.
Also replace multiple hyphens with a single one and remove any
leading and trailing hyphen."
(should (equal (denote-slug-hyphenate "__ This is a test __ ")
"This-is-a-test")))
(should (equal (denote-slug-hyphenate "__ This is a test __ ") "This-is-a-test")))
(ert-deftest dt-denote-sluggify ()
"Test that `denote-sluggify' sluggifies the string.
To sluggify is to (i) downcase, (ii) hyphenate, (iii) de-punctuate, and (iv) remove spaces from the string."
(should (equal (denote-sluggify 'title " ___ !~!!$%^ This iS a tEsT ++ ?? ")
"this-is-a-test")))
(should (equal (denote-sluggify 'title " ___ !~!!$%^ This iS a tEsT ++ ?? ") "this-is-a-test")))
(ert-deftest Ddenote--slug-put-equals ()
"Test that `denote-slug-put-equals' replaces spaces/underscores with =.
Otherwise do the same as what is described in
`dt-denote-slug-hyphenate'.
`denote-test--denote-slug-hyphenate'.
The use of the equals sign is for the SIGNATURE field of the
Denote file name."
(should (equal (denote-slug-put-equals "__ This is a test __ ")
"This=is=a=test")))
(should (equal (denote-slug-put-equals "__ This is a test __ ") "This=is=a=test")))
(ert-deftest dt-denote-sluggify-signature ()
"Test that `denote-sluggify-signature' sluggifies the string for file signatures.
This is like `dt-denote-sluggify', except that it also
accounts for what we describe in `dt-denote-slug-put-equals'."
(should (equal (denote-sluggify-signature "--- ___ !~!!$%^ This -iS- a tEsT ++ ?? ")
"this=is=a=test")))
This is like `denote-test--denote-sluggify', except that it also
accounts for what we describe in `denote-test--denote-slug-put-equals'."
(should (equal (denote-sluggify-signature "--- ___ !~!!$%^ This -iS- a tEsT ++ ?? ") "this=is=a=test")))
(ert-deftest dt-denote-sluggify-keyword ()
"Test that `denote-sluggify-keyword' sluggifies the string while joining words.
In this context, to join words is to elimitate any space or
delimiter between them.
Otherwise, this is like `dt-denote-sluggify'."
(should (equal (denote-sluggify-keyword "--- ___ !~!!$%^ This iS a - tEsT ++ ?? ")
"thisisatest")))
Otherwise, this is like `denote-test--denote-sluggify'."
(should (equal (denote-sluggify-keyword "--- ___ !~!!$%^ This iS a - tEsT ++ ?? ") "thisisatest")))
(ert-deftest dt-denote-sluggify-keywords ()
"Test that `denote-sluggify-keywords' sluggifies a list of strings.
The function also account for the value of the user option
`denote-allow-multi-word-keywords'."
(should
(equal (denote-sluggify-keywords '("one !@# --- one" " two" "__ three __"))
'("oneone" "two" "three"))))
(should (equal (denote-sluggify-keywords '("one !@# --- one" " two" "__ three __")) '("oneone" "two" "three"))))
(ert-deftest dt-denote-slug-remove-accents ()
"Test that `denote-slug-remove-accents' removed diacretics."
(should (string= (denote-slug-remove-accents "ê") "e"))
(should (string= (denote-slug-remove-accents "ñ") "n")))
(ert-deftest dt-denote--file-empty-p ()
"Test that `denote--file-empty-p' returns non-nil on empty file."
;; (should (null (denote--file-empty-p user-init-file))
(should (let ((file (make-temp-file "denote-test")))
(prog1
(denote--file-empty-p file)
(delete-file file)))))
(let ((file (make-temp-file "denote-test")))
(should (denote--file-empty-p file))
(with-current-buffer (find-file-noselect file)
(insert "Hello world, this is not empty anymore!")
(save-buffer))
(should-not (denote--file-empty-p file))
(delete-file file)))
(ert-deftest dt-denote-file-is-note-p ()
"Test that `denote-file-is-note-p' checks that files is a Denote note.
For our purposes, a note must note be a directory, must satisfy
`file-regular-p', its path must be part of the variable
`denote-directory', it must have a Denote identifier in its name,
and use one of the extensions implied by the variable `denote-file-type'."
(should (let* ((tmp (temporary-file-directory))
(denote-directory tmp)
(file (concat tmp "20230522T154900--test__keyword.txt")))
(with-current-buffer (find-file-noselect file)
(write-file file))
(prog1
(denote-file-is-note-p file)
(delete-file file)))))
(ert-deftest dt-denote-file-has-denoted-filename-p ()
"Test that `denote-file-has-denoted-filename-p' validates a Denote file name."
(should (denote-file-has-denoted-filename-p "20230522T154900--test__keyword.txt"))
(should-not (denote-file-has-denoted-filename-p "hello")))
(ert-deftest dt-denote-file-has-identifier-p ()
"Test that `denote-file-has-identifier-p' checks for a Denote identifier."
(should (denote-file-has-identifier-p "20230522T154900--test__keyword.txt"))
(should (null (denote-file-has-identifier-p "T154900--test__keyword.txt"))))
(should-not (denote-file-has-identifier-p "T154900--test__keyword.txt")))
(ert-deftest dt-denote-file-has-signature-p ()
"Test that `denote-file-has-signature-p' checks for a Denote signature."
(should (denote-file-has-signature-p "20230522T154900==sig--test__keyword.txt"))
(should (null (denote-file-has-signature-p "20230522T154900--test__keyword.txt"))))
(should-not (denote-file-has-signature-p "20230522T154900--test__keyword.txt")))
(ert-deftest dt-denote-file-has-supported-extension-p ()
"Test that `denote-file-has-supported-extension-p' matches a supported extension."
(should
(member
(file-name-extension "20230522T154900==sig--test__keyword.txt" :period)
(denote-file-type-extensions-with-encryption)))
(should
(null
(member
(file-name-extension "20230522T154900==sig--test__keyword" :period)
(denote-file-type-extensions-with-encryption)))))
(let ((extensions (denote-file-type-extensions-with-encryption)))
(should
(member
(file-name-extension "20230522T154900==sig--test__keyword.txt" :period)
extensions))
(should-not
(member
(file-name-extension "20230522T154900==sig--test__keyword" :period)
extensions))))
(ert-deftest dt-denote-file-type-extensions ()
"Test that `denote-file-type-extensions' returns file extensions.
We check for the common file type extensions, though the user can
theoretically set `denote-file-types' to nil and handle things on
their own. We do not have to test for that scenario, because
such a user will be redefining large parts of Denote's behaviour
with regard to file types."
We check for the common file type extensions, though the user can set
`denote-file-types' to nil and handle things on their own or, anyhow,
modify that variable."
(let ((extensions (denote-file-type-extensions)))
(should (or (member ".md" extensions)
(member ".org" extensions)
@ -165,7 +200,7 @@ with regard to file types."
(ert-deftest dt-denote-file-type-extensions-with-encryption ()
"Test that `denote-file-type-extensions-with-encryption' covers encryption.
Extend what we do in `dt-denote-file-type-extensions'."
Extend what we do in `denote-test--denote-file-type-extensions'."
(let ((extensions (denote-file-type-extensions-with-encryption)))
(should (or (member ".md" extensions)
(member ".org" extensions)
@ -183,360 +218,263 @@ To make the test reproducible, set `denote-date-format' to a value that
does not involve the time zone."
(let ((denote-date-format "%Y-%m-%d")
(denote-front-matter-components-present-even-if-empty-value '(title keywords signature date identifier)))
(should (and (equal (denote--format-front-matter "" (date-to-time "20240101T120000") '("") "" "" 'text)
(mapconcat #'identity
'("title: "
"date: 2024-01-01"
"tags: "
"identifier: "
"signature: "
"---------------------------\n\n")
"\n"))
(equal
(denote--format-front-matter
"Some test" (date-to-time "2023-06-05") '("one" "two")
"20230605T102234" "sig" 'text)
(mapconcat #'identity
'("title: Some test"
"date: 2023-06-05"
"tags: one two"
"identifier: 20230605T102234"
"signature: sig"
"---------------------------\n\n")
"\n"))))
(should (and (equal (denote--format-front-matter "" (date-to-time "20240101T120000") nil "" "" 'org)
(mapconcat #'identity
'("#+title: "
"#+date: 2024-01-01"
"#+filetags: "
"#+identifier: "
"#+signature: "
"\n")
"\n"))
(equal
(denote--format-front-matter
"Some test" (date-to-time "2023-06-05") '("one" "two")
"20230605T102234" "sig" 'org)
(mapconcat #'identity
'("#+title: Some test"
"#+date: 2023-06-05"
"#+filetags: :one:two:"
"#+identifier: 20230605T102234"
"#+signature: sig"
"\n")
"\n"))))
(should (and (equal (denote--format-front-matter "" (date-to-time "20240101T120000") nil "" "" 'markdown-yaml)
(mapconcat #'identity
'("---"
"title: \"\""
"date: 2024-01-01"
"tags: []"
"identifier: \"\""
"signature: \"\""
"---"
"\n")
"\n"))
(equal
(denote--format-front-matter
"Some test" (date-to-time "2023-06-05") '("one" "two")
"20230605T102234" "sig" 'markdown-yaml)
(mapconcat #'identity
'("---"
"title: \"Some test\""
"date: 2023-06-05"
"tags: [\"one\", \"two\"]"
"identifier: \"20230605T102234\""
"signature: \"sig\""
"---"
"\n")
"\n"))))
(should (and (equal (denote--format-front-matter "" (date-to-time "20240101T120000") nil "" "" 'markdown-toml)
(mapconcat #'identity
'("+++"
"title = \"\""
"date = 2024-01-01"
"tags = []"
"identifier = \"\""
"signature = \"\""
"+++"
"\n")
"\n"))
(equal
(denote--format-front-matter
"Some test" (date-to-time "2023-06-05") '("one" "two")
"20230605T102234" "sig" 'markdown-toml)
(mapconcat #'identity
'("+++"
"title = \"Some test\""
"date = 2023-06-05"
"tags = [\"one\", \"two\"]"
"identifier = \"20230605T102234\""
"signature = \"sig\""
"+++"
"\n")
"\n"))))))
(should (equal (denote--format-front-matter "" (date-to-time "20240101T120000") '("") "" "" 'text)
(string-join
'("title: "
"date: 2024-01-01"
"tags: "
"identifier: "
"signature: "
"---------------------------\n\n")
"\n")))
(should (equal (denote--format-front-matter "Some test" (date-to-time "2023-06-05") '("one" "two") "20230605T102234" "sig" 'text)
(string-join
'("title: Some test"
"date: 2023-06-05"
"tags: one two"
"identifier: 20230605T102234"
"signature: sig"
"---------------------------\n\n")
"\n")))
(should (equal (denote--format-front-matter "" (date-to-time "20240101T120000") nil "" "" 'org)
(string-join
'("#+title: "
"#+date: 2024-01-01"
"#+filetags: "
"#+identifier: "
"#+signature: "
"\n")
"\n")))
(should (equal
(denote--format-front-matter
"Some test" (date-to-time "2023-06-05") '("one" "two")
"20230605T102234" "sig" 'org)
(string-join
'("#+title: Some test"
"#+date: 2023-06-05"
"#+filetags: :one:two:"
"#+identifier: 20230605T102234"
"#+signature: sig"
"\n")
"\n")))
(should (equal (denote--format-front-matter "" (date-to-time "20240101T120000") nil "" "" 'markdown-yaml)
(string-join
'("---"
"title: \"\""
"date: 2024-01-01"
"tags: []"
"identifier: \"\""
"signature: \"\""
"---"
"\n")
"\n")))
(should (equal (denote--format-front-matter "Some test" (date-to-time "2023-06-05") '("one" "two") "20230605T102234" "sig" 'markdown-yaml)
(string-join
'("---"
"title: \"Some test\""
"date: 2023-06-05"
"tags: [\"one\", \"two\"]"
"identifier: \"20230605T102234\""
"signature: \"sig\""
"---"
"\n")
"\n")))
(should (equal (denote--format-front-matter "" (date-to-time "20240101T120000") nil "" "" 'markdown-toml)
(string-join
'("+++"
"title = \"\""
"date = 2024-01-01"
"tags = []"
"identifier = \"\""
"signature = \"\""
"+++"
"\n")
"\n")))
(should (equal (denote--format-front-matter "Some test" (date-to-time "2023-06-05") '("one" "two") "20230605T102234" "sig" 'markdown-toml)
(string-join
'("+++"
"title = \"Some test\""
"date = 2023-06-05"
"tags = [\"one\", \"two\"]"
"identifier = \"20230605T102234\""
"signature = \"sig\""
"+++"
"\n")
"\n")))))
(ert-deftest dt-denote-format-file-name ()
"Test that `denote-format-file-name' returns all expected paths."
(let* ((title "Some test")
(id (format-time-string denote-id-format (denote-valid-date-p "2023-11-28 05:53:11")))
(id (format-time-string denote-date-identifier-format (denote-valid-date-p "2023-11-28 05:53:11")))
(denote-directory "/tmp/test-denote")
(dir (car (denote-directories)))
(ext (denote--file-extension 'org))
(kws '("one" "two")))
(should-error (denote-format-file-name
nil
id
kws
title
(denote--file-extension 'org)
""))
(should-error (denote-format-file-name
""
id
kws
title
(denote--file-extension 'org)
""))
(should-error (denote-format-file-name
denote-directory ; notice this is the `let' bound value without the suffix
id
kws
title
(denote--file-extension 'org)
""))
(should-error (denote-format-file-name
(denote-directory)
""
nil
""
(denote--file-extension 'org)
""))
(should (equal (denote-format-file-name
(denote-directory)
nil
kws
title
(denote--file-extension 'org)
"")
"/tmp/test-denote/--some-test__one_two.org"))
(should (equal (denote-format-file-name
(denote-directory)
""
kws
title
(denote--file-extension 'org)
"")
"/tmp/test-denote/--some-test__one_two.org"))
(should (equal (denote-format-file-name
(denote-directory)
"0123456"
kws
title
(denote--file-extension 'org)
"")
"/tmp/test-denote/@@0123456--some-test__one_two.org"))
(should (equal (denote-format-file-name
(denote-directory)
id
kws
title
(denote--file-extension 'org)
"")
"/tmp/test-denote/20231128T055311--some-test__one_two.org"))
(should (equal (denote-format-file-name
(denote-directory)
id
nil
""
(denote--file-extension 'org)
"")
"/tmp/test-denote/20231128T055311.org"))
(should (equal (denote-format-file-name
(denote-directory)
id
nil
nil
(denote--file-extension 'org)
nil)
"/tmp/test-denote/20231128T055311.org"))
(should (equal (denote-format-file-name
(denote-directory)
id
kws
title
(denote--file-extension 'org)
"sig")
"/tmp/test-denote/20231128T055311==sig--some-test__one_two.org"))))
(should-error (denote-format-file-name nil id kws title ext ""))
(should-error (denote-format-file-name "" id kws title ext ""))
;; NOTE that `denote-directory' is the `let' bound value without the suffix
(should-error (denote-format-file-name denote-directory id kws title ext ""))
(should-error (denote-format-file-name dir "" nil "" ext ""))
(should (equal (denote-format-file-name dir nil kws title ext "") "/tmp/test-denote/--some-test__one_two.org"))
(should (equal (denote-format-file-name dir "" kws title ext "") "/tmp/test-denote/--some-test__one_two.org"))
(should (equal (denote-format-file-name dir "0123456" kws title ext "") "/tmp/test-denote/@@0123456--some-test__one_two.org"))
(should (equal (denote-format-file-name dir id kws title ext "") "/tmp/test-denote/20231128T055311--some-test__one_two.org"))
(should (equal (denote-format-file-name dir id nil "" ext "") "/tmp/test-denote/20231128T055311.org"))
(should (equal (denote-format-file-name dir id nil nil ext nil) "/tmp/test-denote/20231128T055311.org"))
(should (equal (denote-format-file-name dir id kws title ext "sig") "/tmp/test-denote/20231128T055311==sig--some-test__one_two.org"))))
(ert-deftest dt-denote-get-file-extension ()
"Test that `denote-get-file-extension' gets the correct file extension."
(should (and (equal (denote-get-file-extension "20231010T105034--some-test-file__denote_testing") "")
(equal (denote-get-file-extension "20231010T105034--some-test-file__denote_testing.org") ".org")
(equal (denote-get-file-extension "20231010T105034--some-test-file__denote_testing.org.gpg") ".org.gpg")
(equal (denote-get-file-extension "20231010T105034--some-test-file__denote_testing.org.age") ".org.age"))))
(should (equal (denote-get-file-extension "20231010T105034--some-test-file__denote_testing") ""))
(should (equal (denote-get-file-extension "20231010T105034--some-test-file__denote_testing.org") ".org"))
(should (equal (denote-get-file-extension "20231010T105034--some-test-file__denote_testing.org.gpg") ".org.gpg"))
(should (equal (denote-get-file-extension "20231010T105034--some-test-file__denote_testing.org.age") ".org.age")))
(ert-deftest dt-denote-get-file-extension-sans-encryption ()
"Test that `denote-get-file-extension-sans-encryption' gets the file extension without encryption."
(should (and (equal (denote-get-file-extension-sans-encryption "20231010T105034--some-test-file__denote_testing") "")
(equal (denote-get-file-extension-sans-encryption "20231010T105034--some-test-file__denote_testing.org") ".org")
(equal (denote-get-file-extension-sans-encryption "20231010T105034--some-test-file__denote_testing.org.gpg") ".org")
(equal (denote-get-file-extension-sans-encryption "20231010T105034--some-test-file__denote_testing.org.age") ".org"))))
(should (equal (denote-get-file-extension-sans-encryption "20231010T105034--some-test-file__denote_testing") ""))
(should (equal (denote-get-file-extension-sans-encryption "20231010T105034--some-test-file__denote_testing.org") ".org"))
(should (equal (denote-get-file-extension-sans-encryption "20231010T105034--some-test-file__denote_testing.org.gpg") ".org"))
(should (equal (denote-get-file-extension-sans-encryption "20231010T105034--some-test-file__denote_testing.org.age") ".org")))
;; TODO 2026-04-06: For the `denote-file-type'.
(ert-deftest dt-denote-filetype-heuristics ()
"Test that `denote-filetype-heuristics' gets the correct file type."
(should (and (eq (denote-filetype-heuristics "20231010T105034--some-test-file__denote_testing") nil)
(eq (denote-filetype-heuristics "20231010T105034--some-test-file__denote_testing.org") 'org)
(eq (denote-filetype-heuristics "20231010T105034--some-test-file__denote_testing.org.gpg") 'org)
(eq (denote-filetype-heuristics "20231010T105034--some-test-file__denote_testing.org.age") 'org)
(eq (denote-filetype-heuristics "20231010T105034--some-test-file__denote_testing.txt") 'text)
(eq (denote-filetype-heuristics "20231010T105034--some-test-file__denote_testing.txt.gpg") 'text)
(eq (denote-filetype-heuristics "20231010T105034--some-test-file__denote_testing.txt.age") 'text)
;; NOTE 2023-10-11: It returns `markdown-yaml' as a fallback. In
;; an actual file, it reads the file contents to determine what
;; it is and can return `markdown-toml'. In principle, we should
;; be testing this here, though I prefer to keep things simple.
(eq (denote-filetype-heuristics "20231010T105034--some-test-file__denote_testing.md") 'markdown-yaml)
(eq (denote-filetype-heuristics "20231010T105034--some-test-file__denote_testing.md.gpg") 'markdown-yaml)
(eq (denote-filetype-heuristics "20231010T105034--some-test-file__denote_testing.md.age") 'markdown-yaml))))
(ert-deftest dt-denote-get-identifier ()
"Test that `denote-get-identifier' returns an identifier."
(should (and (equal (denote-get-identifier nil) "")
(equal (denote-get-identifier 1705644188) "20240119T080308")
(equal (denote-get-identifier '(26026 4251)) "20240119T080307"))))
(should-not (denote-filetype-heuristics "20231010T105034--some-test-file__denote_testing"))
(should (eq (denote-filetype-heuristics "20231010T105034--some-test-file__denote_testing.org") 'org))
(should (eq (denote-filetype-heuristics "20231010T105034--some-test-file__denote_testing.org.gpg") 'org))
(should (eq (denote-filetype-heuristics "20231010T105034--some-test-file__denote_testing.org.age") 'org))
(should (eq (denote-filetype-heuristics "20231010T105034--some-test-file__denote_testing.txt") 'text))
(should (eq (denote-filetype-heuristics "20231010T105034--some-test-file__denote_testing.txt.gpg") 'text))
(should (eq (denote-filetype-heuristics "20231010T105034--some-test-file__denote_testing.txt.age") 'text))
(should (eq (denote-filetype-heuristics "20231010T105034--some-test-file__denote_testing.md")
(caar (denote--file-types-with-extension ".md"))))
(should (eq (denote-filetype-heuristics "20231010T105034--some-test-file__denote_testing.md.gpg")
(caar (denote--file-types-with-extension ".md"))))
(should (eq (denote-filetype-heuristics "20231010T105034--some-test-file__denote_testing.md.age")
(caar (denote--file-types-with-extension ".md")))))
(ert-deftest dt-denote-retrieve-filename-identifier ()
"Test that `denote-retrieve-filename-identifier' returns only the identifier."
(should (and (null
(denote-retrieve-filename-identifier "/path/to/testing/--this-is-a-test-reordered__denote_testing.org"))
(equal
(denote-retrieve-filename-identifier "/path/to/testing/20240610T194654--this-is-a-test-reordered__denote_testing.org")
"20240610T194654")
(equal
(denote-retrieve-filename-identifier "/path/to/testing/20240610T194654==signature--this-is-a-test-reordered__denote_testing.org")
"20240610T194654")
(equal
(denote-retrieve-filename-identifier "/path/to/testing/--this-is-a-test-reordered__denote_testing@@20240610T194654.org")
"20240610T194654")
(equal
(denote-retrieve-filename-identifier "/path/to/testing/__denote_testing--this-is-a-test-reordered@@20240610T194654.org")
"20240610T194654")
(equal
(denote-retrieve-filename-identifier "/path/to/testing/__denote_testing@@20240610T194654--this-is-a-test-reordered.org")
"20240610T194654")
(equal
(denote-retrieve-filename-identifier "/path/to/testing/==signature__denote_testing@@20240610T194654--this-is-a-test-reordered.org")
"20240610T194654"))))
(should (null (denote-retrieve-filename-identifier "/path/to/testing/--this-is-a-test-reordered__denote_testing.org")))
(should (equal (denote-retrieve-filename-identifier "/path/to/testing/20240610T194654--this-is-a-test-reordered__denote_testing.org") "20240610T194654"))
(should (equal (denote-retrieve-filename-identifier "/path/to/testing/20240610T194654==signature--this-is-a-test-reordered__denote_testing.org") "20240610T194654"))
(should (equal (denote-retrieve-filename-identifier "/path/to/testing/--this-is-a-test-reordered__denote_testing@@20240610T194654.org") "20240610T194654"))
(should (equal (denote-retrieve-filename-identifier "/path/to/testing/__denote_testing--this-is-a-test-reordered@@20240610T194654.org") "20240610T194654"))
(should (equal (denote-retrieve-filename-identifier "/path/to/testing/__denote_testing@@20240610T194654--this-is-a-test-reordered.org") "20240610T194654"))
(should (equal (denote-retrieve-filename-identifier "/path/to/testing/==signature__denote_testing@@20240610T194654--this-is-a-test-reordered.org") "20240610T194654")))
(ert-deftest dt-denote-retrieve-filename-title ()
"Test that `denote-retrieve-filename-title' returns only the title."
(should (and (null
(denote-retrieve-filename-title "/path/to/testing/20240610T194654__denote_testing.org"))
(equal
(denote-retrieve-filename-title "/path/to/testing/20240610T194654--this-is-a-test-reordered__denote_testing.org")
"this-is-a-test-reordered")
(equal
(denote-retrieve-filename-title "/path/to/testing/20240610T194654==signature--this-is-a-test-reordered__denote_testing.org")
"this-is-a-test-reordered")
(equal
(denote-retrieve-filename-title "/path/to/testing/--this-is-a-test-reordered__denote_testing@@20240610T194654.org")
"this-is-a-test-reordered")
(equal
(denote-retrieve-filename-title "/path/to/testing/__denote_testing--this-is-a-test-reordered@@20240610T194654.org")
"this-is-a-test-reordered")
(equal
(denote-retrieve-filename-title "/path/to/testing/__denote_testing@@20240610T194654--this-is-a-test-reordered.org")
"this-is-a-test-reordered")
(equal
(denote-retrieve-filename-title "/path/to/testing/==signature__denote_testing@@20240610T194654--this-is-a-test-reordered.org")
"this-is-a-test-reordered"))))
(should (null (denote-retrieve-filename-title "/path/to/testing/20240610T194654__denote_testing.org")))
(should (equal (denote-retrieve-filename-title "/path/to/testing/20240610T194654--this-is-a-test-reordered__denote_testing.org") "this-is-a-test-reordered"))
(should (equal (denote-retrieve-filename-title "/path/to/testing/20240610T194654==signature--this-is-a-test-reordered__denote_testing.org") "this-is-a-test-reordered"))
(should (equal (denote-retrieve-filename-title "/path/to/testing/--this-is-a-test-reordered__denote_testing@@20240610T194654.org") "this-is-a-test-reordered"))
(should (equal (denote-retrieve-filename-title "/path/to/testing/__denote_testing--this-is-a-test-reordered@@20240610T194654.org") "this-is-a-test-reordered"))
(should (equal (denote-retrieve-filename-title "/path/to/testing/__denote_testing@@20240610T194654--this-is-a-test-reordered.org") "this-is-a-test-reordered"))
(should (equal (denote-retrieve-filename-title "/path/to/testing/==signature__denote_testing@@20240610T194654--this-is-a-test-reordered.org") "this-is-a-test-reordered")))
(ert-deftest dt-denote-retrieve-filename-keywords ()
"Test that `denote-retrieve-filename-keywords' returns only the keywords."
(should (and (null
(denote-retrieve-filename-keywords "/path/to/testing/20240610T194654--this-is-a-test-reordered.org"))
(equal
(denote-retrieve-filename-keywords "/path/to/testing/20240610T194654--this-is-a-test-reordered__denote_testing.org")
"denote_testing")
(equal
(denote-retrieve-filename-keywords "/path/to/testing/20240610T194654==signature--this-is-a-test-reordered__denote_testing.org")
"denote_testing")
(equal
(denote-retrieve-filename-keywords "/path/to/testing/--this-is-a-test-reordered__denote_testing@@20240610T194654.org")
"denote_testing")
(equal
(denote-retrieve-filename-keywords "/path/to/testing/__denote_testing--this-is-a-test-reordered@@20240610T194654.org")
"denote_testing")
(equal
(denote-retrieve-filename-keywords "/path/to/testing/__denote_testing@@20240610T194654--this-is-a-test-reordered.org")
"denote_testing")
(equal
(denote-retrieve-filename-keywords "/path/to/testing/==signature__denote_testing@@20240610T194654--this-is-a-test-reordered.org")
"denote_testing"))))
(should (null (denote-retrieve-filename-keywords "/path/to/testing/20240610T194654--this-is-a-test-reordered.org")))
(should (equal (denote-retrieve-filename-keywords "/path/to/testing/20240610T194654--this-is-a-test-reordered__denote_testing.org") "denote_testing"))
(should (equal (denote-retrieve-filename-keywords "/path/to/testing/20240610T194654==signature--this-is-a-test-reordered__denote_testing.org") "denote_testing"))
(should (equal (denote-retrieve-filename-keywords "/path/to/testing/--this-is-a-test-reordered__denote_testing@@20240610T194654.org") "denote_testing"))
(should (equal (denote-retrieve-filename-keywords "/path/to/testing/__denote_testing--this-is-a-test-reordered@@20240610T194654.org") "denote_testing"))
(should (equal (denote-retrieve-filename-keywords "/path/to/testing/__denote_testing@@20240610T194654--this-is-a-test-reordered.org") "denote_testing"))
(should (equal (denote-retrieve-filename-keywords "/path/to/testing/==signature__denote_testing@@20240610T194654--this-is-a-test-reordered.org") "denote_testing")))
(ert-deftest dt-denote-retrieve-filename-signature ()
"Test that `denote-retrieve-filename-signature' returns only the signature."
(should (and (null
(denote-retrieve-filename-signature "/path/to/testing/20240610T194654--this-is-a-test-reordered__denote_testing.org"))
(equal
(denote-retrieve-filename-signature "/path/to/testing/20240610T194654==signature--this-is-a-test-reordered__denote_testing.org")
"signature")
(equal
(denote-retrieve-filename-signature "/path/to/testing/--this-is-a-test-reordered==signature__denote_testing@@20240610T194654.org")
"signature")
(equal
(denote-retrieve-filename-signature "/path/to/testing/__denote_testing--this-is-a-test-reordered==signature@@20240610T194654.org")
"signature")
(equal
(denote-retrieve-filename-signature "/path/to/testing/__denote_testing@@20240610T194654--this-is-a-test-reordered==signature.org")
"signature")
(equal
(denote-retrieve-filename-signature "/path/to/testing/==signature__denote_testing@@20240610T194654--this-is-a-test-reordered.org")
"signature"))))
(should (null (denote-retrieve-filename-signature "/path/to/testing/20240610T194654--this-is-a-test-reordered__denote_testing.org")))
(should (equal (denote-retrieve-filename-signature "/path/to/testing/20240610T194654==signature--this-is-a-test-reordered__denote_testing.org") "signature"))
(should (equal (denote-retrieve-filename-signature "/path/to/testing/--this-is-a-test-reordered==signature__denote_testing@@20240610T194654.org") "signature"))
(should (equal (denote-retrieve-filename-signature "/path/to/testing/__denote_testing--this-is-a-test-reordered==signature@@20240610T194654.org") "signature"))
(should (equal (denote-retrieve-filename-signature "/path/to/testing/__denote_testing@@20240610T194654--this-is-a-test-reordered==signature.org") "signature"))
(should (equal (denote-retrieve-filename-signature "/path/to/testing/==signature__denote_testing@@20240610T194654--this-is-a-test-reordered.org") "signature")))
(ert-deftest dt-denote-identifier-p ()
"Test that `denote-identifier-p' works for Denote identifiers."
(should (and (denote-identifier-p "20240901T090910")
(null (denote-identifier-p "20240901T090910-not-identifier-format")))))
(ert-deftest dt-denote-date-identifier-p ()
"Test that `denote-date-identifier-p' works for Denote identifiers."
(should (denote-date-identifier-p "20240901T090910"))
(should-not (denote-date-identifier-p "20240901T090910-not-identifier-format")))
(ert-deftest dt-denote--id-to-date ()
"Test that `denote--id-to-date' returns the date from an identifier."
(should (equal (denote--id-to-date "20240901T090910") "2024-09-01"))
(should-error (denote--id-to-date "20240901T090910-not-identifier-format")))
(ert-deftest dt-denote-id-to-date ()
"Test that `denote-id-to-date' returns the date from an identifier."
(should (equal (denote-id-to-date "20240901T090910") "2024-09-01"))
(should-error (denote-id-to-date "20240901T090910-not-identifier-format")))
(ert-deftest dt-denote--date-convert ()
"Test that `denote--date-convert' works with dates."
(should (and
(equal (denote--date-convert '(26454 45206 461174 657000) :list)
'(26454 45206 461174 657000))
(equal (denote--date-convert '(26454 45206 461174 657000) :string)
"2024-12-09 10:55:50")
(equal (denote--date-convert nil :string)
"")
(equal (denote--date-convert nil :list)
nil)))
(should (equal (denote--date-convert '(26454 45206 461174 657000) :list) '(26454 45206 461174 657000)))
(should (equal (denote--date-convert '(26454 45206 461174 657000) :string) "2024-12-09 10:55:50"))
(should (equal (denote--date-convert nil :string) ""))
(should (equal (denote--date-convert nil :list) nil))
(should-error (denote--date-convert '(26454 45206 461174 657000) :not-valid-type))
(should-error (denote--date-convert nil :not-valid-type)))
;; TODO 2026-02-23: Add support for Windows paths. But I need somebody who has a Windows machine...
(ert-deftest dt-denote--get-common-root-directory ()
"Test that `denote--get-common-root-directory' returns the right path."
(should (string=
(denote--get-common-root-directory
'("/home/prot/Documents/notes/"
"/home/prot/Documents/notes/attachments"))
"/home/prot/Documents/notes/"))
(should (string=
(denote--get-common-root-directory
'("/home/prot/Documents/"
"/home/prot/Documents/notes/attachments"))
"/home/prot/Documents/"))
(should (string=
(denote--get-common-root-directory
'("/home/prot/Books/"
"/home/prot/Documents/notes/"))
"/home/prot/"))
(should (string=
(denote--get-common-root-directory
'("/tmp/notes/"
"/home/prot/Documents/notes/"))
"/"))
(should (string=
(denote--get-common-root-directory
'("/home/prot/Documents/notes/"))
"/home/prot/Documents/notes/"))
(should-error (denote--get-common-root-directory '("~/Documents/notes/"))))
(ert-deftest dt-denote-query--keywords-as-regexp ()
"Test that `denote-query--keywords-as-regexp' works as intended."
(should (string= (denote-query--keywords-as-regexp '("one" "two")) "_\\(?:one\\|two\\)"))
(should-error (denote-query--keywords-as-regexp "one"))
(should-error (denote-query--keywords-as-regexp '("one" 1))))
(ert-deftest dt-denote-file-type ()
"Test that function `denote-file-type' does what it is meant to."
(let* ((create-file-fn (lambda (name extension)
(expand-file-name
(format "denote-test-file-type-%s.%s" name extension)
(temporary-file-directory))))
(modify-file-fn (lambda (file contents)
(with-current-buffer (find-file-noselect file)
(erase-buffer)
(insert contents)
(save-buffer))))
(yaml-file (funcall create-file-fn "yaml" "md"))
(toml-file (funcall create-file-fn "toml" "md"))
(org-file (funcall create-file-fn "org" "org")))
(progn
(funcall modify-file-fn yaml-file denote-yaml-front-matter)
(should (eq (denote-file-type yaml-file) 'markdown-yaml)))
(progn
(funcall modify-file-fn toml-file denote-toml-front-matter)
(should (eq (denote-file-type toml-file) 'markdown-toml)))
(progn
(funcall modify-file-fn org-file denote-org-front-matter)
(should (eq (denote-file-type org-file) 'org)))
(should-not (denote-file-type "test"))
(let ((denote-file-types nil))
(should-not (denote-file-type "test.md")))))
(provide 'denote-test)
;;; denote-test.el ends here