Compare commits

...

1021 commits
3.1.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
Protesilaos Stavrou c98c74ec74
Update to Denote version 4.0.0 2025-04-15 17:32:11 +03:00
Protesilaos Stavrou 23bb1ec373
Remove obsolete tests 2025-04-15 17:26:37 +03:00
Protesilaos Stavrou 90603d5b0e
Make denote-link-description-format also accept %I and %D
This is the same as 'denote-rename-buffer-format'. I need to check
whether we can remove whatever duplication between the two variables.
2025-04-15 14:14:25 +03:00
Protesilaos Stavrou bb01587843
Remove warning about the denote-* packages that now are on GNU ELPA 2025-04-15 08:53:08 +03:00
Protesilaos Stavrou 242fb0f100
Merge branch 'main' of github.com:protesilaos/denote 2025-04-15 08:47:46 +03:00
Protesilaos Stavrou e2b47e45bf
Document in the manual all the denote-grep related symbols
These were contributed by Lucas Quintana in pull request 573:
<https://github.com/protesilaos/denote/pull/573>.

Lucas has assigned copyright to the Free Software Foundation.
2025-04-15 08:46:43 +03:00
Protesilaos Stavrou 41ffb657e7
Reword the denote-grep-marked-dired-files doc string 2025-04-15 08:45:49 +03:00
Protesilaos Stavrou de67f639a1
Autoload denote-grep 2025-04-15 08:43:17 +03:00
Protesilaos Stavrou 5193b10b25
Make denote-grep-files-referenced-in-region throw an error if there is no active region 2025-04-15 08:42:39 +03:00
Protesilaos Stavrou 146e620417
Autoload denote-grep-files-referenced-in-region and denote-grep-marked-dired-files 2025-04-15 08:40:52 +03:00
Protesilaos Stavrou ed9018f81c
Explain in denote-grep-files-referenced-in-region what "referenced" files are
Better have the explanation in the command, which is user-facing, than
in the helper function.
2025-04-15 08:40:04 +03:00
Protesilaos Stavrou 089cd57d40
Apply to denote-get-link-face the same change as commit da64be1
The commit da64be1 was done by TomoeMami in pull request 578:
<https://github.com/protesilaos/denote/pull/578>.
2025-04-14 19:56:16 +03:00
Protesilaos Stavrou ea8cf56ed7
Acknowledge TomoeMami for commit da64be1
This was done in pull request 578: <https://github.com/protesilaos/denote/pull/578>.
The change is small, meaning that the author does not need to assign
copyright to the Free Software Foundation.
2025-04-14 19:53:51 +03:00
Protesilaos Stavrou 27e5849cb0
Merge pull request #578 from TomoeMami/main
Fix Windows compatibility of `denote-link-ol-follow`
2025-04-14 19:52:12 +03:00
TomoeMami da64be1a49
Fix Windows compatibility of denote-link-ol-follow
On Windows, given the `link` as an identifer `"20250312T161853"` , the result of `(denote-link--ol-resolve-link-to-target 
 link)` is a Windows path `"c:/path/to/the/file.extension"`

However, the result of `(file-exists-p (string-trim-right match ":.*"))` is `nil`, because `(string-trim-right "c:/path/to/the/file.extension" ":.*")` returns `"c"` ,which is the driver letter on Windows.

We can fix it by this: `(string-trim-right "c:/path/to/the/file.extension" ":[^/]+.*")`
2025-04-14 13:41:26 +08:00
Protesilaos Stavrou 956f5dfd10
Merge pull request #576 from jeanphilippegg/small-fixes
Small fixes
2025-04-14 08:33:18 +03:00
Jean-Philippe Gagné Guay 7e528398bb Fix order of or subexpressions in denote-date-prompt 2025-04-13 20:46:22 -04:00
Jean-Philippe Gagné Guay d3b1be0732 Use default symbol as default value for denote-use-keywords
nil is the empty list and can be a valid value for denote-use-keywords
2025-04-13 20:43:43 -04:00
Protesilaos Stavrou 2062286ee9
Add comments to the sample configuration to direct users to the Info manual
This is in response to issue 575 raised by André Bering:
<https://github.com/protesilaos/denote/issues/575>.
2025-04-09 07:27:43 +03:00
Protesilaos Stavrou 2e750d6af1
Capitalise "Dired" in two doc strings 2025-04-06 10:12:58 +03:00
Protesilaos Stavrou 06db676d80
Clarify the denote-add-links prompt 2025-04-06 10:12:32 +03:00
Protesilaos Stavrou f115e60df9
Remove needless comment 2025-04-06 10:12:21 +03:00
Protesilaos Stavrou aacad80e4d
Merge pull request #573 from lmq-10/last-search-features
Implement functions for searching in dired files and in a region
2025-04-04 08:09:09 +03:00
Protesilaos Stavrou 7bb8b7c436
Make denote-rename-buffer-format accept human-readable date and "do what I mean" specifiers 2025-04-03 08:47:49 +03:00
Lucas Quintana 0845c16f97 Implement functions for searching in dired files and in a region 2025-04-02 11:32:45 -03:00
Protesilaos Stavrou d590f4f094
Include denote-dired and denote-grep in the sample configuration 2025-03-31 11:14:27 +03:00
Protesilaos Stavrou 6b2c9f6751
Mention alias denote-dired in the manual's heading for easier discovery 2025-03-31 11:14:08 +03:00
Protesilaos Stavrou 3abd10d7bb
Include query links in sample configuration 2025-03-31 11:12:48 +03:00
Protesilaos Stavrou 2c585fcb02
Acknowledge Lucas Quintana for denote-grep and related
These were introduced in commit f70c96c, which was contributed by Lucas
Quintana in pull request 571: <https://github.com/protesilaos/denote/pull/571>.

Lucas has assigned copyright to the Free Software Foundation.
2025-03-30 13:03:01 +03:00
Protesilaos Stavrou 027cbe8e4b
Mention denote-grep in the context of the reference to the denote-search package 2025-03-30 13:02:46 +03:00
Protesilaos Stavrou fceb31c429
Document the denote-query-mode and link to it from relevant sections of the manual 2025-03-30 12:57:42 +03:00
Protesilaos Stavrou ba61fa3f82
Document the denote-grep command in the manual 2025-03-30 12:57:26 +03:00
Protesilaos Stavrou 0feb0d4183
Use denote-keywords-prompt instead of the denote-grep-keywords-prompt 2025-03-30 12:43:04 +03:00
Protesilaos Stavrou 75e6e5e8f5
Make all denote-query-mode commands throw an error if called from elsewhere 2025-03-30 12:17:02 +03:00
Protesilaos Stavrou 2bd24bcf72
Rename all commands that interact with the query links buffer and move them outside denote-grep
They apply to all our commands that use the denote-query-mode, so we
want to make that clear already from the symbols we use.
2025-03-30 12:12:51 +03:00
Protesilaos Stavrou d0b97f85f7
Reorganise some parts of the denote-query section in denote.el 2025-03-30 12:12:19 +03:00
Protesilaos Stavrou 27cba1eba2
Remove unrelated command from the denote-query-mode doc string 2025-03-30 12:03:57 +03:00
Protesilaos Stavrou 2f3e3d7e87
Update the doc string of denote-grep-focus 2025-03-30 12:03:23 +03:00
Protesilaos Stavrou 4210564104
Update the manual's documentation of denote-sort-dired-extra-prompts 2025-03-30 11:50:41 +03:00
Protesilaos Stavrou 369f69ac58
Reword the manual about denote-sort-dired 2025-03-30 11:47:19 +03:00
Protesilaos Stavrou 4889421f11
Use stronger language about favouring denote-sequence over some custom sorting 2025-03-30 11:46:50 +03:00
Protesilaos Stavrou 788c2b0c8e
Mention 'denote-sort-dired' in the relevant heading
This makes it easier to discover the command.
2025-03-30 11:41:55 +03:00
Protesilaos Stavrou 6cb1ba15ac
Remove old warnings about version 2.3.0 from a year ago
I expect the interested parties to have made the changes in the meantime.
2025-03-30 11:38:10 +03:00
Protesilaos Stavrou 871bb14ada
Mention version 4.0.0 instead of 3.2.0 in all relevant places
We never released 3.2.0. Since we have made lots of changes we want
to label this as a whole new version of Denote.
2025-03-30 11:34:30 +03:00
Protesilaos Stavrou d915fae73d
Move two denote-query user options closer to their group 2025-03-30 11:33:26 +03:00
Protesilaos Stavrou 64bcaa4c13
Change name of denote-grep group to denote-query 2025-03-30 11:30:32 +03:00
Protesilaos Stavrou ed0fcb0ebf
Make denote-grep-file-regexp-prompt return a string, not assuming it is part of 'interactive'
This is how we do it with all our prompts. In practice, it is used in
an interactive spec though it might be used outside of one (also
considering how users may choose to use our functions).

This builds on top of commit f70c96c, which was contributed by Lucas
Quintana in pull request 571: <https://github.com/protesilaos/denote/pull/571>.

Lucas has assigned copyright to the Free Software Foundation.
2025-03-30 08:45:59 +03:00
Protesilaos Stavrou b2d6b74726
Rename denote-grep-query-history and make the histories reference each other
This is how we do it with all our prompts. In practice, it is used in
an interactive spec though it might be used outside of one (also
considering how users may choose to use our functions).

This builds on top of commit f70c96c, which was contributed by Lucas
Quintana in pull request 571: <https://github.com/protesilaos/denote/pull/571>.

Lucas has assigned copyright to the Free Software Foundation.
2025-03-30 08:44:38 +03:00
Protesilaos Stavrou 2b1a5886c3
Make denote-grep-query-prompt return a string, not assuming it is part of 'interactive'
This is how we do it with all our prompts. In practice, it is used in
an interactive spec though it might be used outside of one (also
considering how users may choose to use our functions).

This builds on top of commit f70c96c, which was contributed by Lucas
Quintana in pull request 571: <https://github.com/protesilaos/denote/pull/571>.

Lucas has assigned copyright to the Free Software Foundation.
2025-03-30 08:40:30 +03:00
Protesilaos Stavrou 0e12927aab
Make small tweaks to denote-grep-query-prompt doc string
This builds on top of commit f70c96c, which was contributed by Lucas
Quintana in pull request 571: <https://github.com/protesilaos/denote/pull/571>.

Lucas has assigned copyright to the Free Software Foundation.
2025-03-30 08:40:15 +03:00
Protesilaos Stavrou e9a16611a3
Placate the compiler about denote-grep-clear-all-filters
This builds on top of commit f70c96c, which was contributed by Lucas
Quintana in pull request 571: <https://github.com/protesilaos/denote/pull/571>.

Lucas has assigned copyright to the Free Software Foundation.
2025-03-30 08:35:37 +03:00
Protesilaos Stavrou 93b15ee6de
Placate the compiler about denote-retrieve-xref-alist
This builds on top of commit f70c96c, which was contributed by Lucas
Quintana in pull request 571: <https://github.com/protesilaos/denote/pull/571>.

Lucas has assigned copyright to the Free Software Foundation.
2025-03-30 08:34:55 +03:00
Protesilaos Stavrou 66746544bc
Rewrite denote-query-extract-title to follow our style in other places
This builds on top of commit f70c96c, which was contributed by Lucas
Quintana in pull request 571: <https://github.com/protesilaos/denote/pull/571>.

Lucas has assigned copyright to the Free Software Foundation.
2025-03-30 08:31:50 +03:00
Protesilaos Stavrou eba08ae52e
Update the doc strings of the internal variables used by denote-make-links-buffer
This builds on top of commit f70c96c, which was contributed by Lucas
Quintana in pull request 571: <https://github.com/protesilaos/denote/pull/571>.

Lucas has assigned copyright to the Free Software Foundation.
2025-03-30 08:28:26 +03:00
Protesilaos Stavrou 6cbf2fcb67
Introduce the denote-grep group and update user options accordingly
I have not written that node in the manual yet, but I will do it after
I am done editing denote.el.

This builds on top of commit f70c96c, which was contributed by Lucas
Quintana in pull request 571: <https://github.com/protesilaos/denote/pull/571>.

Lucas has assigned copyright to the Free Software Foundation.
2025-03-30 08:26:31 +03:00
Protesilaos Stavrou bd74eb2390
Change denote-grep-refine to denote-grep-focus
This builds on top of commit f70c96c, which was contributed by Lucas
Quintana in pull request 571: <https://github.com/protesilaos/denote/pull/571>.

Lucas has assigned copyright to the Free Software Foundation.
2025-03-30 08:21:33 +03:00
Protesilaos Stavrou d220ff854d
Update denote-query-mode-map doc string
This builds on top of commit f70c96c, which was contributed by Lucas
Quintana in pull request 571: <https://github.com/protesilaos/denote/pull/571>.

Lucas has assigned copyright to the Free Software Foundation.
2025-03-30 08:21:29 +03:00
Protesilaos Stavrou e64daa0cd6
Remove 'require' for outline because outline-minor mode is autoloaded already
This builds on top of commit f70c96c, which was contributed by Lucas
Quintana in pull request 571: <https://github.com/protesilaos/denote/pull/571>.

Lucas has assigned copyright to the Free Software Foundation.
2025-03-30 08:21:26 +03:00
Protesilaos Stavrou e4187ee517
Update the doc string of denote-query-mode
This builds on top of commit f70c96c, which was contributed by Lucas
Quintana in pull request 571: <https://github.com/protesilaos/denote/pull/571>.

Lucas has assigned copyright to the Free Software Foundation.
2025-03-30 08:21:22 +03:00
Protesilaos Stavrou 5e44e8f8bf
Merge pull request #571 from lmq-10/search-improvements
Add some useful features to query buffers
2025-03-30 08:14:53 +03:00
Lucas Quintana f70c96c5ca Merge main features from denote-search into Denote 2025-03-29 14:13:20 -03:00
Protesilaos Stavrou 9aed12156e
Merge pull request #569 from jeanphilippegg/docstring
Add info in docstring of denote-file-name-components-order
2025-03-29 18:40:53 +02:00
Jean-Philippe Gagné Guay b5eac20052 Add info in docstring of denote-file-name-components-order 2025-03-29 10:51:51 -04:00
Protesilaos Stavrou ec045e814b
Include the two new direct link commands in the menu bar (see commit ba08101) 2025-03-29 09:25:57 +02:00
Protesilaos Stavrou d7a46ae47c
Remove needless node in the manual for two link aliases and mention those in context 2025-03-29 09:22:24 +02:00
Protesilaos Stavrou 38b0e922e7
Remove alias for denote-add-links 2025-03-29 09:22:10 +02:00
Protesilaos Stavrou c1b0fecc70
Document new linking commands for direct links to files with content match (per commit ba08101) 2025-03-29 09:18:29 +02:00
Protesilaos Stavrou ba081010fa
Define commands to create direct links to files whose contents match a query 2025-03-29 09:17:51 +02:00
Protesilaos Stavrou 54480f9f86
Clarify denote-add-links doc string 2025-03-29 09:17:39 +02:00
Protesilaos Stavrou 2885ce0d62
Add denote-query-link-prompt to denote-prompts-with-history-as-completion 2025-03-29 07:37:45 +02:00
Protesilaos Stavrou d59645cd03
Reorganise some backlink-related functions to be under the same outline heading 2025-03-29 07:33:41 +02:00
Protesilaos Stavrou e88af3a4aa
Merge pull request #567 from eum3l/fix-org-location-links
Fix Org links with location identifiers
2025-03-28 20:33:04 +02:00
eum3l 319107ecfd
Trim Org link location identifiers when necessary 2025-03-28 19:02:10 +01:00
Protesilaos Stavrou 9422778efa
Add missing autoload cookies for non-Org link fontification 2025-03-28 08:42:28 +02:00
Protesilaos Stavrou 25409b6092
Add denote-sort-dired to the menu bar 2025-03-28 08:42:04 +02:00
Protesilaos Stavrou 9d32f611e7
Add query links to the menu bar 2025-03-28 08:40:09 +02:00
Protesilaos Stavrou a795d23f12
Document the new query links and update the manual accordingly 2025-03-28 08:37:40 +02:00
Protesilaos Stavrou dec1087e01
Update the doc string of denote-query-filenames-link 2025-03-28 08:24:57 +02:00
Protesilaos Stavrou 7e0a7944e1
Update the doc string of denote-query-contents-link 2025-03-28 08:24:50 +02:00
Protesilaos Stavrou 61d2192009
Remove needless denote-fontify-query-links (per commit ff50b32)
The technical discussion for this is in issue 561:
<https://github.com/protesilaos/denote/issues/561>.
2025-03-27 11:56:48 +02:00
Protesilaos Stavrou ff50b32258
Revise "link in context" regexp to also cover query links 2025-03-27 11:55:56 +02:00
Protesilaos Stavrou d45ace3fb6
Make query links use their own face (amend 83b6e35)
The technical discussion for this is in issue 561:
<https://github.com/protesilaos/denote/issues/561>.
2025-03-27 11:44:12 +02:00
Protesilaos Stavrou 83b6e35880
Make query links use their own face in Org buffers
I will extend this to 'denote-fontify-links'. The technical discussion
for this is in issue 561: <https://github.com/protesilaos/denote/issues/561>.
2025-03-27 11:40:02 +02:00
Protesilaos Stavrou 6810d13daf
Add WORK-IN-PROGRESS formatting of query links to include a description text
The technical discussion for this is in issue 561:
<https://github.com/protesilaos/denote/issues/561>.
2025-03-27 08:03:38 +02:00
Protesilaos Stavrou be557935dc
Add error check to query links to ensure they exit if the file type is unrecognised 2025-03-27 07:52:45 +02:00
Protesilaos Stavrou b272883038
Use upper case letters in the query links prompts to improve usability 2025-03-27 07:52:25 +02:00
Protesilaos Stavrou 5f503529e4
Use "Denote Query" name on the modeline for denote-query-mode 2025-03-27 07:40:10 +02:00
Protesilaos Stavrou dbea20fde2
Make sure that denote--query-last-dired-buffer is a buffer 2025-03-27 07:37:26 +02:00
Protesilaos Stavrou c12c245344
Add two outline headings for backlinks and query links 2025-03-27 07:37:11 +02:00
Protesilaos Stavrou e1475d1c2b
Change denote-query-links-buffer-function in the interest of simplicity
The technical discussion for this is in issue 561:
<https://github.com/protesilaos/denote/issues/561>.
2025-03-27 07:34:26 +02:00
Protesilaos Stavrou 0d992fa74d
Merge branch 'main' into query-links 2025-03-27 07:22:50 +02:00
Protesilaos Stavrou 89071cffce
Expand query links to also work for file names and change their format
I am now using the format suggested by Jean-Philippe Gagné Guay, which
is "denote:TYPE:QUERY". The technical discussion for this is in issue 561:
<https://github.com/protesilaos/denote/issues/561>.

Perhaps there is a way to apply a different face to the query links,
though I do not think this is a critical feature.

What remains to be decided is if we can/should have shorter TYPE
values than the ones I am using now.
2025-03-27 06:19:41 +02:00
Protesilaos Stavrou 27b8f0ad1d
Set denote-org-store-link-to-heading to nil
This makes it easier to reason about Denote links. The addition of a
link to the heading/context/CUSTOM_ID is better left for those who
want to opt in to the feature.
2025-03-26 08:43:57 +02:00
Protesilaos Stavrou ec0ca7da9d
Fix alias for denote-sort-dired 2025-03-25 06:36:55 +02:00
Protesilaos Stavrou 68b84289fc
Reposition the denote-fontify-links part after the links buffer 2025-03-24 16:44:56 +02:00
Protesilaos Stavrou c2f3ca7cf4
Make denote-fontify-links also work with query links
The technical discussion for this is in issue 561:
<https://github.com/protesilaos/denote/issues/561>.
2025-03-24 16:43:25 +02:00
Protesilaos Stavrou d2aa0cd683
Make function to get query links a variable
This way it can be redefined by other packages, such as
'denote-search'. Thanks to Lucas Quintana for asking for this addition
in issue 561: <https://github.com/protesilaos/denote/issues/561>.
2025-03-24 16:09:16 +02:00
Protesilaos Stavrou 24b95a62d2
Merge pull request #562 from eum3l/fix-link-collisions
Respect encryption-file-extensions in get-path-by-id
2025-03-24 15:57:57 +02:00
eum3l d931f37ff8
Respect encryption-file-extensions in get-path-by-id 2025-03-24 12:23:31 +01:00
Protesilaos Stavrou 388227986b
Make denote-query-links-display-buffer-action not fit to buffer
Because in that scenario it can take up almost the entire height of
the frame. Whereas this is less likely for backlinks.
2025-03-24 10:05:03 +02:00
Protesilaos Stavrou 7aaf9be29f
Make 'denote-query' also use the active region 2025-03-24 08:17:28 +02:00
Protesilaos Stavrou 490ad08718
Make 'denote-query' insert a link without checking for matches
Users who use this will most probably want to insert the link and then
fill out the matches as they go.
2025-03-24 08:10:57 +02:00
Protesilaos Stavrou bb4d193d94
Remove FILES-MATCHING-REGEXP parameter from 'denote-query'
It makes no sense there, but the idea is still useful in other applications.
2025-03-24 08:10:02 +02:00
Protesilaos Stavrou 11def0d0c5
Add 'mode' and remove 'dedicated' from display-buffer action alist
Otherwise, it keeps creating new windows and
'dispplay-buffer-reuse-mode-window' does not do the right thing.
2025-03-24 08:02:36 +02:00
Protesilaos Stavrou c0f55df1f9
Make the display-buffer action reuse the mode window
This was always my intention and I made a mistake before.
2025-03-24 07:47:57 +02:00
Protesilaos Stavrou a612e42567
Add initial support for query links
I still need to work on the link implementation for file types other
than Org (in 'denote-fontify-links' and related) and then expand the
manual to document all the changes herein. Though I want to make this
commit first to give others the chance to review the code.
2025-03-24 07:37:07 +02:00
Protesilaos Stavrou e41fd8ebc7
Make file prompt of the "... or create" commands more informative 2025-03-23 17:22:28 +02:00
Protesilaos Stavrou e9bb949ce2
Merge pull request #560 from jeanphilippegg/revert-commits
Reapply a fix that was undone in previous PR
2025-03-23 11:34:33 +02:00
Jean-Philippe Gagné Guay 01e11e1db1 Reapply a fix that was undone in a previous commit 2025-03-22 11:29:52 -04:00
Protesilaos Stavrou 9743ece3b6
Merge pull request #558 from jeanphilippegg/revert-commits
Revert commits about renaming org-capture buffers
2025-03-22 16:28:11 +02:00
Protesilaos Stavrou 721235b47e
Revert "Make 'denote-directory-files' accept optional DIRECTORY"
This reverts commit c0df642eca.

We will use the approach suggested by Jean-Philippe Gagné Guay in
issue 559, namely, to 'let' bind the denote-directory where we need to
without adding too many parameters to the 'denote-directory-files':
<https://github.com/protesilaos/denote/issues/559>.
2025-03-22 16:21:21 +02:00
Jean-Philippe Gagné Guay d35b383e56 Revert "Make renaming commands work in org-capture buffer"
This reverts commit 5cd129030a.
2025-03-22 09:46:07 -04:00
Jean-Philippe Gagné Guay a90c1cdffb Revert "Add hook to rename file after denote-org-capture"
This reverts commit 8d1202d2e8.
2025-03-22 09:41:12 -04:00
Protesilaos Stavrou c0df642eca
Make 'denote-directory-files' accept optional DIRECTORY
This is to support a use-case in 'denote-journal' of setting a path
outside the 'denote-directory', as reported by Kevin McCarthy in issue
1 on the 'denote-journal' repository: <https://github.com/protesilaos/denote-journal/issues/1>.
2025-03-21 11:33:21 +02:00
Protesilaos Stavrou 31e52a6646
Acknowledge eum3l for commit 4868189: renaming encrypted files preserves extensions
This was done in pull request 557: <https://github.com/protesilaos/denote/pull/557>.
The change is small, meaning that eum3l does not need to assign
copyright to the Free Software Foundation.
2025-03-18 06:45:48 +02:00
Protesilaos Stavrou a56c7ddf03
Merge pull request #557 from eum3l/fix-encrypted-rename
Use denote-get-file-extension in denote--rename-file
2025-03-18 06:44:50 +02:00
eum3l 4868189dc0
Use denote-get-file-extension in denote--rename-file 2025-03-17 18:26:22 +01:00
Protesilaos Stavrou 46f4799342
Rewrite denote--inferred-keywords as denote-infer-keywords-from-files 2025-03-17 09:02:07 +02:00
Protesilaos Stavrou e65c00c18f
Document denote-keywords optional FILES-MATCHING-REGEXP (per commit 05d6c12) 2025-03-17 08:52:03 +02:00
Protesilaos Stavrou 47d7d02503
Add subsections to the manual's documentation of developer-facing symbols 2025-03-17 08:48:41 +02:00
Protesilaos Stavrou 34690c44d6
Merge branch 'main' of github.com:protesilaos/denote 2025-03-17 07:15:06 +02:00
Protesilaos Stavrou e964be04f0
Document the public xref functions we provide (see 773de77, fa7cc80) 2025-03-17 07:14:23 +02:00
Protesilaos Stavrou fa7cc80bb0
Make the xref functions we have public 2025-03-17 07:13:35 +02:00
Protesilaos Stavrou 773de77a01
Abstract denote--retrieve-xref-alist from backlinks' buffer preparation into its own function
This way it can more easily be used elsewhere.
2025-03-17 07:13:25 +02:00
Protesilaos Stavrou 2571667b85
Move the installation and sample configuration sections closer to the top
Otherwise they are hard to find, which is especially important for
inexperienced users.
2025-03-16 18:23:46 +02:00
Protesilaos Stavrou e1984b7df3
Make development-version be 4.0.0 since we have lots of breaking changes 2025-03-16 18:21:30 +02:00
Protesilaos Stavrou 0dcd487b40
Remove comment in function denote-directory about deprecated values 2025-03-15 07:27:49 +02:00
Protesilaos Stavrou 1db0307976
Merge branch 'reorganise-denote'
This concludes the work originally announced in issue 543:
<https://github.com/protesilaos/denote/issues/543>. Latest update on
my website: <https://protesilaos.com/codelog/2025-03-14-emacs-denote-many-packages/>.
2025-03-15 07:01:07 +02:00
Protesilaos Stavrou 61c16e87ce
Remove all references to denote-md-extras and point to denote-markdown package
This is part of the effort to reorganise the project, as announced in
issue 543: <https://github.com/protesilaos/denote/issues/543>.
2025-03-13 06:33:14 +02:00
Protesilaos Stavrou e29488099b
Clarify a point about using the denote-sequence package 2025-03-13 06:32:11 +02:00
Protesilaos Stavrou c7a7ffd81b
Reposition the manual's entry about denote-sequence 2025-03-12 19:51:28 +02:00
Protesilaos Stavrou 4efeb26212
Reposition the manual's entry about denote-journal 2025-03-12 19:50:08 +02:00
Protesilaos Stavrou b7ce6f43d6
Clean up the manual about the denote-silo-extras.el and point to denote-silo package
This is part of the effort to reorganise the project, as announced in
issue 543: <https://github.com/protesilaos/denote/issues/543>.
2025-03-12 19:47:53 +02:00
Protesilaos Stavrou 657859ce49
Remove all journal-related documentation (all is done in denote-journal package)
This is part of the effort to reorganise the project, as announced in
issue 543: <https://github.com/protesilaos/denote/issues/543>.
2025-03-12 09:13:19 +02:00
Protesilaos Stavrou ba165ee456
Make the function denote-directory produce a warning for obsolete uses
Thanks to Jean-Philippe Gagné Guay for discussing this with me as an
aside to issue 543: <https://github.com/protesilaos/denote/issues/543#issuecomment-2708670893>.
2025-03-11 17:24:57 +02:00
Protesilaos Stavrou 90464bab71
WORK-IN-PROGRESS Remove denote-journal-extras.el and move it to https://github.com/protesilaos/denote-journal
This is part of the effort to reorganise the project, as announced in
issue 543: <https://github.com/protesilaos/denote/issues/543>.
2025-03-06 11:58:34 +02:00
Protesilaos Stavrou 484ba750dd
WORK-IN-PROGRESS Remove denote-md-extras.el and move it to https://github.com/protesilaos/denote-markdown
This is part of the effort to reorganise the project, as announced in
issue 543: <https://github.com/protesilaos/denote/issues/543>.
2025-03-06 11:58:23 +02:00
Protesilaos Stavrou 5601dfc154
WORK-IN-PROGRESS Remove denote-silo-extras.el and move it to https://github.com/protesilaos/denote-silo
This is part of the effort to reorganise the project, as announced in
issue 543: <https://github.com/protesilaos/denote/issues/543>.
2025-03-06 11:56:56 +02:00
Protesilaos Stavrou e83ab6f106
Use correct optional parameter in denote-link-ol-store (amend commit 20005e6)
Thanks to duli for the feedback in issue 552: <https://github.com/protesilaos/denote/issues/552>.
2025-03-01 09:10:48 +02:00
Protesilaos Stavrou 4ade384c03
Fix typo from commit 05d6c12 2025-03-01 09:09:09 +02:00
Protesilaos Stavrou 05d6c120bb
Make it possible to infer keywords only from files matching regexp
I will update the manual later because I am still working on another
branch that modifies the README.org and I do not want to bother with
a messy conflict resolution.
2025-03-01 09:06:45 +02:00
Protesilaos Stavrou 20005e666a
Make denote-link-ol-store accept any arguments passed to it
This is due to how org-store-link may use the function internally.

Thanks to kalisduli for reporting the problem in issue 552:
<https://github.com/protesilaos/denote/issues/552>.
2025-03-01 08:01:41 +02:00
Protesilaos Stavrou 4f29280051
Resolve all broken links to the now-removed denote-org-extras.el 2025-02-18 08:23:04 +02:00
Protesilaos Stavrou 1d6ed64965
Make small correction to indent a nested list in the manual 2025-02-18 08:22:46 +02:00
Protesilaos Stavrou ce458a987f
Remove all references to denote-org-extras.el and adapt the manual accordingly
This is part of the wider reorganisation of the project, as discussed
in issue 543: <https://github.com/protesilaos/denote/issues/543>.
2025-02-18 08:17:36 +02:00
Protesilaos Stavrou 78e352ad85
Tweak the wording of the reference to denote-sequence 2025-02-18 08:17:12 +02:00
Protesilaos Stavrou bde689cc9b
Remove Org extras as part of the wider project reorganisation
Covered here: <https://protesilaos.com/codelog/2025-02-11-emacs-splitting-denote-many-packages/>

Issue in the main Denote GitHub repository: <https://github.com/protesilaos/denote/issues/543>.
2025-02-15 10:28:40 +02:00
Protesilaos Stavrou 053cbddd25
Clarify development note about denote-sequence.el 2025-02-10 09:00:56 +02:00
Protesilaos Stavrou 5fc634ebc4
REMOVE denote-sequence.el as it will be its own package
This is part of the wider reorganisation of the project, as discussed
in issue 543: <https://github.com/protesilaos/denote/issues/543>.
2025-02-10 08:51:54 +02:00
Protesilaos Stavrou d5f8a6e11b
Merge denote-rename-buffer.el into denote.el
This is part of the wider reorganisation of the project, as discussed
in issue 543: <https://github.com/protesilaos/denote/issues/543>.
2025-02-07 11:19:13 +02:00
Protesilaos Stavrou 035e1452fe
Merge denote-sort.el into denote.el
This is part of the wider reorganisation of the project, as discussed
in issue 543: <https://github.com/protesilaos/denote/issues/543>.
2025-02-07 11:13:25 +02:00
Protesilaos Stavrou 212a1b3c17
Remove references to non-existent denote-link-or-create-with-command
We deleted it at some point, but did not remove everything. Thanks to
Jean-Philippe Gagné Guay for bringing this matter to my attention in
the discussion about reorganising the Denote code base. Issue 543:
<https://github.com/protesilaos/denote/issues/543>.
2025-02-05 08:12:07 +02:00
Protesilaos Stavrou 875c82c85d
Merge pull request #541 from frnsd/fix-sequence-prefix
Add tests for false matches addressed by pull request #540 and fix related issues
2025-02-03 17:51:25 +02:00
Kierin Bell f984340947 Fix 'denote-sequence-find-dired' error with TYPE 'parent'
A list is expected by 'denote-sequence-sort-files', but
'denote-sequence-get-relative' can return a string when called with TYPE
'parent'.
2025-01-31 20:58:16 -05:00
Kierin Bell 01251c6c5d Check for empty sequence in 'denote-sequence-get-all-files-with-prefix'
This prevents an error when calling 'denote-sequence-split' with an
empty string.  In particular, this happens when
'denote-sequence-get-relative' is called with TYPE 'siblings' on a
top-level sequence.  'denote-sequence-get-all-sequences-with-prefix' is
apparently not used in a context where it would receive an empty
sequence, but check for empty sequences there as well for consistency.
2025-01-31 20:57:45 -05:00
Kierin Bell a0c7086ebd Fix type prompt in interactive form of 'denote-sequence-find-dired'
The type is passed to 'denote-sequence-get-relative', which uses types
that are slightly different than those in 'denote-sequence-types'.  Also
update the error message displayed by 'denote-sequence-get-relative'
when it receives an unrecognized type to reflect that it no longer uses
the types from 'denote-sequence-types'.
2025-01-31 20:52:58 -05:00
Kierin Bell f6c6763402 Fix false matches in 'denote-sequence-get-all-files-with-prefix'
Create the new helper function 'denote-sequence--sequence-prefix-p' and
use it in both 'denote-sequence-get-all-files-with-prefix' and
'denote-sequence-get-all-sequences-with-prefix'.
2025-01-31 20:52:51 -05:00
Kierin Bell df89c98b42 Update dt-denote-sequence--get-new-exhaustive for false matches with a common prefix
The new tests will detect false matches resulting from confusing
sequence "1" with "10", "11", "100", etc.
2025-01-31 19:17:11 -05:00
Protesilaos Stavrou 322d6d493e
Update dt-denote-sequence--get-new-exhaustive to account for all denote-sequence-relative-types 2025-01-31 10:42:08 +02:00
Protesilaos Stavrou bd34f5e600
Acknowledge Kierin Bell for commit c76b313
This was done in pull request 540:
<https://github.com/protesilaos/denote/pull/540>. The change is less
than 15 lines, meaning that Kierin does not need to assign copyright
to the Free Software Foundation.
2025-01-31 10:35:17 +02:00
Protesilaos Stavrou 70e85ef34c
Merge pull request #540 from frnsd/fix-sequence-prefix
Fix false matches in 'denote-sequence-get-all-sequences-with-prefix'
2025-01-31 10:34:24 +02:00
Kierin Bell c76b313352 Fix false matches in 'denote-sequence-get-all-sequences-with-prefix'
Change the prefix match test from 'string-prefix-p' to an algorithm
that compares entire prefix components individually.
2025-01-30 17:12:15 -05:00
Protesilaos Stavrou 88de969826
Update the manual's Acknowledgements for commit 6f88b23
I forgot to do it there and pushed that commit before amending it...
2025-01-27 09:29:09 +02:00
Protesilaos Stavrou 6f88b2377f
Add an obsolete alias for denote-slug-hyphenate
In principle, we should not be doing this for private symbols, but it
helps with transitioning old code to the new normal. We have had this
practice for a long time now (and I eventually remove those warnings a
few releases afterwards).

Thanks to bdillahu for reporting the issue with some sample code in
the manual and to Jean-Philippe Gagné Guay for confirming the problem.
This was done in issue 538: <https://github.com/protesilaos/denote/issues/538>.
2025-01-27 09:25:44 +02:00
Protesilaos Stavrou 1bf9eba5aa
Improve the :type of denote-backlinks-display-buffer-action and make it ":risky t" 2025-01-25 09:06:26 +02:00
Protesilaos Stavrou 5fffe39b05
Replace denote-current-title with denote-current-data and document it in the manual 2025-01-22 07:58:37 +02:00
Protesilaos Stavrou 01ca4eba82
Make the denote-sequence annotation functions align their annotations 2025-01-21 17:47:48 +02:00
Protesilaos Stavrou f822f2c2c9
Fix indentation in denote-sequence--get-largest-by-length 2025-01-21 17:44:53 +02:00
Protesilaos Stavrou 0589a5cc93
Use 'denote-sequence-find-dired' in the manual 2025-01-21 11:16:51 +02:00
Protesilaos Stavrou 510bc68ce4
Rename denote-sequence-find-relatives-dired to denote-sequence-find-dired 2025-01-21 11:16:04 +02:00
Protesilaos Stavrou a767b7885c
Expand sequence relative to disambiguate "parent" from "all parents" and same for children 2025-01-21 11:14:21 +02:00
Protesilaos Stavrou 373b2838b5
Remove the convenience wrappers of denote-sequence-find
We do not need to have all those, because then we will end up with too
many commands.
2025-01-21 11:13:30 +02:00
Protesilaos Stavrou e0f1d471d5
Define variable that can be let bound to limit 'denote-file-prompt'
This is in response to a question by Alan Schmitt in issue 536:
<https://github.com/protesilaos/denote/issues/536>. Also thanks to
Jean-Philippe Gagné Guay for the comment about whether this is a
useful feature.
2025-01-21 08:13:16 +02:00
Protesilaos Stavrou 5ee556fdc1
Merge pull request #537 from jeanphilippegg/denote-current-title
New denote-current-title variable
2025-01-20 08:31:09 +02:00
Jean-Philippe Gagné Guay 1a13b6a22f Add denote-current-title variable 2025-01-19 21:18:08 -05:00
Protesilaos Stavrou 605534495b
Define annotation-function for denote-sequence-type-prompt and parameterise it accordingly 2025-01-19 09:33:03 +02:00
Protesilaos Stavrou 03107fe702
Make small refinement to denote-sequence-find 2025-01-19 09:17:29 +02:00
Protesilaos Stavrou bc0a6de3ad
Document how to have a "controlled vocabulary" of keywords 2025-01-18 09:58:45 +02:00
Protesilaos Stavrou bad5ee6ae4
Rephrase the paragraph about signatures in the manual's file-naming scheme section 2025-01-18 07:45:25 +02:00
Protesilaos Stavrou d3b377792a
Remove long obsolete reference from the manual 2025-01-18 07:33:30 +02:00
Protesilaos Stavrou 2344264c8d
Make small changes to the denote-link docs 2025-01-18 07:32:11 +02:00
Protesilaos Stavrou 04a09aff19
Update the denote-prompts documentation to better describe signatures 2025-01-18 07:32:05 +02:00
Protesilaos Stavrou 12062e238c
DEPRECATE denote-link-with-signature
The denote-link command already inserts a signature if it is there,
plus we have the denote-link-description-format, which can be set to
whatever style the user prefers. This command I am deprecating was
basically doing what a user gets as soon as they type = in the
minibuffer (which will match files that have a signature).
2025-01-18 07:32:05 +02:00
Protesilaos Stavrou 29e47e255a
Refine denote-link--prepare-backlinks to map over the results only once 2025-01-18 07:04:41 +02:00
Protesilaos Stavrou c2a734ab1c
Use the correct outline level for the 'denote:' Org hyperlink 2025-01-18 06:37:11 +02:00
Protesilaos Stavrou 7a541fe223
Use the correct outline level for the menu bar entry 2025-01-18 06:36:27 +02:00
Protesilaos Stavrou bc12b58beb
Document in the manual denote-sequence-find-relatives-dired 2025-01-17 12:49:41 +02:00
Protesilaos Stavrou 0e72995d76
Define denote-sequence-find-relatives-dired command 2025-01-17 12:47:24 +02:00
Protesilaos Stavrou 4470e316fa
Document in the manual the denote-sequence-find command and related 2025-01-17 09:51:31 +02:00
Protesilaos Stavrou f6b5770b97
Add denote-sequence-find command and helper wrappers to get relatives 2025-01-17 09:46:38 +02:00
Protesilaos Stavrou 14fc0197a2
Make denote-sequence-get-relative get parents more reliably 2025-01-17 09:38:41 +02:00
Protesilaos Stavrou dc59f0477c
Make denote-sequence-type-prompt accepte optional PROMPT-TEXT 2025-01-17 09:07:11 +02:00
Protesilaos Stavrou 2fe245806e
Update dt-denote-sequence--get-new-exhaustive to all test for relatives 2025-01-17 09:04:37 +02:00
Protesilaos Stavrou 47fbde671a
Make denote-sequence-get-relative correctly get the parents 2025-01-17 09:03:26 +02:00
Protesilaos Stavrou 71630b9510
Add denote-sequence-get-relative function
This foreshadows commands I will introduce shortly.
2025-01-17 08:41:17 +02:00
Protesilaos Stavrou 78392b86ba
Rename dt-denote-sequence--get-new-child-and-sibling to dt-denote-sequence--get-new-exhaustive
Add the test for parent as well.
2025-01-17 08:22:37 +02:00
Protesilaos Stavrou 0c4fcdedcc
Update dt-denote-sequence--get-new-child-and-sibling to use denote-sequence-get-new 2025-01-17 08:19:32 +02:00
Protesilaos Stavrou 9a5d7f912e
Make denote-sequence-get-new accept SEQUENCES like all its helper functions 2025-01-17 08:15:57 +02:00
Protesilaos Stavrou 3a3cc6603d
Use denote-sequence-get-all-files instead of its helper (extend 7d4c194) 2025-01-17 08:10:38 +02:00
Protesilaos Stavrou 7d4c194365
Make denote-sequence-get-all-files accept optional FILES 2025-01-17 08:09:15 +02:00
Protesilaos Stavrou ee33e1081c
Rename denote-sequence-get to denote-sequence-get-new
It is more obvious what it does.
2025-01-17 08:04:39 +02:00
Protesilaos Stavrou dd72f341dd
Make the denote-file-prompt 'let' bind the default-directory
This way, any other function that needs to derive the file path from
the completion candidates will do it correctly.

I discovered this by discussing with Alan Schmitt an issue involving
the Embark package. This was done in discussion 524:
<https://github.com/protesilaos/denote/discussions/524>.
2025-01-17 08:01:22 +02:00
Protesilaos Stavrou 15eaa656e7
Document in the manual the denote-sequence-convert command 2025-01-15 17:15:33 +02:00
Protesilaos Stavrou 7136c7d060
Add denote-sequence-convert command 2025-01-15 17:15:28 +02:00
Protesilaos Stavrou f23f84c6e3
Rename the function denote-sequence-convert to denote-sequence-make-conversion
The old name is better for a command.
2025-01-15 16:47:43 +02:00
Protesilaos Stavrou a7e902e680
Remove needless constant denote-sequence-schemes 2025-01-15 16:24:08 +02:00
Protesilaos Stavrou 8da349fc23
Rephrase the Commentary of denote-sequence.el 2025-01-15 16:19:11 +02:00
Protesilaos Stavrou d934da26eb
Make dt-denote-sequence--get-new-child-and-sibling use the system trash 2025-01-15 16:13:53 +02:00
Protesilaos Stavrou 9bf22d57ec
Make denote-org-link-in-context-regexp also cover the search extension
This is because our 'denote:' links have the same capabilities as the
'file:' links with regard to moving to a specific position in the
buffer.

Thanks to leafarbelm for reporting the bug in issue 523:
<https://github.com/protesilaos/denote/issues/523>.
2025-01-15 08:25:02 +02:00
Protesilaos Stavrou 814b069d46
Merge pull request #528 from migliio/main
Fix the regression bug discussed in #526
2025-01-15 08:05:15 +02:00
Claudio Migliorelli 237d559d50 Fix the regression bug discussed in #526
This patch fixes the regression bug in
`denote-sequence-get-all-files`, as discussed in #526. The core idea
behind this fix is to delete duplicates within the list of files and
buffers in the `denote-directory` matching a certain signature.
2025-01-14 19:00:35 +01:00
Protesilaos Stavrou c795f147d7
Fix unbalanced parentheses in denote-sequence--get-file-in-dired-or-prompt 2025-01-14 08:12:18 +02:00
Protesilaos Stavrou 0381e59216
Clarify the denote-sequence-file-p doc string 2025-01-14 07:56:17 +02:00
Protesilaos Stavrou 584235fe9f
Make denote-sequence-new-{child,sibling}-of-current also work for file in Dired 2025-01-14 07:56:11 +02:00
Protesilaos Stavrou e8d5f68609
Add TODO about a recursive denote-sequence-reparent 2025-01-14 07:53:25 +02:00
Protesilaos Stavrou a7d0797c82
Remove a TODO about denote-sequence that pertains to sluggification
I tried it and we are okay without it.
2025-01-14 07:52:52 +02:00
Protesilaos Stavrou 946dece0bc
Use corrent name of parameter in doc string of denote-sequence 2025-01-14 07:52:35 +02:00
Protesilaos Stavrou 5992140c9a
Remove the needless denote-sequence--tail-alphanumeric-p 2025-01-14 07:52:23 +02:00
Protesilaos Stavrou 69f23c9f95
Reeword denote-sequence-get-all-sequences-with-prefix doc string 2025-01-14 07:52:00 +02:00
Protesilaos Stavrou 6ca703f463
Reword denote-sequence-get-all-sequences doc string 2025-01-14 07:51:45 +02:00
Protesilaos Stavrou 705988ede0
Be consistent with the regexp group in two sequence functions 2025-01-14 07:50:59 +02:00
Protesilaos Stavrou b596ca71ad
Consolidate the tests of new child or sibling sequences 2025-01-13 11:24:54 +02:00
Protesilaos Stavrou f9f779847c
Make denote-sequence--get-largest more robust when getting a child 2025-01-13 11:13:51 +02:00
Protesilaos Stavrou fa635a9f89
Remove superfluous condition in denote-sequence--get-new-child 2025-01-13 09:26:03 +02:00
Protesilaos Stavrou 4e62c3f2b6
Rewrite and expand the manual about denote-sequence.el 2025-01-12 11:24:25 +02:00
Protesilaos Stavrou a4d3d62b26
Clarify how denote-sequence can be loaded 2025-01-12 11:03:27 +02:00
Protesilaos Stavrou 6e9473cd4f
Merge branch 'alphanumeric-sequence-extension' 2025-01-12 11:01:12 +02:00
Protesilaos Stavrou a717f46eee
Make denote-sequence-convert also convert complete sequences 2025-01-12 10:57:42 +02:00
Protesilaos Stavrou 26f43c8aec
Make denote-sequence-alphanumeric-p require numeric prefix 2025-01-12 10:57:23 +02:00
Protesilaos Stavrou 182db0675e
Expand tests to also cover alphanumeric sibling sequences 2025-01-12 10:21:53 +02:00
Protesilaos Stavrou a0188e7cba
Expand tests to also cover alphanumeric child sequences 2025-01-12 10:19:44 +02:00
Protesilaos Stavrou b642758ff9
Ensure the sequence tests target the implied scheme 2025-01-12 10:16:07 +02:00
Protesilaos Stavrou 14dd0b5d2e
Make denote-sequence--get-new-child work with alphanumeric sequences 2025-01-12 10:15:56 +02:00
Protesilaos Stavrou 4997e6b007
Rename denote-sequence-get-sequences-with-max-depth to include "all"
This is to keep it consistent with all the other similar functions.
2025-01-12 09:53:10 +02:00
Protesilaos Stavrou 913571e79e
Make sure denote-sequence-get-sequences-with-max-depth returns all up to depth
Before it was returning only those with the given depth number.
2025-01-12 08:58:01 +02:00
Protesilaos Stavrou 803cafc128
Make sequence retrieval also check for unsaved files
Otherwise users may not know why a command that produces a given
sequence does not use the expected number. Thanks to elliottw for
reporting this in issue 519: <https://github.com/protesilaos/denote/issues/519>.
2025-01-12 08:57:55 +02:00
Protesilaos Stavrou 43bd30e6eb
Make the groundwork for alphanumeric (Luhmann) sequences in denote-sequence.el
The idea is to support both numeric and alphanumeric sequencing
schemes, as documented in the new user option 'denote-sequence-scheme'.

We now have the tools to correctly split, join, increment, and convert
input accordingly, such that we can, for example, accurately produce a
child of sequence "1a2" (we could already do that for numeric
sequences).

What is covered herein is just the groundwork. I still need to extend
the helper functions which directly support the creation of new
parent, child, or sibling sequences. While this still is a lot of
work, the hard part is now done.
2025-01-11 19:37:56 +02:00
Protesilaos Stavrou 07aec1b587
Fix the shorthand in denote-test.el 2025-01-11 08:21:21 +02:00
Protesilaos Stavrou 34bdbc2f0c
Add TODO for testing built-in hierarchy.el to visualise sequences (denote-sequence.el) 2025-01-08 16:54:11 +02:00
Protesilaos Stavrou 21f64de9fd
Define denote-sequence--get-parent 2025-01-08 16:43:28 +02:00
Protesilaos Stavrou 6de6e5875d
Define denote-sequence-with-error-p to simplify some error checks 2025-01-08 16:42:57 +02:00
Protesilaos Stavrou 1666af3447
Define denote-sequence--join to streamline common tasks 2025-01-08 16:39:34 +02:00
Protesilaos Stavrou 165408f0d0
Rename denote-sequence--children-p to denote-sequence--children-implied-p
The latter better described what it is doing. Plus the doc string
clarifies the rationale.
2025-01-08 16:32:44 +02:00
Protesilaos Stavrou f3491587a4
Merge branch 'main' of github.com:protesilaos/denote 2025-01-08 16:20:05 +02:00
Protesilaos Stavrou 4bbc147633
Define denote-sequence--children-p 2025-01-08 16:19:08 +02:00
Protesilaos Stavrou c3b2a9dce1
Expand the test for denote-sequence--get-new-child
This is to test the case reported by elliottw in issue 519:
<https://github.com/protesilaos/denote/issues/519> .
2025-01-08 11:48:31 +02:00
Protesilaos Stavrou a9d36edd68
Mention the denote-search package by Lucas Quintana
We discussed this with Lucas in discussion 507:
<https://github.com/protesilaos/denote/discussions/507>.
2025-01-07 08:33:31 +02:00
Protesilaos Stavrou aaf667f4a4
Document in the manual denote-sequence-new-{child,sibling}-of-current 2025-01-05 12:19:25 +02:00
Protesilaos Stavrou f948c3ca44
Make two small stylistic changes to denote-sequence--pad 2025-01-05 12:12:22 +02:00
Protesilaos Stavrou 3e831132f1
Use format-message in denote-sequence--get-dired-buffer-name
This makes the quotes look better on the mode line.
2025-01-05 12:09:40 +02:00
Protesilaos Stavrou 23098ea222
Define denote-sequence-new-child-of-current command
Thanks to Mirko Hernandez for suggesting the creation of "do-what-I-mean"
commands, which I interpret as this sort of thing.

This was done in discussion 506:
<https://github.com/protesilaos/denote/discussions/506>.
2025-01-05 10:18:00 +02:00
Protesilaos Stavrou 6f82f181a8
Define denote-sequence-new-sibling-of-current command
Thanks to Mirko Hernandez for suggesting the creation of "do-what-I-mean"
commands, which I interpret as this sort of thing.

This was done in discussion 506:
<https://github.com/protesilaos/denote/discussions/506>.
2025-01-05 10:15:41 +02:00
Protesilaos Stavrou dd18fbac83
Fix "SEQUENE" to "SEQUENCE"
Thanks to Nicolas Semrau for bringing this matter to my attention:
<472e71e856 (commitcomment-150930369)>.
2025-01-05 09:02:32 +02:00
Protesilaos Stavrou 37cbe3ff29
Use shorter title for Info's "sequence notes" and use it in the defgroup 2025-01-05 08:44:08 +02:00
Protesilaos Stavrou 6860064eca
Make small stylistic change to denote-sequence--get-new-child 2025-01-05 08:40:11 +02:00
Protesilaos Stavrou 13488e58d7
Expand the doc string of denote-sequence-new-sibling 2025-01-05 08:04:40 +02:00
Protesilaos Stavrou 472e71e856
Expand the doc string of denote-sequence-new-child 2025-01-05 08:04:32 +02:00
Protesilaos Stavrou 81f31ea658
Make sure denote-sequence--get-largest reverses the list
We had a regression here when we switched to the old,
backward-compatible calling convention of 'sort'.
2025-01-05 07:55:40 +02:00
Protesilaos Stavrou 5651dc7737
Replace denote-sequence-sort with denote-sequence-sort-files
Part of this is to encapsulate the logic in a single function and also
to use the backward-compatible calling convention of 'sort', as we did
with Claudio Migliorelli in pull request 518:
<https://github.com/protesilaos/denote/pull/518>
2025-01-04 18:55:35 +02:00
Protesilaos Stavrou c7ba0b6bea
Update the denote-sort-identifier-comparison-function
Tweak what was contributed by Maikol Solis in pull request 517:
<https://github.com/protesilaos/denote/pull/517>.
2025-01-04 18:47:35 +02:00
Protesilaos Stavrou 5b7755f6fc
Document denote-sort-identifier-comparison-function and acknowledge Maikol Solis
This was missing from the original implementation about all these
comparison functions. Thanks to Maikol Solis for adding the new
defcustom in commit 1b65d9e, which was done in pull request 517:
<https://github.com/protesilaos/denote/pull/517>.
2025-01-04 18:46:14 +02:00
Protesilaos Stavrou c88ca934c9
Merge pull request #517 from maikol-solis/main
Add identifier comparison sort function in denote-sort-files
2025-01-04 18:42:52 +02:00
Protesilaos Stavrou 4a492963f2
Acknowledge Claudio Migliorelli for commit fffe24d
It is about using a backward-compatible 'sort' call. This was
discussed in issue 516 and then done in pull request 518:

- <https://github.com/protesilaos/denote/issues/516>
- <https://github.com/protesilaos/denote/pull/518>
2025-01-04 18:39:44 +02:00
Protesilaos Stavrou 7f3715ddd3
Merge pull request #518 from migliio/main
Use older-compatible `sort` call in `denote-sequence--get-largest`
2025-01-04 18:38:54 +02:00
Claudio Migliorelli fffe24dbf5 Use older-compatible sort call in denote-sequence--get-largest
As pointed out in #516, the `sort` function seems to have a
mismatching paradigm depending on the Emacs version the code is run
on. However, the `denote-sequence--get-largest` implementation was
simply using the `:in-place` key as third argument, while the original
implementation of `sort` only accepted two arguments, which is not
necessary. The sorting is done in place anyhow. This commit modifies
the `denote-sequence--get-largest` function to be compatible with
older Emacs versions.
2025-01-04 17:02:00 +01:00
Maikol Solís 1b65d9ed99 Add identifier comparison sort function in denote-sort-files
The function `denote-sort-dired` wasn't working due to the
`identifier` missing case in `denote-sort-files`. This is useful when
you customize `denote-file-name-components-order`.
2025-01-04 06:15:32 -06:00
Protesilaos Stavrou 9f41d3f594
Merge branch 'main' of github.com:protesilaos/denote 2025-01-04 10:32:08 +02:00
Protesilaos Stavrou 56af4761bd
Add FIXME for our dired revert-buffer-function 2025-01-04 10:31:44 +02:00
Protesilaos Stavrou 74ed8c6c06
Merge pull request #515 from jeanphilippegg/some-modifications
Some fixes
2025-01-04 08:22:38 +02:00
Protesilaos Stavrou eeb1ee3050
Make denote-sequence-dired revert-buffer-function use the prefix args it got 2025-01-04 08:05:42 +02:00
Protesilaos Stavrou d619abc08a
Make the denote-sequence-dired error more generic 2025-01-04 08:05:31 +02:00
Protesilaos Stavrou 0e4fb30e27
Change how denote-sequence-dired gets the buffer name 2025-01-04 08:04:36 +02:00
Jean-Philippe Gagné Guay 7e59f0b73e Check denote-file-has-identifier-p in denote-link--map-over-notes 2025-01-04 00:35:29 -05:00
Jean-Philippe Gagné Guay 1135df2a91 Allow string date parameter in denote-rename-file 2025-01-04 00:31:09 -05:00
Protesilaos Stavrou 13eee39873
Make the denote-sequence-new-child more informative 2025-01-03 19:17:09 +02:00
Protesilaos Stavrou ba22e8d65b
Make the denote-sequence-new-sibling more informative 2025-01-03 19:17:00 +02:00
Protesilaos Stavrou 02aac5336d
Make the denote-sequence prompt more informative depending on the selected type 2025-01-03 19:16:40 +02:00
Protesilaos Stavrou 9ca42c5264
Make denote-sequence-link prompt more informative 2025-01-03 19:12:18 +02:00
Protesilaos Stavrou 536a77bdee
Add missing prompt text from commit ee80737 2025-01-03 19:11:37 +02:00
Protesilaos Stavrou c32ff290ab
Make denote-sequence-depth-prompt accept optional PROMPT-TEXT parameter 2025-01-03 17:21:28 +02:00
Protesilaos Stavrou ee80737526
Use a custom prompt text for prefix in denote-sequence-dired 2025-01-03 17:19:56 +02:00
Protesilaos Stavrou 4d4b829e8e
Make the denote-sequence-depth-prompt prompt more informative 2025-01-03 17:19:43 +02:00
Protesilaos Stavrou a3f635ff9d
Make sure denote-sequence-get-all-files-with-prefix checks only the prefix
Otherwise, it returns false positives.
2025-01-03 15:31:18 +02:00
Protesilaos Stavrou 68ba7c1859
Fix creation of new parent in command denote-sequence 2025-01-03 12:53:47 +02:00
Protesilaos Stavrou 0c32268eac
Clarify the doc string of denote-sequence-depth 2025-01-03 12:49:42 +02:00
Protesilaos Stavrou c821f84f2d
Document optional extension denote-sequence.el 2025-01-03 12:34:25 +02:00
Protesilaos Stavrou 0d4ff4a1ed
Merge pull request #512 from jeanphilippegg/fix-issue
Fix regression in denote-prepend-front-matter (issue #510)
2025-01-02 08:29:19 +02:00
Jean-Philippe Gagné Guay 22b96a2baf Fix regression in denote-prepend-front-matter 2025-01-02 01:24:13 -05:00
Protesilaos Stavrou e58479f096
Add denote-sequence-reparent command 2025-01-02 08:01:07 +02:00
Protesilaos Stavrou e5850777fb
Make denote-sequence-file-prompt accept optional parameters 2025-01-02 08:00:34 +02:00
Protesilaos Stavrou ac756f5270
Make denote-sequence-sort do the right thing by expanding denote-sequence--pad 2025-01-01 20:59:31 +02:00
Protesilaos Stavrou f293ee60df
Define denote-sequence-dired command and its helpers 2025-01-01 09:59:06 +02:00
Protesilaos Stavrou 7299ed9bc0
Define denote-sequence-get-all-files-with-max-depth 2025-01-01 09:58:46 +02:00
Protesilaos Stavrou 608e0e880b
Define denote-sequence-get-all-files-with-prefix 2025-01-01 09:58:29 +02:00
Protesilaos Stavrou 383a610399
Make denote-test.el use Elisp shorthands 2025-01-01 08:50:52 +02:00
Protesilaos Stavrou 9da97d3dc2
Update copyright years in denote-test.el 2025-01-01 08:32:04 +02:00
Protesilaos Stavrou 2a3436e111
Merge branch 'sequence-notes-extension' 2025-01-01 08:31:41 +02:00
Protesilaos Stavrou 90372d9627
Update copyright years in a few places 2025-01-01 07:03:42 +02:00
Protesilaos Stavrou 27ef655bc8
Update copyright years in denote-sequence.el 2025-01-01 07:00:27 +02:00
Protesilaos Stavrou 50bace231e
Define denote-sequence-link command 2024-12-31 18:48:16 +02:00
Protesilaos Stavrou 2eded970e9
Rewrite denote-sequence-new-child doc string 2024-12-31 18:47:54 +02:00
Protesilaos Stavrou 9871d5b2ab
Rewrite denote-sequence-new-sibling doc string 2024-12-31 18:47:45 +02:00
Protesilaos Stavrou cdba50e984
Rewrite the doc string of denote-sequence-new-parent and let it work from Lisp 2024-12-31 18:47:22 +02:00
Protesilaos Stavrou 220d9876a6
Define denote-sequence-file-p to streamline some procedures 2024-12-31 18:46:37 +02:00
Protesilaos Stavrou 61f5712095
Capitalise "Denote" in the defgroup of denote-sequence 2024-12-31 18:44:21 +02:00
Protesilaos Stavrou 6fe68be094
Fix denote-sequence-file-prompt indentation 2024-12-31 12:07:19 +02:00
Protesilaos Stavrou 80901d4604
Use denote-sequence-split in two cases 2024-12-31 12:05:45 +02:00
Protesilaos Stavrou b72257ad7d
Make denote-sequence--pad throw an error if the type is unknown
I thought about the scenario of generating a descendant, but it does
not seem to make sense workflow-wise. The user should be more
specific, such as to create the child of a sequence.
2024-12-31 12:01:26 +02:00
Protesilaos Stavrou cd772dad09
Add TODO for possibly sharing state between some tests 2024-12-31 11:59:43 +02:00
Protesilaos Stavrou c0bcc13ef3
Write test for denote-sequence--get-new-sibling given commit 43322b3 2024-12-31 11:57:43 +02:00
Protesilaos Stavrou 43322b34aa
Rewrite denote-sequence--get-new-sibling to address its bugs 2024-12-31 11:57:17 +02:00
Protesilaos Stavrou 6a43e5cad5
Add test about denote-sequence--get-new-child 2024-12-31 08:46:05 +02:00
Protesilaos Stavrou 6aaf3bfcb0
Clarify denote-sequence-get-all-sequences doc string 2024-12-31 08:45:58 +02:00
Protesilaos Stavrou 451872b094
Make denote-sequence-get-all-sequences accept optional FILES argument 2024-12-31 08:45:41 +02:00
Protesilaos Stavrou 8000e2e01b
Fix (?) all remaining issues with denote-sequence--get-new-child
I will write tests when this is merged into main.
2024-12-30 10:30:02 +02:00
Protesilaos Stavrou 8d130358a2
Fix some more issues with denote-sequence--get-new-child
STILL NEEDS TESTING.
2024-12-30 09:51:13 +02:00
Protesilaos Stavrou d9d2f2767f
Merge branch 'sequence-notes-extension' of github.com:protesilaos/denote into sequence-notes-extension 2024-12-30 09:24:30 +02:00
Protesilaos Stavrou bb357f03bb
Make denote-sequence--get-new-child more robust
THIS NEEDS MORE TESTING.

The idea is to find the level at which we are inserting a child, then
figure out which is the largest already there, and increment that
number.
2024-12-30 09:23:19 +02:00
Protesilaos Stavrou 35fc16ec30
Define denote-sequence-depth function 2024-12-30 09:19:38 +02:00
Protesilaos Stavrou 23892d55f6
Define denote-sequence-split function 2024-12-30 09:19:25 +02:00
Protesilaos Stavrou 36cb4234dd
Change where 'denote-sequence' does the signature extraction
We want this to happen for Lisp calls as well.
2024-12-30 07:59:29 +02:00
Protesilaos Stavrou 265b0401a0
Add TODO for a possible cl-letf in 'denote-sequence' 2024-12-30 07:57:18 +02:00
Protesilaos Stavrou b933238dcb
Rewrite the second parameter of 'denote-sequence' to avoid confusion 2024-12-30 07:56:10 +02:00
Protesilaos Stavrou 70b6708229
Remove needless 'when' around 'pcase' in 'denote-sort-files' 2024-12-29 09:42:23 +02:00
Protesilaos Stavrou 247f0d1fec
Make denote-sort-files accept a custom sort function
Thanks to Mirko Hernandez for making this suggestion in discussion
506: <https://github.com/protesilaos/denote/discussions/506>.
2024-12-29 09:38:12 +02:00
Protesilaos Stavrou 24bd7ae625
Acknowledge Laurent Gatto for commit 8fca695
This was done in pull request 505: <https://github.com/protesilaos/denote/pull/505>.
The change is small, meaning that Laurent does not need to assign
copyright to the Free Software Foundation.
2024-12-29 09:27:54 +02:00
Protesilaos Stavrou 5e10082d8e
Merge pull request #505 from lgatto/patch-2
Update README.org
2024-12-29 09:26:38 +02:00
Laurent Gatto 8fca695299
Update README.org
- From the text, there seem to be more than five (I count seven) to write a note with Denote.
- Typo - remove 's'.
2024-12-28 18:30:02 +01:00
Protesilaos Stavrou 21b03db4a8
Update sample config to have simpler variant and use-package 2024-12-28 08:03:49 +02:00
Protesilaos Stavrou 9b2cf81054
Make denote-link--map-over-notes less strict about what it matches
This is in response to issue 503, where Oliver Epper encountered an
error while trying to link files which are not plain text:
<https://github.com/protesilaos/denote/issues/503>.
2024-12-26 16:44:34 +02:00
Protesilaos Stavrou 8e8b43b3cc
Make denote-link-dired-marked-notes only work from a Dired buffer 2024-12-26 09:25:07 +02:00
Protesilaos Stavrou e82c628444
Refactor denote-link-dired-marked-notes
1. Do not use 'find-file' to get the buffer of the selected file
   because this has the side effect of switching the current window buffer.

2. If the buffer is in a window, select that window to perform the
   operation. Otherwise, do the work with its buffer as current and
   then display the buffer below the current one.

3. Produce a message to inform the user what happened.
2024-12-26 09:21:52 +02:00
Protesilaos Stavrou fc8372bc9c
Simplify the doc string of denote-link-dired-marked-notes 2024-12-26 09:18:40 +02:00
Protesilaos Stavrou f0f6895e91
Make denote-link--buffer-file-prompt doc string more accurate 2024-12-26 09:18:20 +02:00
Protesilaos Stavrou 7e2cf94b7c
Fix completion category in denote-link--buffer-file-prompt
This is related to the bug reported by Oliver Epper in issue 503:
<https://github.com/protesilaos/denote/issues/503>. Also see commit
d9bf8db.
2024-12-26 08:47:34 +02:00
Protesilaos Stavrou d9bf8db87c
Fix alias to denote-link-dired-marked-notes
Otherwise, this was making the alias and the alised function do
nothing. Thanks to Olver Epper for reporting a problem with this
command in issue 503: <https://github.com/protesilaos/denote/issues/503>.
2024-12-26 08:38:23 +02:00
Protesilaos Stavrou 6c5858c72b
Reword denote-sequence doc sentence to not exceed 80 characters 2024-12-25 19:19:32 +02:00
Protesilaos Stavrou d44d3271fc
Add missing require for 'denote' in denote-sequence.el 2024-12-25 18:41:02 +02:00
Protesilaos Stavrou a87d0c86e3
Acknowledge Jeff Valk for reporting issue that led to rename commands during org-capture
This was done in issue 500, with the change made by Jean-Philippe
Gagné Guay in pull request 502:

- <https://github.com/protesilaos/denote/issues/500>
- <https://github.com/protesilaos/denote/pull/502>
2024-12-25 17:59:02 +02:00
Protesilaos Stavrou 25e1cf93b7
Merge pull request #502 from jeanphilippegg/denote-org-capture
Make renaming commands work in denote-org-capture
2024-12-25 17:56:04 +02:00
Protesilaos Stavrou c5438dfdb3
Make denote-sequence-file-prompt err if there are no sequence notes 2024-12-25 17:44:51 +02:00
Protesilaos Stavrou c72e535a04
Make denote-sequence--get-new-parent work if there are no sequences 2024-12-25 17:41:28 +02:00
Protesilaos Stavrou adac55d35b
Reword denote-sequence-file-prompt prompt 2024-12-25 17:41:17 +02:00
Protesilaos Stavrou df24b3639b
Tweak the defgroup of denote-sequence 2024-12-25 17:31:49 +02:00
Protesilaos Stavrou 9f9be73605
Fix denote-sequence--get-new-sibling to not error early if sequence does not include children 2024-12-25 17:30:43 +02:00
Protesilaos Stavrou 1203e63716
Remove needless interactive declaration from two commands in denote-sequence.el 2024-12-25 17:30:12 +02:00
Protesilaos Stavrou 445559a606
Make denote-sequence-new-child actually get the child of sequence 2024-12-25 17:24:46 +02:00
Protesilaos Stavrou dad23f3b4b
Remove all needless metadata from denote-sequence.el 2024-12-25 17:08:26 +02:00
Protesilaos Stavrou d7b84ca39d
Remove needless package requirement in denote-sequence.el 2024-12-25 17:00:42 +02:00
Protesilaos Stavrou d1ba5e86c3
Add prototype of denote-sequence.el 2024-12-25 16:54:23 +02:00
Jean-Philippe Gagné Guay 8d1202d2e8 Add hook to rename file after denote-org-capture 2024-12-22 13:58:29 -05:00
Jean-Philippe Gagné Guay 5cd129030a Make renaming commands work in org-capture buffer 2024-12-22 13:22:59 -05:00
Protesilaos Stavrou 8bd602b863
Make obsolete the command 'denote-add-front-matter'
This is due to refinements made by Jean-Philippe Gagné Guay to the
file renaming mechanism. We discussed this deprecation in issue 498:
<https://github.com/protesilaos/denote/issues/498>.
2024-12-22 11:01:06 +02:00
Protesilaos Stavrou c6bc62d6c9
Document the optional use of Obsidian-style front matter 2024-12-16 08:50:37 +02:00
Protesilaos Stavrou af8279fba4
Merge branch 'obsidian-file-type' 2024-12-16 08:44:41 +02:00
Protesilaos Stavrou 2f1a221f5d
Define the markdown-obsidian front matter in denote-md-extras.el 2024-12-16 08:41:25 +02:00
Protesilaos Stavrou f6fe1e27e6
Merge pull request #497 from jeanphilippegg/some-changes
Small adjustments
2024-12-16 08:31:39 +02:00
Jean-Philippe Gagné Guay f11966e642 Add check in denote--get-all-used-ids 2024-12-15 23:59:40 -05:00
Jean-Philippe Gagné Guay 5541eebbb9 Use denote-file-has-supported-extension-p instead of denote-filename-is-note-p 2024-12-15 23:59:40 -05:00
Jean-Philippe Gagné Guay 3ca5797934 Add denote-file-is-in-denote-directory-p 2024-12-15 23:59:35 -05:00
Jean-Philippe Gagné Guay edda750506 Handle nil date in front matter date functions 2024-12-14 23:32:50 -05:00
Jean-Philippe Gagné Guay 119624e038 Small refactor of denote-directory-files 2024-12-14 23:04:13 -05:00
Jean-Philippe Gagné Guay ee8b53b5c9 Use denote-file-has-denoted-filename-p in fontification 2024-12-14 23:03:25 -05:00
Jean-Philippe Gagné Guay 05edc7dc5e Make it possible to rewrite the front matter even if file name is unchanged 2024-12-14 22:35:09 -05:00
Protesilaos Stavrou 2ab74c1d47
Merge pull request #495 from jeanphilippegg/denote--date-convert
Small adjustments for notes without identifier
2024-12-14 09:10:59 +02:00
Protesilaos Stavrou 5d4b9f9089
Merge pull request #496 from jeanphilippegg/fix-tests
Fix tests
2024-12-14 09:04:59 +02:00
Jean-Philippe Gagné Guay 165ef38a9b Add denote--generate-date-for-rename 2024-12-14 00:03:14 -05:00
Jean-Philippe Gagné Guay 779fe017dc Validate the presence of at least one file name component 2024-12-13 23:42:45 -05:00
Jean-Philippe Gagné Guay 8f3e5dd407 Fix tests 2024-12-13 23:23:25 -05:00
Jean-Philippe Gagné Guay 0a5c142287 Refactor denote--date-convert 2024-12-13 22:31:48 -05:00
Protesilaos Stavrou 6613d3903d
Refactor denote-add-front-matter and make it interactive-only 2024-12-13 11:18:42 +02:00
Protesilaos Stavrou 97d866ee6d
Replace denote--add-front-matter with denote-prepend-front-matter 2024-12-13 11:18:05 +02:00
Protesilaos Stavrou e9840d1f57
Make denote-add-front-matter read title value if available
Thanks to juh for asking about this in issue 493:
<https://github.com/protesilaos/denote/issues/493>.
2024-12-11 08:57:25 +02:00
Protesilaos Stavrou ce7ce48c9f
Make denote-journal-extras--filename-date-regexp better match repositioned identifier 2024-12-10 08:13:35 +02:00
Protesilaos Stavrou c68e9bee1e
Mention denote-file-has-denoted-filename-p in the manual
This was contributed by Jean-Philippe Gagné Guay as part of the
changeset of pull request 491: <https://github.com/protesilaos/denote/pull/491>.
2024-12-09 12:53:54 +02:00
Protesilaos Stavrou 63a6603b62
Merge pull request #491 from jeanphilippegg/denote-retrieve-title-or-filename
Fix denote-retrieve-title-or-filename and other tweak
2024-12-09 12:51:24 +02:00
Protesilaos Stavrou f89f9ee963
Make denote-date-prompt accept optional INITIAL-DATE and PROMPT-TEXT
Thanks to Alex Griffin for starting the discussion about this feature
and to Jean-Philippe Gagné Guay for contributing to it. It was done in
issue 489: <https://github.com/protesilaos/denote/issues/489>.
2024-12-09 11:51:08 +02:00
Protesilaos Stavrou 7a2034516e
Fix denote-add-front-matter code for signature value
Thanks to Samuel Flint for reporting this in issue 492:
<https://github.com/protesilaos/denote/issues/492>.
2024-12-08 18:46:09 +02:00
Protesilaos Stavrou 3a0bc9255b
Fix denote-org-extras--parse-rx for nil argument
Thanks to Samuel Flint for noticing this problem as part of the
discussion in issue 490: <https://github.com/protesilaos/denote/issues/490>.
2024-12-07 19:03:30 +02:00
Protesilaos Stavrou 75094832ce
Make denote-org-extras--parse-rx more robust
Thanks to Samuel Flint for informing me that a nil argument was not
doing the right thing. We want to be more careful in this regard. This
was discussed in issue 490: <https://github.com/protesilaos/denote/issues/490>.
2024-12-07 08:34:09 +02:00
Jean-Philippe Gagné Guay 5ae74c1158 Change the way denote--used-ids is used 2024-12-07 00:19:55 -05:00
Jean-Philippe Gagné Guay 26629820f7 Refactor denote-retrieve-title-or-filename
Use denote-file-has-denoted-filename-p function. It does not validate
the location of the file. It validates that the file respects Denote's
file-naming scheme instead of only the presence of an identifier.
2024-12-06 23:55:40 -05:00
Jean-Philippe Gagné Guay a89755c686 Add denote-file-has-denoted-filename-p function 2024-12-06 23:49:02 -05:00
Protesilaos Stavrou 392f6ebe77
Tweak denote-org-extras--get-outline to only ever get useful regexp for the outline 2024-12-06 12:48:06 +02:00
Protesilaos Stavrou d6e94118da
Disambiguate denote-journal-extras-keyword to placate the compiler 2024-12-05 18:02:44 +02:00
Protesilaos Stavrou 259c8caac6
Make denote-journal-extras--filename-date-regexp more robust
We want it to work when the journal files are inside a directory and
we also need it to account for variations of denote-file-name-components-order.

Thanks to Samuel Flint for informing me about the previous
implementation not working inside of a journal subdirectory. This was
done in issue 485: <https://github.com/protesilaos/denote/issues/485>.
2024-12-05 18:00:00 +02:00
Protesilaos Stavrou 5c8a38bf46
Tweak denote-org-extras--parse-rx to use rx-to-string 2024-12-04 17:56:50 +02:00
Protesilaos Stavrou de786b5e8f
Define helper function to parse rx
This has the benefit of extending support for the 'rx' syntax to the
:not-regexp parameter. In principle, this syntax should be available
for all user-facing regular expressions of the dblocks.
2024-12-04 14:18:31 +02:00
Protesilaos Stavrou d6b3269a17
Merge branch 'not-regexp' 2024-12-04 14:10:05 +02:00
Protesilaos Stavrou fba0bb2650
Document the :not-regexp parameter of the Org dynamic blocks 2024-12-04 14:09:10 +02:00
Protesilaos Stavrou a703f2b686
Implement WORK-IN-PROGRESS support for :not-regexp to omit files in Org dynamic blocks 2024-12-03 10:51:21 +02:00
Protesilaos Stavrou 89a6f7c8c2
Fix bug to make denote-sort-dired exclude files matching regexp (see a701764) 2024-12-03 10:35:16 +02:00
Protesilaos Stavrou 821095844c
Clarify the wording about default behaviour of denote-sort-dired command 2024-12-03 10:30:24 +02:00
Protesilaos Stavrou 4205708b2c
Document in the manual denote-sort-dired-extra-prompts new exclude-regexp symbol 2024-12-03 10:26:04 +02:00
Protesilaos Stavrou 7f4a66d802
Mention the denote-zettel-interface package by Kristoffer Balintona 2024-12-03 10:18:43 +02:00
Protesilaos Stavrou 663e6e0206
Document denote-directory-files EXCLUDE-REGEXP in the manual 2024-12-03 08:10:08 +02:00
Protesilaos Stavrou a701764b0e
Start implementing not-regexp feature to exclude those files 2024-12-03 07:43:36 +02:00
Protesilaos Stavrou a1eff10474
Merge pull request #486 from EFLS/main
fix org dblock definition of missing-links
2024-12-02 15:05:26 +02:00
Elias Storms 3a56c5196e fix org dblock definition of missing-links
The defining function mentioned the wrong function.
2024-12-02 13:20:40 +01:00
Protesilaos Stavrou 0f11e93f25
Add user option denote-open-link-function for non-Org buffers 2024-11-26 11:52:44 +02:00
Protesilaos Stavrou bf07d3f075
Merge pull request #484 from jeanphilippegg/denote-rename-file-using-front-matter
Small fixes, `denote-rename-file-using-front-matter` and signature line only when there is a value
2024-11-26 11:43:01 +02:00
Jean-Philippe Gagné Guay 6caa664518 Remove reference to denote-link-add-links 2024-11-23 11:03:37 -05:00
Jean-Philippe Gagné Guay 1f123e1440 Remove lines with empty values in denote--format-front-matter 2024-11-23 11:03:37 -05:00
Jean-Philippe Gagné Guay e8e97ccaa8 Add denote-front-matter-components-present-even-if-empty-value
It replaces denote-always-include-all-front-matter-lines.
2024-11-23 11:03:37 -05:00
Jean-Philippe Gagné Guay 9426f780e4 Move code in denote--rename-file 2024-11-23 11:03:37 -05:00
Jean-Philippe Gagné Guay 0792229eed Fix issue in denote-rewrite-front-matter with lines that are unchanged 2024-11-23 11:03:37 -05:00
Jean-Philippe Gagné Guay cf35f02d47 Fix issue in denote--get-final-components-for-rewrite
Calling push on sublist does not work on the first iteration of the
loop.
2024-11-23 11:03:37 -05:00
Jean-Philippe Gagné Guay 86c19b4114 Rework denote-rename-file-using-front-matter to handle all components 2024-11-23 11:03:37 -05:00
Protesilaos Stavrou 66124eb234
Update the wishlist to remove what we have already done 2024-11-23 11:19:25 +02:00
Protesilaos Stavrou 557a7b63b7
Tweak the denote-journal-extras-keyword doc string 2024-11-23 10:48:08 +02:00
Protesilaos Stavrou 812bec4027
Document denote-journal-extras-keyword support for list value
This was contributed by Octavian in pull request 483:
<https://github.com/protesilaos/denote/pull/483>. The change is within
the allowed ~15 line limite, meaning that Octavian does not need to
assign copyright to the Free Software Foundation.
2024-11-23 10:46:33 +02:00
Protesilaos Stavrou bd82f0aed7
Merge pull request #483 from cosmicz/journal-multiple-keywords
Add multiple keywords option for journal
2024-11-23 10:39:02 +02:00
Protesilaos Stavrou 9a9d858842
Merge pull request #482 from brabalan/fix-alias
fix obsolete alias
2024-11-23 10:32:24 +02:00
Octavian c954e49482 Add multiple keywords option for journal 2024-11-22 14:37:48 -08:00
Alan Schmitt 03dc441457 fix obsolete alias 2024-11-21 10:56:27 +01:00
Protesilaos Stavrou 12a77a382e
WRONG BRANCH! Revert "Define WORK-IN-PROGRESS file type with Obsidian-style front matter"
This reverts commit 2efd133a29.

I wanted to push this to a branch. Reverting it on main.
2024-11-20 12:07:37 +02:00
Protesilaos Stavrou 2efd133a29
Define WORK-IN-PROGRESS file type with Obsidian-style front matter
This does not work yet for common actions like renaming the file based
on its front matter. I will continue testing how viable this is and if
it is worth pursuing. I do not want to make the code more complex to
accommodate this use-case, so let's see how it goes.
2024-11-20 12:05:28 +02:00
Protesilaos Stavrou bd1fc0b39e
Change the dummy regexp for front matter retrieval to something more self-evident
This was originally contributed by Jean-Philippe Gagné Guay in pull
request 480: <https://github.com/protesilaos/denote/pull/480>. The
idea is to use this regular expression which will 99% not exist in a
file to handle the case where the user does not want to get the value
of the given entry. The alternative would be to rewrite more parts of
the code, so this feels safer and is easier.
2024-11-20 11:51:41 +02:00
Protesilaos Stavrou ad7a102116
Use denote-get-link-description instead of denote--link-get-description in denote-org-extras.el 2024-11-18 08:37:34 +02:00
Protesilaos Stavrou ef033a5084
Fix mistake made by the previous commit 2024-11-18 08:35:48 +02:00
Protesilaos Stavrou 73571a65fb
Reindent files 2024-11-18 08:35:10 +02:00
Protesilaos Stavrou 45f3eef294
Merge pull request #480 from jeanphilippegg/features-and-fix
Signatures in front matter, change id/date and bug fix
2024-11-18 08:31:21 +02:00
Jean-Philippe Gagné Guay ef93ebd781 Fix docstring of denote--keywords-value-function 2024-11-16 01:01:00 -05:00
Jean-Philippe Gagné Guay 51fa48dcd7 Add denote-rename-file-date 2024-11-16 01:01:00 -05:00
Jean-Philippe Gagné Guay e6656d4fc2 Make it possible to change the date/id of a note 2024-11-16 01:01:00 -05:00
Jean-Philippe Gagné Guay 3d8e575260 Add default values to denote--*-key-regexp functions 2024-11-16 01:00:53 -05:00
Jean-Philippe Gagné Guay 3026f6ada5 Add signature to front matter 2024-11-15 22:01:05 -05:00
Jean-Philippe Gagné Guay 0cc5f450d7 Fix regression when renaming new unsaved note 2024-11-15 21:51:32 -05:00
Protesilaos Stavrou 7c8ed195d8
Note that new README wording about denote-rewrite-front-matter is part of development 2024-11-14 11:04:07 +02:00
Protesilaos Stavrou 8fd623577a
Merge pull request #479 from jeanphilippegg/denote-rewrite-front-matter
Refactored `denote-rewrite-front-matter`
2024-11-14 11:02:25 +02:00
Protesilaos Stavrou 16fcac16ca
Merge pull request #478 from jeanphilippegg/fix-denote-rename-file
Fix denote-rename-file when called from lisp
2024-11-11 08:20:42 +02:00
Jean-Philippe Gagné Guay 25cf2f831c Refactor denote-rewrite-front-matter
Also add denote-always-include-all-front-matter-lines
2024-11-10 23:21:57 -05:00
Jean-Philippe Gagné Guay ebc31ee731 Handle keep-current for date in denote-rename-file 2024-11-10 14:32:30 -05:00
Jean-Philippe Gagné Guay 67bef2d964 Move code to denote-rename-file 2024-11-10 14:02:57 -05:00
Jean-Philippe Gagné Guay d55e14afb6 Add denote--get-component-key-regexp-function 2024-11-10 11:25:52 -05:00
Jean-Philippe Gagné Guay bf5969cbe8 Change parameters order in denote--add-front-matter 2024-11-10 10:17:28 -05:00
Jean-Philippe Gagné Guay 8fdb4105d9 Remove unused denote--id-exists-p 2024-11-10 10:06:20 -05:00
Protesilaos Stavrou e5b574ec87
Add development note for some symbols in the manual
Those were changed by Jean-Philippe Gagné Guay in pull request 476:
<https://github.com/protesilaos/denote/pull/476>.
2024-11-10 07:58:01 +02:00
Protesilaos Stavrou 344e1a65bb
Merge pull request #476 from jeanphilippegg/date-functions
Cleanup of date handling function and more
2024-11-10 07:27:11 +02:00
Jean-Philippe Gagné Guay 75d4ba1f7e Do not add an empty identifier in denote--used-ids 2024-11-09 23:23:56 -05:00
Jean-Philippe Gagné Guay 427ebfed8e Add date parameter to denote--add-front-matter 2024-11-09 23:23:56 -05:00
Jean-Philippe Gagné Guay 722c1f3934 Add variable denote-generate-identifier-automatically 2024-11-09 23:23:56 -05:00
Jean-Philippe Gagné Guay 4a2caa43ef Handle id in denote--creation-prepare-note-data
Also make sure that the date is derived from the id even if
denote--find-first-unused-id is called.
2024-11-09 23:23:56 -05:00
Jean-Philippe Gagné Guay 8b005edd2d Make some front matter functions ready to handle nil dates and empty identifiers 2024-11-09 23:23:56 -05:00
Jean-Philippe Gagné Guay 8f8026bf56 Change denote and denote-org-capture to make them ready to handle empty identifiers 2024-11-09 23:23:56 -05:00
Jean-Philippe Gagné Guay 5e21143e22 Update docstring of denote-format-file-name 2024-11-09 23:23:56 -05:00
Jean-Philippe Gagné Guay 9d13ef9082 Allow identifiers with other formats in denote-format-file-name 2024-11-09 23:23:56 -05:00
Jean-Philippe Gagné Guay b0b19b9ad1 Allow empty identifier in denote-format-file-name 2024-11-09 23:23:56 -05:00
Jean-Philippe Gagné Guay 89b0525475 Do not check nil identifier in denote-format-file-name 2024-11-09 23:23:56 -05:00
Jean-Philippe Gagné Guay 19164364a8 Obsolete denote-create-unique-file-identifier 2024-11-09 23:23:50 -05:00
Jean-Philippe Gagné Guay a204554b8d denote-get-identifier returns an empty string when date is nil
Also make the date parameter mandatory
2024-11-08 22:58:14 -05:00
Jean-Philippe Gagné Guay a5ecae13cf Obsolete denote-parse-date 2024-11-08 22:29:33 -05:00
Jean-Philippe Gagné Guay 7cd1461e4b Add comment in denote-valid-date-p 2024-11-08 22:09:16 -05:00
Jean-Philippe Gagné Guay b2ddfc0d3a Rename denote--date to denote--format-front-matter-date 2024-11-08 22:03:51 -05:00
Jean-Philippe Gagné Guay cf4ce27580 Do not check identifier format in retrieval functions of file name components 2024-11-08 22:00:22 -05:00
Protesilaos Stavrou b788f7c3d7
Expand denote-md-extras.el to support conversion from/to Obsidian links
Thanks to hyperfocus1337 for discussing this with me and testing my
prototypes in issue 475: <https://github.com/protesilaos/denote/issues/475>.
2024-11-07 10:44:41 +02:00
Protesilaos Stavrou 0daf97be00
Make denote-link-description-format accept %T for file name title only 2024-11-06 10:48:00 +02:00
Protesilaos Stavrou 991b2fece2
Make denote-rename-buffer-format accept %T for file name title only 2024-11-06 10:47:39 +02:00
Protesilaos Stavrou 3d0c6d8b43
Remove needless outline in denote-md-extras.el 2024-11-06 10:44:01 +02:00
Protesilaos Stavrou bbd75dd2f3
Make denote-title-prompt prepopulate the minibuffer if denote-title-prompt-current-default
This makes it easier to edit the text after calling 'denote-open-or-create' (and related).
We do not want to skip the title prompt completely, because the user
may not necessarily search for a file using a query that is a
perfectly valid title. For example, with the 'orderless' package set
up, they may type "title test" to match "This is a test title".
2024-11-05 08:00:31 +02:00
Protesilaos Stavrou d42be4ee79
Make stylistic change in denote-select-linked-file-prompt 2024-11-04 12:47:30 +02:00
Protesilaos Stavrou 170a8234ae
Merge pull request #473 from jeanphilippegg/link-descriptions
Link descriptions
2024-11-04 07:51:27 +02:00
Jean-Philippe Gagné Guay 18e8bb9ece Add denote-link-description-with-signature-and-title and use it as the default 2024-11-03 11:30:43 -05:00
Protesilaos Stavrou a05ed292bf
Clarify denote-test--denote--format-front-matter doc string 2024-11-03 17:28:11 +02:00
Jean-Philippe Gagné Guay 90c08c1693 Remove ignore-region parameter from denote-get-link-description 2024-11-03 09:58:56 -05:00
Protesilaos Stavrou 8eae1c9e97
Merge branch 'link-description-format' 2024-11-03 11:51:06 +02:00
Protesilaos Stavrou 0ce0702158
Deprecate denote-link-description-function and replace it with denote-link-description-format (check FIXME) 2024-11-03 11:50:21 +02:00
Protesilaos Stavrou 0ea4d88a59
Merge pull request #472 from jeanphilippegg/front-matter-functions
Small cleanup of the front matter functions
2024-11-03 09:17:52 +02:00
Jean-Philippe Gagné Guay 4fdae80128 Refactor denote-rename-file-using-front-matter 2024-11-02 01:13:31 -04:00
Jean-Philippe Gagné Guay 512672e173 Add signature parameter to denote--add-front-matter 2024-11-02 01:13:31 -04:00
Jean-Philippe Gagné Guay 7ccddb5837 Add signature parameter to denote--format-front-matter 2024-11-02 01:13:26 -04:00
Jean-Philippe Gagné Guay bd50fbba94 Remove denote--front-matter-{title/keywords} functions 2024-11-02 00:15:11 -04:00
Jean-Philippe Gagné Guay 4cd24c9730 Format identifier in denote--format-front-matter 2024-11-02 00:15:11 -04:00
Jean-Philippe Gagné Guay 6446650c36 Make date parameter a date object in denote--format-front-matter 2024-11-02 00:15:04 -04:00
Jean-Philippe Gagné Guay f0908dbcc1 Remove denote--get-{title/keywords}-line-from-front-matter functions 2024-11-01 22:38:30 -04:00
Jean-Philippe Gagné Guay af2e6a33a3 Add denote--retrieve-front-matter-*-from-content functions 2024-11-01 21:31:17 -04:00
Protesilaos Stavrou f3ac69fcd3
Clarify the type of a symbol in a doc string to placate the byte compiler 2024-10-31 11:11:28 +02:00
Protesilaos Stavrou bbf62a9e89
Define denote-dired-link-marked-notes as alias for denote-link-dired-marked-notes 2024-10-28 10:07:46 +02:00
Protesilaos Stavrou 42151dc6f4
Merge pull request #470 from jeanphilippegg/retrieval-functions
Add missing public front matter retrieval functions
2024-10-27 09:32:28 +02:00
Jean-Philippe Gagné Guay ba2bd253bb Add missing public front matter retrieval functions 2024-10-26 23:43:59 -04:00
Protesilaos Stavrou 1659babc61
Make denote-get-path-by-id not fail on denote-get-path-by-id nil value 2024-10-26 09:43:38 +03:00
Protesilaos Stavrou 0446f242db
Make denote-org-extras "convert" link commands save-excursion 2024-10-26 09:43:17 +03:00
Protesilaos Stavrou 331918bdbd
Add denote-md-extras.el with two commands for link conversion 2024-10-26 09:33:31 +03:00
Protesilaos Stavrou 9f58b5ad24
Acknowledge sarcom-sar for the discussion leading to commit 3517ba2
This was done in issue 467: <https://github.com/protesilaos/denote/issues/467>.

The commit is by Jean-Philippe Gagné Guay, which was done in pull
request 468: <https://github.com/protesilaos/denote/pull/468>.
2024-10-26 08:29:16 +03:00
Protesilaos Stavrou 3517ba27d4
Merge pull request #468 from jeanphilippegg/retrieval-functions
Add remaining front matter retrieval functions
2024-10-26 08:21:51 +03:00
Protesilaos Stavrou b074312826
Define denote-link-description-format option and update denote-link-description-function 2024-10-26 08:06:22 +03:00
Protesilaos Stavrou 75aebe6b41
Say "user option" instead of "variable" in denote-org-extras-extract-org-subtree doc 2024-10-26 08:00:48 +03:00
Protesilaos Stavrou 6395ec7e95
Make small stylistic change to denote-org-extras-extract-org-subtree
We have this pattern right below, so better be consistent.
2024-10-26 07:28:06 +03:00
Protesilaos Stavrou 998ee2aa1b
Make denote-org-extras "convert" link functions print a count 2024-10-26 07:05:11 +03:00
Protesilaos Stavrou c4fdf97055
Remove outdated TODO in denote-org-extras
We do not need to account for other link types. If someone has a
use-case, then we shall reconsider.
2024-10-26 06:59:07 +03:00
Jean-Philippe Gagné Guay acad7c3577 Do not check type in denote-format-string-for-{org/md}-front-matter 2024-10-25 23:37:57 -04:00
Protesilaos Stavrou 6c1ceaf7c7
Simplify keyword retrieval in denote-rename-buffer--format 2024-10-26 06:23:54 +03:00
Protesilaos Stavrou 614fa7e50f
Fix typo in denote-rename-buffer-format doc string 2024-10-26 06:22:19 +03:00
Jean-Philippe Gagné Guay b69736209c Add remaining front matter retrieval functions 2024-10-25 22:23:21 -04:00
Protesilaos Stavrou 3b18256bea
Switch to if-let* and when-let* everywhere because Emacs 31 deprecates the others 2024-10-24 16:30:53 +03:00
Protesilaos Stavrou 8f68937926
Make stylistic change to denote-link-ol-export
Since we are using pcase and friends in various places, let us have it
here as well for the sake of consistency.
2024-10-24 08:27:43 +03:00
Protesilaos Stavrou b9272f8a1e
Use pcase-let* in denote-link-ol-export
This is just a stylistic change. We are using pcase-let* elsewhere, so
it is better to be consistent.
2024-10-22 10:29:40 +03:00
Protesilaos Stavrou 04fddd1bb7
Merge pull request #466 from jeanphilippegg/fix-regression
Fix regression caused by commit 4db0214
2024-10-22 08:31:24 +03:00
Jean-Philippe Gagné Guay d99d276eba Fix regression caused by commit 4db0214 2024-10-21 20:04:58 -04:00
Protesilaos Stavrou 7dc184ab3d
Merge pull request #464 from jeanphilippegg/some-fixes
Some cleanup and fix `denote-link-dired-marked-notes`
2024-10-21 09:37:34 +03:00
Jean-Philippe Gagné Guay cb3cfd3e3e Rename denote-link--buffer-prompt to denote-link--buffer-file-prompt 2024-10-20 19:56:32 -04:00
Jean-Philippe Gagné Guay 57c604461c Make denote-link--buffer-prompt return absolute paths 2024-10-20 19:32:05 -04:00
Jean-Philippe Gagné Guay 6537d155f4 Use denote-link--insert-links in denote-link-dired-marked-notes 2024-10-20 19:03:39 -04:00
Jean-Philippe Gagné Guay 07a814189e Remove condition in denote-link--map-over-notes
If one open the parent of denote-directory in Dired and use "i" on the
denote-directory, the notes of this subdirectory will be listed in the current
Dired buffer. The user can mark them and call denote-link-dired-marked-notes.
Previously, this would fail because the current Dired buffer is not in
denote-directory.
2024-10-20 18:51:55 -04:00
Jean-Philippe Gagné Guay 4db0214d30 Do not check for nil parameter in denote--dir-in-denote-directory-p 2024-10-20 18:50:37 -04:00
Protesilaos Stavrou f764fac933
Make denote-org-extras-extract-org-subtree work with denote-kill-buffers
This is the same as with commit 244472f. Discussed in issue 460:
<https://github.com/protesilaos/denote/issues/460>.
2024-10-20 16:51:39 +03:00
Protesilaos Stavrou 244472f506
Make the 'denote' command kill buffers after running denote-after-new-note-hook
Otherwise it kills the buffer too early.

Thanks to hapst3r for reporting this problem and to Jean-Philippe
Gagné Guay for contributing to the discussion about how best to
approach this. Done in issue 460:
<https://github.com/protesilaos/denote/issues/460>.
2024-10-20 16:47:08 +03:00
Protesilaos Stavrou f86e3aaff0
Merge pull request #462 from brabalan/rename-buffer
allow nil type in denote-rename-buffer--format
2024-10-16 17:07:07 +03:00
Alan Schmitt 1c2b6ef87b allow nil type in denote-rename-buffer--format 2024-10-16 14:43:18 +02:00
Protesilaos Stavrou 86e3b4e692
Merge pull request #457 from grtcdr/main
Fix unused let-bound variable warnings
2024-10-16 10:36:30 +03:00
grtcdr aaaa5dd129
Fix unused let-bound variable warnings 2024-10-11 11:33:56 +01:00
Protesilaos Stavrou 19f6aaf0b1
Make denote-add-front-matter default to file title and keywords 2024-10-11 13:19:51 +03:00
Protesilaos Stavrou ed0eb4aea2
Acknowledge Aziz for commit 7793135
This was done in pull request 456: <https://github.com/protesilaos/denote/pull/456>.
The change is small, meaning that Aziz does not need to assign
copyright to the Free Software Foundation.
2024-10-11 07:56:29 +03:00
Protesilaos Stavrou f1fb51d199
Merge pull request #456 from grtcdr/master
Remove redundant "Denote" item from denote--menu-contents
2024-10-11 07:55:37 +03:00
grtcdr 7793135139
Remove redundant "Denote" item from denote--menu-contents 2024-10-10 22:51:59 +01:00
Protesilaos Stavrou 9d3b6cb8f6
Add missing warning about development code for commit 960a4c1 2024-10-10 09:27:15 +03:00
Protesilaos Stavrou 960a4c143d
Document how to use denote-journal-extras with org-capture
Thanks to Cosmin-Octavian C for providing the sample code in issue
437: <https://github.com/protesilaos/denote/issues/437>. Also thanks
to Samuel Flint for suggesting such a feature and discussing the issue.
2024-10-10 09:22:25 +03:00
Protesilaos Stavrou 017b3d766f
Autoload denote-journal-extras-path-to-new-or-existing-entry
It can be called from an org-capture template, so it makes sense to
have it this way.
2024-10-10 09:15:53 +03:00
Protesilaos Stavrou 2a56bc592c
Use the correct prefix for denote-journal-extras-path-to-new-or-existing-entry
Thanks to Cosmin-Octavian C and Samuel Flint for discovering this in
issue 437: <https://github.com/protesilaos/denote/issues/437>.
2024-10-10 09:01:24 +03:00
Protesilaos Stavrou 4b9a37d5d7
Reword some statements of the denote-org-store-link-to-heading docs 2024-10-09 09:10:01 +03:00
Protesilaos Stavrou 6497c251fc
Merge branch 'org-context-links-for-headings' 2024-10-09 09:03:36 +03:00
Protesilaos Stavrou 855c06e3db
Merge pull request #453 from jeanphilippegg/sluggification-bug
Fix issue reported in #435
2024-10-07 08:49:24 +03:00
Jean-Philippe Gagné Guay e8e1eb48d2 Put hyphen last in character alternative 2024-10-05 23:53:37 -04:00
Protesilaos Stavrou 0d2167c108
Merge pull request #451 from brabalan/journal_path_v2
make denote-journal-extra-path-to-new-or-existing-entry create a missing entry
2024-10-04 12:50:13 +03:00
Alan Schmitt 62d2dfb22d tweak denote-journal-extra-path-to-new-or-existing-entry
create the path if it is not present
2024-10-01 16:48:41 +02:00
Protesilaos Stavrou df6a416db1
Update sample code to use full paths to subdirectories 2024-09-26 10:01:41 +03:00
Protesilaos Stavrou eb40d6d056
Fix bug in denote-org-extras--get-file-id-and-heading-id-or-context to return heading-id
Thanks to jarofromel for testing the work-in-progress feature and
providing feedback in issue 438: <https://github.com/protesilaos/denote/issues/438>.
2024-09-26 09:52:01 +03:00
Protesilaos Stavrou ce75c1ed49
Fix regression in denote-get-identifier-at-point caused by commit 23bc9db
Thanks to Alan Schmitt for noting that the function had stopped
working. This was done in issue 449:
<https://github.com/protesilaos/denote/issues/449>.
2024-09-26 08:07:59 +03:00
Protesilaos Stavrou 4c0c637387
Rename helper function to denote-org-extras--get-file-id-and-heading-id-or-context
Update its documentation to describe what it is doing right now.
2024-09-23 13:50:23 +03:00
Protesilaos Stavrou 57e2bef9a6
Refactor denote-org-extras--get-file-id-and-heading-id 2024-09-23 13:43:37 +03:00
Protesilaos Stavrou 085ed94841
Simplify denote-org-extras--get-backlinks-for-heading
It should only search for what we pass to it. This way we keep the
special cases to fewer functions, making things more manageable.
2024-09-23 13:42:46 +03:00
Protesilaos Stavrou 8d796be07f
Make denote-link-ol-store prioritise CUSTOM_ID even if context is preferred
This was always the desired behaviour. Thanks to jarofromel for
pointing out the inconsistency in issue 438: <https://github.com/protesilaos/denote/issues/438>.
2024-09-23 12:51:27 +03:00
Protesilaos Stavrou c77959afe4
Note that users may not need org-capture as convenience commands are easy 2024-09-23 08:59:28 +03:00
Protesilaos Stavrou 2dd21d24d7
Update and expand the documentation of "Write your own convenience commands" 2024-09-23 08:57:12 +03:00
Protesilaos Stavrou 31abe41a4b
Reword and refine the documentation about the org-capture integration 2024-09-23 08:45:12 +03:00
Protesilaos Stavrou d7301e08e1
Document how to use org-capture with specific values
I am writing this in response to the question raised by jtpavlock in
discussion 448: <https://github.com/protesilaos/denote/discussions/448>.
2024-09-23 08:43:32 +03:00
Protesilaos Stavrou 6a67534820
Clarify a doc string in denote-test.el 2024-09-22 08:08:32 +03:00
Protesilaos Stavrou 731a5dc2e8
Merge pull request #447 from jeanphilippegg/revert-file-truename
Revert "Use file-truename in denote-filename-is-note-p and denote--di…
2024-09-22 07:49:34 +03:00
Jean-Philippe Gagné Guay 8f2abe4831 Revert "Use file-truename in denote-filename-is-note-p and denote--dir-in-denote-directory-p"
This reverts commit 5fade0cfac.
2024-09-21 08:26:46 -04:00
Protesilaos Stavrou 4e2aabe4d2
Define a more discoverable alias for denote-extract-keywords-from-path 2024-09-21 10:49:17 +03:00
Protesilaos Stavrou 68c296d6a9
Escape the asterisk for context links to make xref/backlinks work properly 2024-09-21 10:24:51 +03:00
Protesilaos Stavrou 8d7fd0a260
Fix denote-org-extras-link-to-heading to always work with context links
Thanks to jarofromel for testing the prototype and identifying the
flaws therein. This was done in issue 438:
<https://github.com/protesilaos/denote/issues/438>.
2024-09-21 10:08:02 +03:00
Protesilaos Stavrou 3065209054
Merge pull request #445 from jeanphilippegg/file-truename
Use file-truename to handle symbolic links (issue #439)
2024-09-21 09:49:56 +03:00
Protesilaos Stavrou 422af65ae0
Merge pull request #444 from jeanphilippegg/move-code
Move code
2024-09-21 09:45:47 +03:00
Jean-Philippe Gagné Guay 60e208fab6 Remove comment about the possibility of regenerating link descriptions when renaming 2024-09-20 21:05:52 -04:00
Jean-Philippe Gagné Guay 827177d2e9 Move keep-current parameter handling from denote--rename-file to denote-rename-file 2024-09-20 21:05:46 -04:00
Jean-Philippe Gagné Guay 5fade0cfac Use file-truename in denote-filename-is-note-p and denote--dir-in-denote-directory-p 2024-09-20 20:28:11 -04:00
Protesilaos Stavrou 0377530250
Fix typo in doc string 2024-09-20 14:41:07 +03:00
Protesilaos Stavrou 3694b19cd3
Untabify and reindent the main file 2024-09-20 14:31:48 +03:00
Protesilaos Stavrou cd6bfb03fa
Make stylistic change to denote-link--buffer-prompt 2024-09-20 14:30:55 +03:00
Protesilaos Stavrou 09e4c6692f
Placate the compiler about 'denote-file-type' 2024-09-20 14:30:05 +03:00
Protesilaos Stavrou 433422758a
Tweak denote-journal-extra-path-to-new-or-existing-entry
This builds on top of commit 126238c by Alan Schmitt, which was done
in pull request 443: <https://github.com/protesilaos/denote/pull/443>.
The change extracts the code we had in a function into a separate
function, though Alan has anyway assigned copyright to the Free
Software Foundation.
2024-09-20 14:19:59 +03:00
Protesilaos Stavrou 1ddf6787dc
Merge branch 'main' of github.com:protesilaos/denote 2024-09-20 14:15:02 +03:00
Protesilaos Stavrou ee2d92859e
Merge pull request #443 from brabalan/denote-journal-extra-path-to-new-or-existing-entry
add `denote-journal-extra-path-to-new-or-existing-entry'
2024-09-20 14:14:39 +03:00
Alan Schmitt 126238c9c1 add `denote-journal-extra-path-to-new-or-existing-entry'
This function returns the path to a journal entry with the given date,
or nil if there is none.

Refactored `denote-journal-extras-new-or-existing-entry' and
`denote-journal-extras-link-or-create-entry' to use it.
2024-09-20 11:33:14 +02:00
Protesilaos Stavrou 7ddff697fc
Make a sample code a bit more robust 2024-09-20 11:38:29 +03:00
Protesilaos Stavrou 7fd4160a99
Remove an empty line 2024-09-20 11:38:18 +03:00
Protesilaos Stavrou dcd92c4ac6
Document how to list empty/non-empty files in a Dired buffer
Thanks to Wilf for suggesting this idea in issue 423:
<https://github.com/protesilaos/denote/issues/423>.
2024-09-18 17:16:14 +03:00
Protesilaos Stavrou d7cafd2427
Clarify comment about the face of 'denote-link-backlink-button' 2024-09-18 16:23:46 +03:00
Protesilaos Stavrou 33f7e73a5d
Use format-prompt in denote--subdirs-completion-table 2024-09-18 16:17:39 +03:00
Protesilaos Stavrou 3f770c67d4
Make denote-directory stand out more in denote-file-prompt 2024-09-18 16:03:24 +03:00
Protesilaos Stavrou 1b9a7df31b
Fix bug in denote-org-capture which ignored DATE in the front matter 2024-09-18 08:26:48 +03:00
Protesilaos Stavrou 58b3dc2d17
Make denote-org-store-link-to-heading accept option for context links
I am providing this option in response to the request from jarofromel
in issue 438: <https://github.com/protesilaos/denote/issues/438>.
2024-09-17 13:52:05 +03:00
Protesilaos Stavrou 48e8949e31
Use 'if' instead of 'cond' for the new denote-filetype-heuristics
This follow from commit c041878 by Jean-Philippe Gagné Guay, which was
done in pull request 436: <https://github.com/protesilaos/denote/pull/436>.
2024-09-16 10:12:36 +03:00
Protesilaos Stavrou 36663f5bae
Merge pull request #436 from jeanphilippegg/denote-file-type-function
Add denote-file-type function
2024-09-16 10:09:00 +03:00
Protesilaos Stavrou 898d75d843
Merge pull request #435 from jeanphilippegg/denote-slug-functions
Clean sluggification functions
2024-09-16 10:07:14 +03:00
Jean-Philippe Gagné Guay c041878177 Add denote-file-type function 2024-09-13 22:26:08 -04:00
Jean-Philippe Gagné Guay 68e31fdb87 Make slug functions public and remove some options and functions 2024-09-13 21:56:25 -04:00
Protesilaos Stavrou 55660d82e0
Update sources for my tmr package 2024-09-13 10:06:08 +03:00
Protesilaos Stavrou b9bfd405a4
Update source link to point to GitHub 2024-09-13 10:05:14 +03:00
Protesilaos Stavrou 468fc7c52c
Add section with custom code for meeting notes
Thanks to Kosta Harlan for discussing this workflow with me. This was
done via a private channel and I am sharing this information with
permission.
2024-09-13 08:20:52 +03:00
Protesilaos Stavrou 51a397ce8a
Clarify that commit 71194be depends on the current development target 2024-09-12 17:58:10 +03:00
Protesilaos Stavrou 71194be24a
Document custom commands to switch to a silo
Thanks to IceAsteroid for suggesting this in issue 432:
<https://github.com/protesilaos/denote/issues/432>.
2024-09-12 17:57:07 +03:00
Protesilaos Stavrou d47e0df0a5
Add check that SILO is among denote-silo-extras-directories
This way, we do not operate on arbitrary paths. Users can still do
that with custom code, though it is better for us to focus on the
intent of the code.
2024-09-12 17:46:44 +03:00
Protesilaos Stavrou fc00f1469b
Document sample code on how to auto rename a Denote file
I helped Lukas C. Bossert figure this out in discussion 430 and am
documenting it in case other users have a need for it:
<https://github.com/protesilaos/denote/discussions/430>.
2024-09-09 10:02:44 +03:00
Protesilaos Stavrou 4e7b4a9617
Write top-level heading for packages that build on Denote 2024-09-09 09:56:18 +03:00
Protesilaos Stavrou efc7ef5e2e
Note that those who use a custom grep may prefer consult instead 2024-09-09 09:50:16 +03:00
Protesilaos Stavrou 3226846c0e
Correct a heading in the manual 2024-09-09 09:50:07 +03:00
Protesilaos Stavrou 23bc9dbca3
Define :help-echo function for Org links
Thanks to Julian Hoch for asking about this. It was done via a private
channel and I am sharing the information with permission.
2024-09-09 09:05:54 +03:00
Protesilaos Stavrou d5cf6222d5
Make a small rewording to the manual 2024-09-09 08:11:18 +03:00
Protesilaos Stavrou 8ac9defa14
Merge pull request #429 from jeanphilippegg/optional-parameters
Make denote-rename-file parameters non-optional
2024-09-09 08:09:20 +03:00
Jean-Philippe Gagné Guay a45d62a64a Use denote-retrieve-title-or-filename in denote--rename-file 2024-09-08 11:03:18 -04:00
Jean-Philippe Gagné Guay 18f92264db Make parameters of denote--rename-file accept a keep-current symbol 2024-09-08 10:42:48 -04:00
Jean-Philippe Gagné Guay ffbb55bbff Make denote-rename-file parameters non-optional 2024-09-07 22:41:13 -04:00
12 changed files with 8822 additions and 5687 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

4696
README.org

File diff suppressed because it is too large Load diff

View file

@ -1,252 +0,0 @@
;;; denote-journal-extras.el --- Convenience functions for daily journaling -*- lexical-binding: t; -*-
;; Copyright (C) 2023-2024 Free Software Foundation, Inc.
;; Author: Protesilaos Stavrou <info@protesilaos.com>
;; Maintainer: Protesilaos Stavrou <info@protesilaos.com>
;; URL: https://github.com/protesilaos/denote
;; This file is NOT part of GNU Emacs.
;; 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
;; the Free Software Foundation, either version 3 of the License, or
;; (at your option) any later version.
;; This program is distributed in the hope that it will be useful,
;; but WITHOUT ANY WARRANTY; without even the implied warranty of
;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
;; GNU General Public License for more details.
;; You should have received a copy of the GNU General Public License
;; along with this program. If not, see <https://www.gnu.org/licenses/>.
;;; Commentary:
;; This is a set of optional convenience functions that used to be
;; provided in the Denote manual. They facilitate the use of Denote
;; for daily journaling.
;;; Code:
(require 'denote)
(defgroup denote-journal-extras nil
"Denote for daily journaling."
:group 'denote
:link '(info-link "(denote) Top")
:link '(url-link :tag "Homepage" "https://protesilaos.com/emacs/denote"))
(defcustom denote-journal-extras-directory
(expand-file-name "journal" denote-directory)
"Directory for storing daily journal entries.
This can either be the same as the variable `denote-directory' or
a subdirectory of it.
A value of nil means to use the variable `denote-directory'.
Journal entries will thus be in a flat listing together with all
other notes. They can still be retrieved easily by searching for
the `denote-journal-extras-keyword'."
:group 'denote-journal-extras
:type '(choice (directory :tag "Provide directory path (is created if missing)")
(const :tag "Use the `denote-directory'" nil)))
(defcustom denote-journal-extras-keyword "journal"
"Single word keyword to tag journal entries.
It is used by `denote-journal-extras-new-entry' to add a keyword
to the newly created file."
:group 'denote-journal-extras
:type 'string)
(defcustom denote-journal-extras-title-format 'day-date-month-year-24h
"Date format to construct the title with `denote-journal-extras-new-entry'.
The value is either a symbol or an arbitrary string that is
passed to `format-time-string' (consult its documentation for the
technicalities).
Acceptable symbols and their corresponding styles are:
| Symbol | Style |
|-------------------------+-----------------------------------|
| day | Monday |
| day-date-month-year | Monday 19 September 2023 |
| day-date-month-year-24h | Monday 19 September 2023 20:49 |
| day-date-month-year-12h | Monday 19 September 2023 08:49 PM |
With a nil value, make `denote-journal-extras-new-entry' prompt
for a title."
:group 'denote-journal-extras
:type '(choice
(const :tag "Prompt for title with `denote-journal-extras-new-entry'" nil)
(const :tag "Monday"
:doc "The `format-time-string' is: %A"
day)
(const :tag "Monday 19 September 2023"
:doc "The `format-time-string' is: %A %e %B %Y"
day-date-month-year)
(const :tag "Monday 19 September 2023 20:49"
:doc "The `format-time-string' is: %A %e %B %Y %H:%M"
day-date-month-year-24h)
(const :tag "Monday 19 September 2023 08:49 PM"
:doc "The `format-time-string' is: %A %e %B %Y %I:%M %^p"
day-date-month-year-12h)
(string :tag "Custom string with `format-time-string' specifiers")))
(defcustom denote-journal-extras-hook nil
"Normal hook called after `denote-journal-extras-new-entry'.
Use this to, for example, set a timer after starting a new
journal entry (refer to the `tmr' package on GNU ELPA)."
:group 'denote-journal-extras
:type 'hook)
(defun denote-journal-extras-directory ()
"Make the variable `denote-journal-extras-directory' and its parents."
(if-let (((stringp denote-journal-extras-directory))
(directory (file-name-as-directory (expand-file-name denote-journal-extras-directory))))
(progn
(when (not (file-directory-p denote-journal-extras-directory))
(make-directory directory :parents))
directory)
(denote-directory)))
(defun denote-journal-extras-daily--title-format (&optional date)
"Return present date in `denote-journal-extras-title-format' or prompt for title.
With optional DATE, use it instead of the present date. DATE has
the same format as that returned by `current-time'."
(format-time-string
(if (and denote-journal-extras-title-format
(stringp denote-journal-extras-title-format))
denote-journal-extras-title-format
(pcase denote-journal-extras-title-format
('day "%A")
('day-date-month-year "%A %e %B %Y")
('day-date-month-year-24h "%A %e %B %Y %H:%M")
('day-date-month-year-12h "%A %e %B %Y %I:%M %^p")
(_ (denote-title-prompt (format-time-string "%F" date)))))
date))
(defun denote-journal-extras--get-template ()
"Return template that has `journal' key in `denote-templates'.
If no template with `journal' key exists but `denote-templates'
is non-nil, prompt the user for a template among
`denote-templates'. Else return nil.
Also see `denote-journal-extras-new-entry'."
(if-let ((template (alist-get 'journal denote-templates)))
template
(when denote-templates
(denote-template-prompt))))
;;;###autoload
(defun denote-journal-extras-new-entry (&optional date)
"Create a new journal entry in variable `denote-journal-extras-directory'.
Use `denote-journal-extras-keyword' as a keyword for the newly
created file. Set the title of the new entry according to the
value of the user option `denote-journal-extras-title-format'.
With optional DATE as a prefix argument, prompt for a date. If
`denote-date-prompt-use-org-read-date' is non-nil, use the Org
date selection module.
When called from Lisp DATE is a string and has the same format as
that covered in the documentation of the `denote' function. It
is internally processed by `denote-parse-date'."
(interactive (list (when current-prefix-arg (denote-date-prompt))))
(let ((internal-date (denote-parse-date date))
(denote-directory (denote-journal-extras-directory)))
(denote
(denote-journal-extras-daily--title-format internal-date)
`(,denote-journal-extras-keyword)
nil nil date
(denote-journal-extras--get-template))
(run-hooks 'denote-journal-extras-hook)))
(defun denote-journal-extras--entry-today (&optional date)
"Return list of files matching a journal for today or optional DATE.
DATE has the same format as that returned by `denote-parse-date'."
(let* ((identifier (format "%sT[0-9]\\{6\\}" (format-time-string "%Y%m%d" date)))
(files (denote-directory-files identifier))
(keyword (concat "_" (regexp-quote denote-journal-extras-keyword))))
(seq-filter
(lambda (file)
(string-match-p keyword file))
files)))
;;;###autoload
(defun denote-journal-extras-new-or-existing-entry (&optional date)
"Locate an existing journal entry or create a new one.
A journal entry is one that has `denote-journal-extras-keyword' as
part of its file name.
If there are multiple journal entries for the current date,
prompt for one using minibuffer completion. If there is only
one, visit it outright. If there is no journal entry, create one
by calling `denote-journal-extra-new-entry'.
With optional DATE as a prefix argument, prompt for a date. If
`denote-date-prompt-use-org-read-date' is non-nil, use the Org
date selection module.
When called from Lisp, DATE is a string and has the same format
as that covered in the documentation of the `denote' function.
It is internally processed by `denote-parse-date'."
(interactive
(list
(when current-prefix-arg
(denote-date-prompt))))
(let* ((internal-date (denote-parse-date date))
(files (denote-journal-extras--entry-today internal-date)))
(cond
((length> files 1)
(find-file (completing-read "Select journal entry: " files nil :require-match)))
(files
(find-file (car files)))
(t
(denote-journal-extras-new-entry date)))))
;;;###autoload
(defun denote-journal-extras-link-or-create-entry (&optional date id-only)
"Use `denote-link' on journal entry, creating it if necessary.
A journal entry is one that has `denote-journal-extras-keyword' as
part of its file name.
If there are multiple journal entries for the current date,
prompt for one using minibuffer completion. If there is only
one, link to it outright. If there is no journal entry, create one
by calling `denote-journal-extra-new-entry' and link to it.
With optional DATE as a prefix argument, prompt for a date. If
`denote-date-prompt-use-org-read-date' is non-nil, use the Org
date selection module.
When called from Lisp, DATE is a string and has the same format
as that covered in the documentation of the `denote' function.
It is internally processed by `denote-parse-date'.
With optional ID-ONLY as a prefix argument create a link that
consists of just the identifier. Else try to also include the
file's title. This has the same meaning as in `denote-link'."
(interactive
(pcase current-prefix-arg
('(16) (list (denote-date-prompt) :id-only))
('(4) (list (denote-date-prompt)))))
(let* ((internal-date (denote-parse-date date))
(files (denote-journal-extras--entry-today internal-date))
(path))
(cond
((length> files 1)
(setq path (completing-read "Select journal entry: " files nil :require-match)))
(files
(setq path (car files)))
(t
(save-window-excursion
(denote-journal-extras-new-entry date)
(save-buffer)
(setq path (buffer-file-name)))))
(denote-link path
(denote-filetype-heuristics (buffer-file-name))
(denote--link-get-description path)
id-only)))
(provide 'denote-journal-extras)
;;; denote-journal-extras.el ends here

View file

@ -1,70 +0,0 @@
;;; denote-org-dblock.el --- Compatibility alieases for Denote Org Dynamic blocks -*- lexical-binding: t -*-
;; Copyright (C) 2022-2024 Free Software Foundation, Inc.
;; Authors: Elias Storms <elias.storms@gmail.com>,
;; Protesilaos Stavrou <info@protesilaos.com>
;; Maintainer: Protesilaos Stavrou <info@protesilaos.com>
;; Deprecated-since: 3.0.0
;; URL: https://github.com/protesilaos/denote
;; This file is NOT part of GNU Emacs.
;; 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
;; the Free Software Foundation, either version 3 of the License, or
;; (at your option) any later version.
;;
;; This program is distributed in the hope that it will be useful,
;; but WITHOUT ANY WARRANTY; without even the implied warranty of
;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
;; GNU General Public License for more details.
;;
;; You should have received a copy of the GNU General Public License
;; along with this program. If not, see <https://www.gnu.org/licenses/>.
;;; Commentary:
;;
;; This file defines compatibility aliases for Org dynamic blocks set
;; up by Denote. The new source of these is the denote-org-extras.el.
;;
;; Below is the old commentary.
;;
;; * * *
;;
;; This file defines Org dynamic blocks using the facility described
;; in the Org manual. Evaluate this:
;;
;; (info "(org) Dynamic Blocks")
;;
;; The dynamic blocks defined herein are documented at length in the
;; Denote manual. See the following node and its subsections:
;;
;; (info "(denote) Use Org dynamic blocks")
;;; Code:
(require 'denote-org-extras)
(define-obsolete-function-alias
'denote-org-dblock-insert-links
'denote-org-extras-dblock-insert-links
"3.0.0")
(define-obsolete-function-alias
'denote-org-dblock-insert-backlinks
'denote-org-extras-dblock-insert-backlinks
"3.0.0")
(define-obsolete-function-alias
'denote-org-dblock-insert-files
'denote-org-extras-dblock-insert-files
"3.0.0")
(display-warning
'denote
"`denote-org-dblock.el' is obsolete; use `denote-org-extras.el'"
:warning)
(provide 'denote-org-dblock)
;;; denote-org-dblock.el ends here

View file

@ -1,736 +0,0 @@
;;; denote-org-extras.el --- Denote extensions for Org mode -*- lexical-binding: t -*-
;; Copyright (C) 2024 Free Software Foundation, Inc.
;; Author: Protesilaos Stavrou <info@protesilaos.com>
;; Maintainer: Protesilaos Stavrou <info@protesilaos.com>
;; URL: https://github.com/protesilaos/denote
;; This file is NOT part of GNU Emacs.
;; 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
;; the Free Software Foundation, either version 3 of the License, or
;; (at your option) any later version.
;;
;; This program is distributed in the hope that it will be useful,
;; but WITHOUT ANY WARRANTY; without even the implied warranty of
;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
;; GNU General Public License for more details.
;;
;; You should have received a copy of the GNU General Public License
;; along with this program. If not, see <https://www.gnu.org/licenses/>.
;;; Commentary:
;;
;; Optional extensions to Denote that work specifically with Org mode.
;;; Code:
(require 'denote)
(require 'denote-sort)
(require 'org)
;;;; Link to file and heading
(defun denote-org-extras--get-outline (file)
"Return `outline-regexp' headings and line numbers of FILE."
(with-current-buffer (find-file-noselect file)
(let ((outline-regexp (format "^\\(?:%s\\)" (or (bound-and-true-p outline-regexp) "[*\^L]+")))
candidates)
(save-excursion
(goto-char (point-min))
(while (if (bound-and-true-p outline-search-function)
(funcall outline-search-function)
(re-search-forward outline-regexp nil t))
(push
;; NOTE 2024-01-20: The -5 (minimum width) is a
;; sufficiently high number to keep the alignment
;; consistent in most cases. Larger files will simply
;; shift the heading text in minibuffer, but this is not an
;; issue anymore.
(format "%-5s %s"
(line-number-at-pos (point))
(buffer-substring-no-properties (line-beginning-position) (line-end-position)))
candidates)
(goto-char (1+ (line-end-position)))))
(if candidates
(nreverse candidates)
(user-error "No outline")))))
(define-obsolete-function-alias
'denote-org-extras--outline-prompt
'denote-org-extras-outline-prompt
"3.1.0")
(defun denote-org-extras-outline-prompt (&optional file)
"Prompt for outline among headings retrieved by `denote-org-extras--get-outline'.
With optional FILE use the outline of it, otherwise use that of
the current file."
(let ((current-file (or file buffer-file-name)))
(completing-read
(format "Select heading inside `%s': "
(propertize (file-name-nondirectory current-file) 'face 'denote-faces-prompt-current-name))
(denote--completion-table-no-sort 'imenu (denote-org-extras--get-outline current-file))
nil :require-match)))
(defun denote-org-extras--get-heading-and-id-from-line (line file)
"Return heading text and CUSTOM_ID from the given LINE in FILE."
(with-current-buffer (find-file-noselect file)
(save-excursion
(goto-char (point-min))
(forward-line (1- line))
(cons (denote-link-ol-get-heading) (denote-link-ol-get-id)))))
(defun denote-org-extras-format-link-with-heading (file heading-id description)
"Prepare link to FILE with HEADING-ID using DESCRIPTION."
(when (region-active-p)
(setq description (buffer-substring-no-properties (region-beginning) (region-end)))
(denote--delete-active-region-content))
(format "[[denote:%s::#%s][%s]]"
(denote-retrieve-filename-identifier file)
heading-id
description))
;;;###autoload
(defun denote-org-extras-link-to-heading ()
"Link to file and then specify a heading to extend the link to.
The resulting link has the following pattern:
[[denote:IDENTIFIER::#ORG-HEADING-CUSTOM-ID]][Description::Heading text]].
Because only Org files can have links to individual headings,
limit the list of possible files to those which include the .org
file extension (remember that Denote works with many file types,
per the user option `denote-file-type').
The user option `denote-org-extras-store-link-to-heading'
determined whether the `org-store-link' function can save a link
to the current heading. Such links look the same as those of
this command, though the functionality defined herein is
independent of it.
To only link to a file, use the `denote-link' command.
Also see `denote-org-extras-backlinks-for-heading'."
(declare (interactive-only t))
(interactive nil org-mode)
(unless (derived-mode-p 'org-mode)
(user-error "Links to headings only work between Org files"))
(when-let ((file (denote-file-prompt ".*\\.org"))
(file-text (denote--link-get-description file))
(heading (denote-org-extras-outline-prompt file))
(line (string-to-number (car (split-string heading "\t"))))
(heading-data (denote-org-extras--get-heading-and-id-from-line line file))
(heading-text (car heading-data))
(heading-id (cdr heading-data))
(description (denote-link-format-heading-description file-text heading-text)))
(insert (denote-org-extras-format-link-with-heading file heading-id description))))
;;;; Heading backlinks
(defun denote-org-extras--get-file-id-and-heading-id (&optional file)
"Return IDENTIFIER::#ORG-HEADING-CUSTOM-ID string for FILE heading at point.
If FILE is nil, use the variable `buffer-file-name'."
(if-let ((heading-id (org-entry-get (point) "CUSTOM_ID")))
(concat (denote-retrieve-filename-identifier-with-error (or file buffer-file-name)) "::#" heading-id)
(error "No CUSTOM_ID for heading at point in file `%s'" file)))
(defun denote-org-extras--get-backlinks-buffer-name (text)
"Format a buffer name for `denote-org-extras-backlinks-for-heading' with TEXT."
(format "*Denote HEADING backlinks for %S*" text))
(defun denote-org-extras--get-backlinks-for-heading (file-and-heading-id)
"Get backlinks to FILE-AND-HEADING-ID as a list of strings."
(when-let ((files (denote-directory-files nil :omit-current :text-only))
(xref-file-name-display 'abs)
(matches-in-files (xref-matches-in-files file-and-heading-id files))
(xref-alist (xref--analyze matches-in-files)))
(mapcar
(lambda (x)
(denote-get-file-name-relative-to-denote-directory (car x)))
xref-alist)))
;;;###autoload
(defun denote-org-extras-backlinks-for-heading ()
"Produce backlinks for the current heading.
This otherwise has the same behaviour as `denote-backlinks'---refer to
that for the details.
Also see `denote-org-extras-link-to-heading'."
(interactive)
(when-let ((heading-id (denote-org-extras--get-file-id-and-heading-id buffer-file-name))
(heading-text (substring-no-properties (denote-link-ol-get-heading))))
(denote-link--prepare-backlinks heading-id ".*\\.org" (denote-org-extras--get-backlinks-buffer-name heading-text))))
;;;; Extract subtree into its own note
(defun denote-org-extras--get-heading-date ()
"Try to return a timestamp for the current Org heading.
This can be used as the value for the DATE argument of the
`denote' command."
(when-let ((pos (point))
(timestamp (or (org-entry-get pos "DATE")
(org-entry-get pos "CREATED")
(org-entry-get pos "CLOSED"))))
(date-to-time timestamp)))
;;;###autoload
(defun denote-org-extras-extract-org-subtree ()
"Create new Denote note using the current Org subtree as input.
Remove the subtree from its current file and move its contents
into a new Denote file (a subtree is a heading with all of its
contents, including subheadings).
Take the text of the subtree's top level heading and use it as
the title of the new note.
If the heading has any tags, use them as the keywords of the new
note. If the Org file has any #+filetags use them as well (Org's
filetags are inherited by the headings). If none of these are
true and the user option `denote-prompts' includes an entry for
keywords, then prompt for keywords. Else do not include any
keywords.
If the heading has a PROPERTIES drawer, retain it for further
review.
If the heading's PROPERTIES drawer includes a DATE or CREATED
property, or there exists a CLOSED statement with a timestamp
value, use that to derive the date (or date and time) of the new
note (if there is only a date, the time is taken as 00:00). If
more than one of these is present, the order of preference is
DATE, then CREATED, then CLOSED. If none of these is present,
use the current time. If the `denote-prompts' includes an entry
for a date, then prompt for a date at this stage (also see
`denote-date-prompt-use-org-read-date').
For the rest, consult the value of the user option
`denote-prompts' in the following scenaria:
- Optionally prompt for a subdirectory, otherwise produce the new
note in the variable `denote-directory'.
- Optionally prompt for a file signature, otherwise do not use
one.
Make the new note an Org file regardless of the value of
`denote-file-type'."
(interactive nil org-mode)
(unless (derived-mode-p 'org-mode)
(user-error "Headings can only be extracted from Org files"))
(if-let ((text (org-get-entry))
(heading (denote-link-ol-get-heading)))
(let ((tags (org-get-tags))
(date (denote-org-extras--get-heading-date))
subdirectory
signature)
(dolist (prompt denote-prompts)
(pcase prompt
('keywords (when (not tags)
(setq tags (denote-keywords-prompt))))
('subdirectory (setq subdirectory (denote-subdirectory-prompt)))
('date (when (not date) (setq date (denote-date-prompt))))
('signature (setq signature (denote-signature-prompt)))))
(delete-region (org-entry-beginning-position)
(save-excursion (org-end-of-subtree t) (point)))
(denote heading tags 'org subdirectory date nil signature)
(insert text))
(user-error "No subtree to extract; aborting")))
;;;; Convert links from `:denote' to `:file' and vice versa
;; TODO 2024-02-28: Do we need to convert between other link types? I
;; think not, since the `denote:' type is modelled after the `file:'
;; one.
(defun denote-org-extras--get-link-type-regexp (type)
"Return regexp for Org link TYPE.
TYPE is a symbol of either `file' or `denote'.
The regexp consists of four groups. Group 1 is the link type, 2
is the target, 3 is the target's search terms, and 4 is the
description."
(let ((group-1))
(pcase type
('denote (setq group-1 "denote"))
('file (setq group-1 "file"))
(_ (error "`%s' is an unknown link type" type)))
(format "\\[\\[\\(?1:%s:\\)\\(?:\\(?2:.*?\\)\\(?3:::.*\\)?\\]\\|\\]\\)\\(?4:\\[\\(?:.*?\\)\\]\\)?\\]" group-1)))
(defun denote-org-extras--get-path (id)
"Return file path to ID according to `org-link-file-path-type'."
(if (or (eq org-link-file-path-type 'adaptive)
(eq org-link-file-path-type 'relative))
(denote-get-relative-path-by-id id)
(denote-get-path-by-id id)))
;;;###autoload
(defun denote-org-extras-convert-links-to-file-type ()
"Convert denote: links to file: links in the current Org buffer.
Ignore all other link types. Also ignore links that do not
resolve to a file in the variable `denote-directory'."
(interactive nil org-mode)
(if (derived-mode-p 'org-mode)
(progn
(goto-char (point-min))
(while (re-search-forward (denote-org-extras--get-link-type-regexp 'denote) nil :no-error)
(let* ((id (match-string-no-properties 2))
(search (or (match-string-no-properties 3) ""))
(desc (or (match-string-no-properties 4) ""))
(file (save-match-data (denote-org-extras--get-path id))))
(when id
(let ((new-text (if desc
(format "[[file:%s%s]%s]" file search desc)
(format "[[file:%s%s]]" file search))))
(replace-match new-text :fixed-case :literal)))))
;; TODO 2024-02-28: notify how many changed.
(message "Converted `denote:' links to `file:' links"))
(user-error "The current file is not using Org mode")))
;;;###autoload
(defun denote-org-extras-convert-links-to-denote-type ()
"Convert file: links to denote: links in the current Org buffer.
Ignore all other link types. Also ignore file: links that do not
point to a file with a Denote file name."
(interactive nil org-mode)
(if (derived-mode-p 'org-mode)
(progn
(goto-char (point-min))
(while (re-search-forward (denote-org-extras--get-link-type-regexp 'file) nil :no-error)
(let* ((file (match-string-no-properties 2))
(search (or (match-string-no-properties 3) ""))
(desc (or (match-string-no-properties 4) ""))
(id (save-match-data (denote-retrieve-filename-identifier file))))
(when id
(let ((new-text (if desc
(format "[[denote:%s%s]%s]" id search desc)
(format "[[denote:%s%s]]" id search))))
(replace-match new-text :fixed-case :literal)))))
;; TODO 2024-02-28: notify how many changed.
(message "Converted as `file:' links to `denote:' links"))
(user-error "The current file is not using Org mode")))
;;;; Org dynamic blocks
;; NOTE 2024-01-22 12:26:13 +0200: The following is copied from the
;; now-deleted denote-org-dblock.el. Its original author was Elias
;; Storms <elias.storms@gmail.com>, with substantial contributions and
;; further developments by me (Protesilaos).
;; This section defines Org dynamic blocks using the facility described
;; in the Org manual. Evaluate this:
;;
;; (info "(org) Dynamic Blocks")
;;
;; The dynamic blocks defined herein are documented at length in the
;; Denote manual. See the following node and its subsections:
;;
;; (info "(denote) Use Org dynamic blocks")
;;;;; Common helper functions
(defun denote-org-extras-dblock--files (files-matching-regexp &optional sort-by-component reverse)
"Return list of FILES-MATCHING-REGEXP in variable `denote-directory'.
SORT-BY-COMPONENT and REVERSE have the same meaning as
`denote-sort-files'. If both are nil, do not try to perform any
sorting.
Also see `denote-org-extras-dblock--files-missing-only'."
(cond
((and sort-by-component reverse)
(denote-sort-get-directory-files files-matching-regexp sort-by-component reverse :omit-current))
(sort-by-component
(denote-sort-get-directory-files files-matching-regexp sort-by-component nil :omit-current))
(reverse
(denote-sort-get-directory-files files-matching-regexp :no-component-specified reverse :omit-current))
(t
(denote-directory-files files-matching-regexp :omit-current))))
(defun denote-org-extras-dblock--get-missing-links (regexp)
"Return list of missing links to all notes matching REGEXP.
Missing links are those for which REGEXP does not have a match in
the current buffer."
(let ((found-files (denote-directory-files regexp :omit-current))
(linked-files (denote-link--expand-identifiers denote-org-link-in-context-regexp)))
(if-let ((final-files (seq-difference found-files linked-files)))
final-files
(message "All links matching `%s' are present" regexp)
'())))
(defun denote-org-extras-dblock--files-missing-only (files-matching-regexp &optional sort-by-component reverse)
"Return list of missing links to FILES-MATCHING-REGEXP.
SORT-BY-COMPONENT and REVERSE have the same meaning as
`denote-sort-files'. If both are nil, do not try to perform any
sorting.
Also see `denote-org-extras-dblock--files'."
(denote-sort-files
(denote-org-extras-dblock--get-missing-links files-matching-regexp)
sort-by-component
reverse))
;;;;; Dynamic block to insert links
;;;###autoload
(defun denote-org-extras-dblock-insert-links (regexp)
"Create Org dynamic block to insert Denote links matching REGEXP."
(interactive
(list
(denote-files-matching-regexp-prompt))
org-mode)
(org-create-dblock (list :name "denote-links"
:regexp regexp
:excluded-dirs-regexp nil
:sort-by-component nil
:reverse-sort nil
:id-only nil
:include-date nil))
(org-update-dblock))
;; NOTE 2024-03-30: This is how the autoload is done in org.el.
;;;###autoload
(eval-after-load 'org
'(progn
(org-dynamic-block-define "denote-links" 'denote-org-extras-dblock-insert-links)))
;;;###autoload
(defun org-dblock-write:denote-links (params)
"Function to update `denote-links' Org Dynamic blocks.
Used by `org-dblock-update' with PARAMS provided by the dynamic block."
(let* ((regexp (plist-get params :regexp))
(rx (if (listp regexp) (macroexpand `(rx ,regexp)) regexp))
(sort (plist-get params :sort-by-component))
(reverse (plist-get params :reverse-sort))
(include-date (plist-get params :include-date))
(block-name (plist-get params :block-name))
(denote-excluded-directories-regexp (or (plist-get params :excluded-dirs-regexp)
denote-excluded-directories-regexp))
(files (denote-org-extras-dblock--files rx sort reverse)))
(when block-name (insert "#+name: " block-name "\n"))
(denote-link--insert-links files 'org (plist-get params :id-only) :no-other-sorting include-date)
(join-line))) ; remove trailing empty line
;;;;; Dynamic block to insert missing links
;;;###autoload
(defun denote-org-extras-dblock-insert-missing-links (regexp)
"Create Org dynamic block to insert Denote links matching REGEXP."
(interactive
(list
(denote-files-matching-regexp-prompt))
org-mode)
(org-create-dblock (list :name "denote-missing-links"
:regexp regexp
:excluded-dirs-regexp nil
:sort-by-component nil
:reverse-sort nil
:id-only nil
:include-date nil))
(org-update-dblock))
;; NOTE 2024-03-30: This is how the autoload is done in org.el.
;;;###autoload
(eval-after-load 'org
'(progn
(org-dynamic-block-define "denote-missing-links" 'denote-org-extras-dblock-insert-links)))
;;;###autoload
(defun org-dblock-write:denote-missing-links (params)
"Function to update `denote-links' Org Dynamic blocks.
Used by `org-dblock-update' with PARAMS provided by the dynamic block."
(let* ((regexp (plist-get params :regexp))
(rx (if (listp regexp) (macroexpand `(rx ,regexp)) regexp))
(sort (plist-get params :sort-by-component))
(reverse (plist-get params :reverse-sort))
(include-date (plist-get params :include-date))
(block-name (plist-get params :block-name))
(denote-excluded-directories-regexp (or (plist-get params :excluded-dirs-regexp)
denote-excluded-directories-regexp))
(files (denote-org-extras-dblock--files-missing-only rx sort reverse)))
(when block-name (insert "#+name: " block-name "\n"))
(denote-link--insert-links files 'org (plist-get params :id-only) :no-other-sorting include-date)
(join-line))) ; remove trailing empty line
;;;;; Dynamic block to insert backlinks
(defun denote-org-extras-dblock--maybe-sort-backlinks (files sort-by-component reverse)
"Sort backlink FILES if SORT-BY-COMPONENT and/or REVERSE is non-nil."
(cond
((and sort-by-component reverse)
(denote-sort-files files sort-by-component reverse))
(sort-by-component
(denote-sort-files files sort-by-component))
(reverse
(denote-sort-files files :no-component-specified reverse))
(t
files)))
;;;###autoload
(defun denote-org-extras-dblock-insert-backlinks ()
"Create Org dynamic block to insert Denote backlinks to current file."
(interactive nil org-mode)
(org-create-dblock (list :name "denote-backlinks"
:excluded-dirs-regexp nil
:sort-by-component nil
:reverse-sort nil
:id-only nil
:this-heading-only nil
:include-date nil))
(org-update-dblock))
;; NOTE 2024-03-30: This is how the autoload is done in org.el.
;;;###autoload
(eval-after-load 'org
'(progn
(org-dynamic-block-define "denote-backlinks" 'denote-org-extras-dblock-insert-backlinks)))
;;;###autoload
(defun org-dblock-write:denote-backlinks (params)
"Function to update `denote-backlinks' Org Dynamic blocks.
Used by `org-dblock-update' with PARAMS provided by the dynamic block."
(when-let ((files (if (plist-get params :this-heading-only)
(denote-org-extras--get-backlinks-for-heading (denote-org-extras--get-file-id-and-heading-id))
(denote-link-return-backlinks))))
(let* ((sort (plist-get params :sort-by-component))
(reverse (plist-get params :reverse-sort))
(include-date (plist-get params :include-date))
(denote-excluded-directories-regexp (or (plist-get params :excluded-dirs-regexp)
denote-excluded-directories-regexp))
(files (denote-org-extras-dblock--maybe-sort-backlinks files sort reverse)))
(denote-link--insert-links files 'org (plist-get params :id-only) :no-other-sorting include-date)
(join-line)))) ; remove trailing empty line
;;;;; Dynamic block to insert entire file contents
(defun denote-org-extras-dblock--get-file-contents (file &optional no-front-matter add-links)
"Insert the contents of FILE.
With optional NO-FRONT-MATTER as non-nil, try to remove the front
matter from the top of the file. If NO-FRONT-MATTER is a number,
remove that many lines starting from the top. If it is any other
non-nil value, delete from the top until the first blank line.
With optional ADD-LINKS as non-nil, first insert a link to the
file and then insert its contents. In this case, format the
contents as a typographic list. If ADD-LINKS is `id-only', then
insert links as `denote-link' does when supplied with an ID-ONLY
argument."
(when (denote-file-is-note-p file)
(with-temp-buffer
(when add-links
(insert
(format "- %s\n\n"
(denote-format-link
file
(denote--link-get-description file)
'org
(eq add-links 'id-only)))))
(let ((beginning-of-contents (point)))
(insert-file-contents file)
(when no-front-matter
(delete-region
(if (natnump no-front-matter)
(progn (forward-line no-front-matter) (line-beginning-position))
(1+ (re-search-forward "^$" nil :no-error 1)))
beginning-of-contents))
(when add-links
(indent-region beginning-of-contents (point-max) 2)))
(buffer-string))))
(defvar denote-org-extras-dblock-file-contents-separator
(concat "\n\n" (make-string 50 ?-) "\n\n\n")
"Fallback separator used by `denote-org-extras-dblock-add-files'.")
(defun denote-org-extras-dblock--separator (separator)
"Return appropriate value of SEPARATOR for `denote-org-extras-dblock-add-files'."
(cond
((null separator) "")
((stringp separator) separator)
(t denote-org-extras-dblock-file-contents-separator)))
(defun denote-org-extras-dblock-add-files (regexp &optional separator no-front-matter add-links sort-by-component reverse excluded-dirs-regexp)
"Insert files matching REGEXP.
Seaprate them with the optional SEPARATOR. If SEPARATOR is nil,
use the `denote-org-extras-dblock-file-contents-separator'.
If optional NO-FRONT-MATTER is non-nil try to remove the front
matter from the top of the file. Do it by finding the first
blank line, starting from the top of the buffer.
If optional ADD-LINKS is non-nil, first insert a link to the file
and then insert its contents. In this case, format the contents
as a typographic list.
If optional SORT-BY-COMPONENT is a symbol among `denote-sort-components',
sort files matching REGEXP by the corresponding Denote file name
component. If the symbol is not among `denote-sort-components',
fall back to the default identifier-based sorting.
If optional REVERSE is non-nil reverse the sort order.
Optional EXCLUDED-DIRS-REGEXP is the `let' bound value of
`denote-excluded-directories-regexp'. When nil, the original value of
that user option is used."
(let* ((denote-excluded-directories-regexp (or excluded-dirs-regexp denote-excluded-directories-regexp))
(files (denote-org-extras-dblock--files regexp sort-by-component reverse))
(files-contents (mapcar
(lambda (file) (denote-org-extras-dblock--get-file-contents file no-front-matter add-links))
files)))
(insert (string-join files-contents (denote-org-extras-dblock--separator separator)))))
;;;###autoload
(defun denote-org-extras-dblock-insert-files (regexp sort-by-component)
"Create Org dynamic block to insert Denote files matching REGEXP.
Sort the files according to SORT-BY-COMPONENT, which is a symbol
among `denote-sort-components'."
(interactive
(list
(denote-files-matching-regexp-prompt)
(denote-sort-component-prompt))
org-mode)
(org-create-dblock (list :name "denote-files"
:regexp regexp
:excluded-dirs-regexp nil
:sort-by-component sort-by-component
:reverse-sort nil
:no-front-matter nil
:file-separator nil
:add-links nil))
(org-update-dblock))
;; NOTE 2024-03-30: This is how the autoload is done in org.el.
;;;###autoload
(eval-after-load 'org
'(progn
(org-dynamic-block-define "denote-files" 'denote-org-extras-dblock-insert-files)))
;;;###autoload
(defun org-dblock-write:denote-files (params)
"Function to update `denote-files' Org Dynamic blocks.
Used by `org-dblock-update' with PARAMS provided by the dynamic block."
(let* ((regexp (plist-get params :regexp))
(rx (if (listp regexp) (macroexpand `(rx ,regexp)) regexp))
(sort (plist-get params :sort-by-component))
(reverse (plist-get params :reverse-sort))
(block-name (plist-get params :block-name))
(separator (plist-get params :file-separator))
(no-f-m (plist-get params :no-front-matter))
(add-links (plist-get params :add-links))
(excluded-dirs (plist-get params :excluded-dirs-regexp)))
(when block-name (insert "#+name: " block-name "\n"))
(when rx (denote-org-extras-dblock-add-files rx separator no-f-m add-links sort reverse excluded-dirs)))
(join-line)) ; remove trailing empty line
;;;; Insert files as headings
(defun denote-org-extras-dblock--extract-regexp (regexp)
"Extract REGEXP from the buffer and trim it of surrounding spaces."
(string-trim
(save-excursion
(re-search-forward regexp nil :no-error)
(buffer-substring-no-properties (match-end 0) (line-end-position)))))
(defun denote-org-extras-dblock--get-file-contents-as-heading (file add-links)
"Insert the contents of Org FILE, formatting the #+title as a heading.
With optional ADD-LINKS, make the title link to the original file."
(when-let ((_ (denote-file-is-note-p file))
(identifier (denote-retrieve-filename-identifier file))
(file-type (denote-filetype-heuristics file))
(_ (eq file-type 'org)))
(with-temp-buffer
(let ((beginning-of-contents (point))
title
tags)
(insert-file-contents file)
(setq title (denote-org-extras-dblock--extract-regexp (denote--title-key-regexp file-type)))
(setq tags (denote-org-extras-dblock--extract-regexp (denote--keywords-key-regexp file-type)))
(delete-region (1+ (re-search-forward "^$" nil :no-error 1)) beginning-of-contents)
(goto-char beginning-of-contents)
(when (and title tags)
(if add-links
(insert (format "* [[denote:%s][%s]] %s\n\n" identifier title tags))
(insert (format "* %s %s\n\n" title tags)))
(org-align-tags :all))
(while (re-search-forward "^\\(*+?\\) " nil :no-error)
(replace-match (format "*%s " "\\1"))))
(buffer-string))))
(defun denote-org-extras-dblock-add-files-as-headings (regexp &optional add-links sort-by-component reverse excluded-dirs-regexp)
"Insert files matching REGEXP.
If optional ADD-LINKS is non-nil, first insert a link to the file
and then insert its contents. In this case, format the contents
as a typographic list.
If optional SORT-BY-COMPONENT is a symbol among `denote-sort-components',
sort files matching REGEXP by the corresponding Denote file name
component. If the symbol is not among `denote-sort-components',
fall back to the default identifier-based sorting.
If optional REVERSE is non-nil reverse the sort order.
Optional EXCLUDED-DIRS-REGEXP is the `let' bound value of
`denote-excluded-directories-regexp'. When nil, the original value of
that user option is used."
(let* ((denote-excluded-directories-regexp (or excluded-dirs-regexp denote-excluded-directories-regexp))
(files (denote-org-extras-dblock--files regexp sort-by-component reverse))
(files-contents (mapcar
(lambda (file)
(denote-org-extras-dblock--get-file-contents-as-heading file add-links))
files)))
(insert (string-join files-contents))))
;;;###autoload
(defun denote-org-extras-dblock-insert-files-as-headings (regexp sort-by-component)
"Create Org dynamic block to insert Denote Org files matching REGEXP.
Turn the #+title of each file into a top-level heading. Then increment
all original headings in the file by one, so that they become
subheadings of what once was the #+title.
Use the #+filetags of each file as tags for the top-level heading (what
was the #+title).
Sort the files according to SORT-BY-COMPONENT, which is a symbol
among `denote-sort-components'.
IMPORTANT NOTE: This dynamic block only works with Org files, because it
has to assume the Org notation in order to insert each file's contents
as its own heading."
(interactive
(list
(denote-files-matching-regexp-prompt)
(denote-sort-component-prompt))
org-mode)
(org-create-dblock (list :name "denote-files-as-headings"
:regexp regexp
:excluded-dirs-regexp nil
:sort-by-component sort-by-component
:reverse-sort nil
:add-links nil))
(org-update-dblock))
;; NOTE 2024-03-30: This is how the autoload is done in org.el.
;;;###autoload
(eval-after-load 'org
'(progn
(org-dynamic-block-define "denote-files-as-headings" 'denote-org-extras-dblock-insert-files-as-headings)))
;;;###autoload
(defun org-dblock-write:denote-files-as-headings (params)
"Function to update `denote-files' Org Dynamic blocks.
Used by `org-dblock-update' with PARAMS provided by the dynamic block."
(let* ((regexp (plist-get params :regexp))
(rx (if (listp regexp) (macroexpand `(rx ,regexp)) regexp))
(sort (plist-get params :sort-by-component))
(reverse (plist-get params :reverse-sort))
(block-name (plist-get params :block-name))
(add-links (plist-get params :add-links))
(excluded-dirs (plist-get params :excluded-dirs-regexp)))
(when block-name (insert "#+name: " block-name "\n"))
(when rx (denote-org-extras-dblock-add-files-as-headings rx add-links sort reverse excluded-dirs)))
(join-line)) ; remove trailing empty line
(provide 'denote-org-extras)
;;; denote-org-extras.el ends here

View file

@ -1,173 +0,0 @@
;;; denote-rename-buffer.el --- Rename Denote buffers to be shorter and easier to read -*- lexical-binding: t -*-
;; Copyright (C) 2023-2024 Free Software Foundation, Inc.
;; Author: Protesilaos Stavrou <info@protesilaos.com>
;; Maintainer: Protesilaos Stavrou <info@protesilaos.com>
;; URL: https://github.com/protesilaos/denote
;; This file is NOT part of GNU Emacs.
;; 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
;; the Free Software Foundation, either version 3 of the License, or
;; (at your option) any later version.
;;
;; This program is distributed in the hope that it will be useful,
;; but WITHOUT ANY WARRANTY; without even the implied warranty of
;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
;; GNU General Public License for more details.
;;
;; You should have received a copy of the GNU General Public License
;; along with this program. If not, see <https://www.gnu.org/licenses/>.
;;; Commentary:
;;
;; Rename Denote buffers to be shorter and easier to read. Enable
;; `denote-rename-buffer-mode' to automatically rename the buffer of a
;; Denote file. The renaming function is specified in the user option
;; `denote-rename-buffer-function'.
;;; Code:
(require 'denote)
(defgroup denote-rename-buffer nil
"Rename Denote buffers to be shorter and easier to read."
:group 'denote
:link '(info-link "(denote) Top")
:link '(url-link :tag "Homepage" "https://protesilaos.com/emacs/denote"))
(defvaralias 'denote-buffer-has-backlinks-string 'denote-rename-buffer-backlinks-indicator
"Alias for `denote-rename-buffer-backlinks-indicator'.")
(defcustom denote-rename-buffer-backlinks-indicator " <-->"
"A string used to indicate that a buffer has backlinks pointing to it."
:type 'string
:package-version '(denote . "3.1.0")
:group 'denote-rename-buffer)
(defcustom denote-rename-buffer-format "[D] %t%b"
"The format of the buffer name `denote-rename-buffer' should use.
Thie value is a string that treats specially the following
specifiers:
- The %t is the Denote TITLE of the file.
- The %i is the Denote IDENTIFIER of the file.
- The %d is the same as %i (DATE mnemonic).
- The %s is the Denote SIGNATURE of the file.
- The %k is the Denote KEYWORDS of the file.
- The %b inserts `denote-rename-buffer-backlinks-indicator'.
- The %% is a literal percent sign.
In addition, the following flags are available for each of the specifiers:
- 0 :: Pad to the width, if given, with zeros instead of spaces.
- - :: Pad to the width, if given, on the right instead of the left.
- < :: Truncate to the width and precision, if given, on the left.
- > :: Truncate to the width and precision, if given, on the right.
- ^ :: Convert to upper case.
- _ :: Convert to lower case.
When combined all together, the above are written thus:
%<flags><width><precision>SPECIFIER-CHARACTER
Any other string it taken as-is. Users may want, for example, to
include some text that makes Denote buffers stand out, such as
a [D] prefix."
:type 'string
:package-version '(denote . "3.1.0")
:group 'denote-rename-buffer)
(defcustom denote-rename-buffer-function #'denote-rename-buffer
"Symbol of function that is called to rename the Denote file buffer.
The default `denote-rename-buffer' function uses the pattern
described in `denote-rename-buffer-format'.
Users can set this variable to an arbitrary function that does
something else. The function is called without arguments from
the `find-file-hook' and `denote-after-new-note-hook'.
A nil value for this variable means that the title of the Denote
buffer will be used, if available."
:type '(choice
(const :tag "Rename using the `denote-rename-buffer-format'" denote-rename-buffer)
(function :tag "Use a custom renaming function"))
:package-version '(denote . "2.1.0")
:group 'denote-rename-buffer)
(defun denote-rename-buffer--format (buffer)
"Parse the BUFFER through the `denote-rename-buffer-format'."
(when-let ((file (buffer-file-name buffer))
(type (denote-filetype-heuristics file)))
(let ((should-show-backlink-indicator (and ; only do search if format contains "%b"
(string-match-p "%b" denote-rename-buffer-format)
(denote--file-has-backlinks-p file))))
(string-trim
(format-spec denote-rename-buffer-format
(list (cons ?t (cond
((denote-retrieve-front-matter-title-value file type))
((denote-retrieve-filename-title file))
(t "")))
(cons ?b (if should-show-backlink-indicator denote-rename-buffer-backlinks-indicator ""))
(cons ?i (or (denote-retrieve-filename-identifier file) ""))
(cons ?d (or (denote-retrieve-filename-identifier file) ""))
(cons ?s (or (denote-retrieve-filename-signature file) ""))
(cons ?k (if-let ((kws (denote-retrieve-front-matter-keywords-value file type)))
(denote-keywords-combine kws)
(or (denote-retrieve-filename-keywords file) "")))
(cons ?% "%"))
'delete)))))
(defun denote-rename-buffer (&optional buffer)
"Rename current buffer or optional BUFFER with `denote-rename-buffer-format'.
The symbol of this function is the default value of the user
option `denote-rename-buffer-function' and is thus used by the
`denote-rename-buffer-mode'."
(when-let ((file (buffer-file-name buffer))
((denote-file-has-identifier-p file))
(new-name (denote-rename-buffer--format (or buffer (current-buffer))))
((not (string-blank-p new-name))))
(rename-buffer new-name :unique)))
(make-obsolete
'denote-rename-buffer-with-title
'denote-rename-buffer
"2.1.0")
(make-obsolete
'denote-rename-buffer-with-identifier
'denote-rename-buffer
"2.1.0")
(defun denote-rename-buffer--fallback (&optional buffer)
"Fallback to rename BUFFER or `current-buffer'.
This is called if `denote-rename-buffer-rename-function' is nil."
(let ((denote-rename-buffer-format "%t"))
(denote-rename-buffer buffer)))
(defun denote-rename-buffer-rename-function-or-fallback ()
"Call `denote-rename-buffer-function' or its fallback to rename with title.
Add this to `find-file-hook' and `denote-after-new-note-hook'."
(funcall (or denote-rename-buffer-function #'denote-rename-buffer--fallback)))
;;;###autoload
(define-minor-mode denote-rename-buffer-mode
"Automatically rename Denote buffers to be easier to read.
A buffer is renamed upon visiting the underlying file. This
means that existing buffers are not renamed until they are
visited again in a new buffer (files are visited with the command
`find-file' or related)."
:global t
(if denote-rename-buffer-mode
(progn
(add-hook 'denote-after-new-note-hook #'denote-rename-buffer-rename-function-or-fallback)
(add-hook 'denote-after-rename-file-hook #'denote-rename-buffer-rename-function-or-fallback)
(add-hook 'find-file-hook #'denote-rename-buffer-rename-function-or-fallback))
(remove-hook 'denote-after-new-note-hook #'denote-rename-buffer-rename-function-or-fallback)
(remove-hook 'denote-after-rename-file-hook #'denote-rename-buffer-rename-function-or-fallback)
(remove-hook 'find-file-hook #'denote-rename-buffer-rename-function-or-fallback)))
(provide 'denote-rename-buffer)
;;; denote-rename-buffer.el ends here

View file

@ -1,107 +0,0 @@
;;; denote-silo-extras.el --- Convenience functions for using Denote in multiple silos -*- lexical-binding: t; -*-
;; Copyright (C) 2023-2024 Free Software Foundation, Inc.
;; Author: Protesilaos Stavrou <info@protesilaos.com>
;; Maintainer: Protesilaos Stavrou <info@protesilaos.com>
;; URL: https://github.com/protesilaos/denote
;; This file is NOT part of GNU Emacs.
;; 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
;; the Free Software Foundation, either version 3 of the License, or
;; (at your option) any later version.
;; This program is distributed in the hope that it will be useful,
;; but WITHOUT ANY WARRANTY; without even the implied warranty of
;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
;; GNU General Public License for more details.
;; You should have received a copy of the GNU General Public License
;; along with this program. If not, see <https://www.gnu.org/licenses/>.
;;; Commentary:
;; This is a set of convenience functions that used to be provided in
;; the Denote manual. A "silo" is a `denote-directory' that is
;; self-contained. Users can maintain multiple silos. Consult the
;; manual for the details. With the Denote package installed,
;; evaluate the following to read the relevant node:
;;
;; (info "(denote) Maintain separate directory silos for notes")
;;; Code:
(require 'denote)
(defgroup denote-silo-extras nil
"Make it easier to use Denote across Silos."
:group 'denote
:link '(info-link "(denote) Top")
:link '(url-link :tag "Homepage" "https://protesilaos.com/emacs/denote"))
(defcustom denote-silo-extras-directories
`(,denote-directory)
"List of file paths pointing to Denote silos.
Each file path points to a directory, which takes the same value
as the variable `denote-directory'."
:group 'denote-silo-extras
:link '(info-link "(denote) Maintain separate directories for notes")
:type '(repeat directory))
(defvar denote-silo-extras-directory-history nil
"Minibuffer history for `denote-silo-extras-directory-prompt'.")
(defalias 'denote-silo-extras--directory-history 'denote-silo-extras-directory-history
"Compatibility alias for `denote-silo-extras-directory-history'.")
(define-obsolete-function-alias
'denote-silo-extras--directory-prompt
'denote-silo-extras-directory-prompt
"3.1.0")
(defun denote-silo-extras-directory-prompt ()
"Prompt for directory among `denote-silo-extras-directories'."
(let ((default (car denote-silo-extras-directory-history)))
(completing-read
(format-prompt "Select a silo" default)
(denote--completion-table 'file denote-silo-extras-directories)
nil :require-match nil 'denote-silo-extras-directory-history)))
;;;###autoload
(defun denote-silo-extras-create-note (silo)
"Select SILO and run `denote' in it.
SILO is a file path from `denote-silo-extras-directories'.
When called from Lisp, SILO is a file system path to a directory."
(interactive (list (denote-silo-extras-directory-prompt)))
(let ((denote-directory silo))
(call-interactively #'denote)))
;;;###autoload
(defun denote-silo-extras-open-or-create (silo)
"Select SILO and run `denote-open-or-create' in it.
SILO is a file path from `denote-silo-extras-directories'.
When called from Lisp, SILO is a file system path to a directory."
(interactive (list (denote-silo-extras-directory-prompt)))
(let ((denote-directory silo))
(call-interactively #'denote-open-or-create)))
;;;###autoload
(defun denote-silo-extras-select-silo-then-command (silo command)
"Select SILO and run Denote COMMAND in it.
SILO is a file path from `denote-silo-extras-directories', while
COMMAND is one among `denote-silo-extras-commands'.
When called from Lisp, SILO is a file system path to a directory."
(interactive
(list
(denote-silo-extras-directory-prompt)
(denote-command-prompt)))
(let ((denote-directory silo))
(call-interactively command)))
(provide 'denote-silo-extras)
;;; denote-silo-extras.el ends here

View file

@ -1,285 +0,0 @@
;;; denote-sort.el --- Sort Denote files based on a file name component -*- lexical-binding: t -*-
;; Copyright (C) 2023-2024 Free Software Foundation, Inc.
;; Author: Protesilaos Stavrou <info@protesilaos.com>
;; Maintainer: Protesilaos Stavrou <info@protesilaos.com>
;; URL: https://github.com/protesilaos/denote
;; This file is NOT part of GNU Emacs.
;; 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
;; the Free Software Foundation, either version 3 of the License, or
;; (at your option) any later version.
;;
;; This program is distributed in the hope that it will be useful,
;; but WITHOUT ANY WARRANTY; without even the implied warranty of
;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
;; GNU General Public License for more details.
;;
;; You should have received a copy of the GNU General Public License
;; along with this program. If not, see <https://www.gnu.org/licenses/>.
;;; Commentary:
;;
;; Sort Denote files based on their file name components, namely, the
;; signature, title, or keywords.
;;; Code:
(require 'denote)
(defgroup denote-sort nil
"Sort Denote files based on a file name component."
:group 'denote
:link '(info-link "(denote) Top")
:link '(url-link :tag "Homepage" "https://protesilaos.com/emacs/denote"))
(defconst denote-sort-comparison-fallback-function #'string-collate-lessp
"String comparison function used by `denote-sort-files' subroutines.")
(defconst denote-sort-components '(title keywords signature identifier)
"List of sorting keys applicable for `denote-sort-files' and related.")
(defcustom denote-sort-title-comparison-function denote-sort-comparison-fallback-function
"Function to sort the TITLE component in file names.
The function accepts two arguments and must return a non-nil value if
the first argument is smaller than the second one."
:type 'function
:package-version '(denote . "3.1.0")
:group 'denote-sort)
(defcustom denote-sort-keywords-comparison-function denote-sort-comparison-fallback-function
"Function to sort the KEYWORDS component in file names.
The function accepts two arguments and must return a non-nil value if
the first argument is smaller than the second one."
:type 'function
:package-version '(denote . "3.1.0")
:group 'denote-sort)
(defcustom denote-sort-signature-comparison-function denote-sort-comparison-fallback-function
"Function to sort the SIGNATURE component in file names.
The function accepts two arguments and must return a non-nil value if
the first argument is smaller than the second one."
:type 'function
:package-version '(denote . "3.1.0")
:group 'denote-sort)
(defcustom denote-sort-dired-extra-prompts '(sort-by-component reverse-sort)
"Determine what `denote-sort-dired' prompts for beside a search query.
This concerns the additional prompts issued by `denote-sort-dired' about
whether to sort by a given file name component and to then reverse the
sort.
The value is a list of symbols, which can include the symbols
`sort-by-component' and `reverse-sort'. The order is significant, with
the leftmost symbol coming first.
If the value is nil, skip all prompts. In this scenario, the sorting is
done according to `denote-sort-dired-default-sort-component' and
`denote-sort-dired-default-reverse-sort'."
:type '(radio (const :tag "Do not prompt for anything" nil)
(set :tag "Available prompts" :greedy t
(const :tag "Sort by file name component" sort-by-component)
(const :tag "Reverse the sort" reverse-sort)))
:package-version '(denote . "3.1.0")
:group 'denote-sort)
(defcustom denote-sort-dired-default-sort-component 'identifier
"Set the default file name component to sort by.
This is used only if `denote-sort-dired-extra-prompts' omits the
minibuffer prompt for which file name component to sort by."
:type '(radio
(const :tag "Sort by identifier (default)" identifier)
(const :tag "Sort by title" title)
(const :tag "Sort by keywords" keywords)
(const :tag "Sort by signature" signature))
:package-version '(denote . "3.1.0")
:group 'denote-sort)
(defcustom denote-sort-dired-default-reverse-sort nil
"If non-nil, reverse the sorting order by default.
This is used only if `denote-sort-dired-extra-prompts' omits the
minibuffer prompt that asks for a reverse sort or not."
:type 'boolean
:package-version '(denote . "3.1.0")
:group 'denote-sort)
;; NOTE 2023-12-04: We can have compound sorting algorithms such as
;; title+signature, but I want to keep this simple for the time being.
;; Let us first hear from users to understand if there is a real need
;; for such a feature.
(defmacro denote-sort--define-lessp (component)
"Define function to sort by COMPONENT."
(let ((retrieve-fn (intern (format "denote-retrieve-filename-%s" component)))
(comparison-fn (intern (format "denote-sort-%s-comparison-function" component))))
`(defun ,(intern (format "denote-sort-%s-lessp" component)) (file1 file2)
,(format
"Return smallest among FILE1, FILE2 based on their %s.
The `%s' performs the comparison."
component comparison-fn)
(let* ((one (,retrieve-fn file1))
(two (,retrieve-fn file2))
(one-empty-p (or (null one) (string-empty-p one)))
(two-empty-p (or (null two) (string-empty-p two))))
(cond
(one-empty-p nil)
((and (not one-empty-p) two-empty-p) one)
(t (funcall (or ,comparison-fn denote-sort-comparison-fallback-function) one two)))))))
;; TODO 2023-12-04: Subject to the above NOTE, we can also sort by
;; directory and by file length.
(denote-sort--define-lessp title)
(denote-sort--define-lessp keywords)
(denote-sort--define-lessp signature)
;;;###autoload
(defun denote-sort-files (files component &optional reverse)
"Returned sorted list of Denote FILES.
With COMPONENT as a symbol among `denote-sort-components',
sort files based on the corresponding file name component.
With COMPONENT as a nil value keep the original date-based
sorting which relies on the identifier of each file name.
With optional REVERSE as a non-nil value, reverse the sort order."
(let* ((files-to-sort (copy-sequence files))
(sort-fn (when component
(pcase component
('title #'denote-sort-title-lessp)
('keywords #'denote-sort-keywords-lessp)
('signature #'denote-sort-signature-lessp))))
(sorted-files (if sort-fn (sort files sort-fn) files-to-sort)))
(if reverse
(reverse sorted-files)
sorted-files)))
(defun denote-sort-get-directory-files (files-matching-regexp sort-by-component &optional reverse omit-current)
"Return sorted list of files in variable `denote-directory'.
With FILES-MATCHING-REGEXP as a string limit files to those
matching the given regular expression.
With SORT-BY-COMPONENT as a symbol among `denote-sort-components',
pass it to `denote-sort-files' to sort by the corresponding file
name component.
With optional REVERSE as a non-nil value, reverse the sort order.
With optional OMIT-CURRENT, do not include the current file in
the list."
(denote-sort-files
(denote-directory-files files-matching-regexp omit-current)
sort-by-component
reverse))
(defun denote-sort-get-links (files-matching-regexp sort-by-component current-file-type id-only &optional reverse)
"Return sorted typographic list of links for FILES-MATCHING-REGEXP.
With FILES-MATCHING-REGEXP as a string, match files stored in the
variable `denote-directory'.
With SORT-BY-COMPONENT as a symbol among `denote-sort-components',
sort FILES-MATCHING-REGEXP by the given Denote file name
component. If SORT-BY-COMPONENT is nil or an unknown non-nil
value, default to the identifier-based sorting.
With CURRENT-FILE-TYPE as a symbol among those specified in
`denote-file-type' (or the `car' of each element in
`denote-file-types'), format the link accordingly. With a nil or
unknown non-nil value, default to the Org notation.
With ID-ONLY as a non-nil value, produce links that consist only
of the identifier, thus deviating from CURRENT-FILE-TYPE.
With optional REVERSE as a non-nil value, reverse the sort order."
(denote-link--prepare-links
(denote-sort-get-directory-files files-matching-regexp sort-by-component reverse)
current-file-type
id-only))
(defvar denote-sort-component-history nil
"Minibuffer history of `denote-sort-component-prompt'.")
(defalias 'denote-sort--component-hist 'denote-sort-component-history
"Compatibility alias for `denote-sort-component-history'.")
(defun denote-sort-component-prompt ()
"Prompt for sorting key among `denote-sort-components'."
(let ((default (car denote-sort-component-history)))
(intern
(completing-read
(format-prompt "Sort by file name component" default)
denote-sort-components nil :require-match
nil 'denote-sort-component-history default))))
(defvar-local denote-sort--dired-buffer nil
"Buffer object of current `denote-sort-dired'.")
(defun denote-sort-dired--prompts ()
"Return list of prompts per `denote-sort-dired-extra-prompts'."
(let (sort-by-component reverse-sort)
(dolist (prompt denote-sort-dired-extra-prompts)
(pcase prompt
('sort-by-component (setq sort-by-component (denote-sort-component-prompt)))
('reverse-sort (setq reverse-sort (y-or-n-p "Reverse sort? ")))))
(list sort-by-component reverse-sort)))
;;;###autoload
(defun denote-sort-dired (files-matching-regexp sort-by-component reverse)
"Produce Dired buffer with sorted files from variable `denote-directory'.
When called interactively, prompt for FILES-MATCHING-REGEXP and,
depending on the value of the user option `denote-sort-dired-extra-prompts',
also prompt for SORT-BY-COMPONENT and REVERSE.
1. FILES-MATCHING-REGEXP limits the list of Denote files to
those matching the provided regular expression.
2. SORT-BY-COMPONENT sorts the files by their file name component (one
among `denote-sort-components'). If it is nil, sorting is performed
according to the user option `denote-sort-dired-default-sort-component',
falling back to the identifier.
3. REVERSE is a boolean to reverse the order when it is a non-nil value.
If `denote-sort-dired-extra-prompts' is configured to skip this
prompt, then the sorting is done according to the user option
`denote-sort-dired-default-reverse-sort', falling back to
nil (i.e. no reverse sort).
When called from Lisp, the arguments are a string, a symbol among
`denote-sort-components', and a non-nil value, respectively."
(interactive
(append (list (denote-files-matching-regexp-prompt)) (denote-sort-dired--prompts)))
(let ((component (or sort-by-component
denote-sort-dired-default-sort-component
'identifier))
(reverse-sort (or reverse
denote-sort-dired-default-reverse-sort
nil)))
(if-let ((default-directory (denote-directory))
(files (denote-sort-get-directory-files files-matching-regexp component reverse-sort))
;; NOTE 2023-12-04: Passing the FILES-MATCHING-REGEXP as
;; buffer-name produces an error if the regexp contains a
;; wildcard for a directory. I can reproduce this in emacs
;; -Q and am not sure if it is a bug. Anyway, I will report
;; it upstream, but even if it is fixed we cannot use it
;; for now (whatever fix will be available for Emacs 30+).
(denote-sort-dired-buffer-name (format "Denote sort `%s' by `%s'" files-matching-regexp component))
(buffer-name (format "Denote sort by `%s' at %s" component (format-time-string "%T"))))
(let ((dired-buffer (dired (cons buffer-name (mapcar #'file-relative-name files)))))
(setq denote-sort--dired-buffer dired-buffer)
(with-current-buffer dired-buffer
(setq-local revert-buffer-function
(lambda (&rest _)
(kill-buffer dired-buffer)
(denote-sort-dired files-matching-regexp component reverse-sort))))
;; Because of the above NOTE, I am printing a message. Not
;; what I want, but it is better than nothing...
(message denote-sort-dired-buffer-name))
(message "No matching files for: %s" files-matching-regexp))))
(provide 'denote-sort)
;;; denote-sort.el ends here

5811
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-2024 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.
@ -23,142 +23,182 @@
;;; Commentary:
;; Tests for Denote.
;; Tests for Denote. Note that we are using Shorthands in this file,
;; so the "dt-" prefix really is "denote-test-". Evaluate the
;; following to learn more:
;;
;; (info "(elisp) Shorthands")
;;; Code:
(require 'ert)
;;;; Tests for denote.el
(require 'denote)
(ert-deftest denote-test--denote--make-denote-directory ()
(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 denote-test--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'.
(ert-deftest denote-test--denote--slug-no-punct ()
"Test that `denote--slug-no-punct' removes punctuation from the string.
Concretely, replace with spaces anything that matches the
`denote-excluded-punctuation-regexp' and
`denote-excluded-punctuation-extra-regexp'."
(should (equal (denote--slug-no-punct "This is !@# test")
"This is test")))
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 denote-test--denote-slug-keep-only-ascii ()
(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")))
(ert-deftest dt-denote-slug-keep-only-ascii ()
"Test that `denote-slug-keep-only-ascii' removes non-ASCII characters."
(should (equal
(denote-slug-keep-only-ascii "There are no-ASCII characters here 😀")
"There are no-ASCII characters here ")))
(ert-deftest denote-test--denote--slug-hyphenate ()
"Test that `denote--slug-hyphenate' hyphenates the string.
(ert-deftest dt-denote-slug-hyphenate ()
"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 denote-test--denote-sluggify ()
(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 denote-test--denote--slug-put-equals ()
"Test that `denote--slug-put-equals' replaces spaces/underscores with =.
(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
`denote-test--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 denote-test--denote-sluggify-signature ()
(ert-deftest dt-denote-sluggify-signature ()
"Test that `denote-sluggify-signature' sluggifies the string for file signatures.
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")))
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 denote-test--denote-sluggify-keyword ()
(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 `denote-test--denote-sluggify'."
(should (equal (denote-sluggify-keyword "--- ___ !~!!$%^ This iS a - tEsT ++ ?? ")
"thisisatest")))
(should (equal (denote-sluggify-keyword "--- ___ !~!!$%^ This iS a - tEsT ++ ?? ") "thisisatest")))
(ert-deftest denote-test--denote-sluggify-keywords ()
(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 denote-test--denote--file-empty-p ()
(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 denote-test--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 `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 denote-test--denote-file-has-identifier-p ()
(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 denote-test--denote-file-has-signature-p ()
(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 denote-test--denote-file-has-supported-extension-p ()
(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 denote-test--denote-file-type-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)
(member ".txt" extensions)))))
(ert-deftest denote-test--denote-file-type-extensions-with-encryption ()
(ert-deftest dt-denote-file-type-extensions-with-encryption ()
"Test that `denote-file-type-extensions-with-encryption' covers encryption.
Extend what we do in `denote-test--denote-file-type-extensions'."
(let ((extensions (denote-file-type-extensions-with-encryption)))
@ -172,381 +212,272 @@ Extend what we do in `denote-test--denote-file-type-extensions'."
(member ".org.age" extensions)
(member ".txt.age" extensions)))))
(ert-deftest denote-test--denote-surround-with-quotes ()
"Test that `denote-surround-with-quotes' returns a string in quotes."
(should (and (equal (denote-surround-with-quotes "test") "\"test\"")
(equal (denote-surround-with-quotes "") "\"\"")
(equal (denote-surround-with-quotes nil) "\"\"")
(equal (denote-surround-with-quotes 'wrong) "\"\"")
(equal (denote-surround-with-quotes '(wrong)) "\"\""))))
(ert-deftest dt-denote--format-front-matter ()
"Test that `denote--format-front-matter' formats front matter correctly.
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 (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 denote-test--denote--format-front-matter ()
"Test that `denote--format-front-matter' formats front matter correctly."
(should (and (equal (denote--format-front-matter "" "" '("") "" 'text)
(mapconcat #'identity
'("title: "
"date: "
"tags: "
"identifier: "
"---------------------------\n\n")
"\n"))
(equal
(denote--format-front-matter
"Some test" "2023-06-05" '("one" "two")
"20230605T102234" 'text)
(mapconcat #'identity
'("title: Some test"
"date: 2023-06-05"
"tags: one two"
"identifier: 20230605T102234"
"---------------------------\n\n")
"\n"))))
(should (and (equal (denote--format-front-matter "" "" nil "" 'org)
(mapconcat #'identity
'("#+title: "
"#+date: "
"#+filetags: "
"#+identifier: "
"\n")
"\n"))
(equal
(denote--format-front-matter
"Some test" "2023-06-05" '("one" "two")
"20230605T102234" 'org)
(mapconcat #'identity
'("#+title: Some test"
"#+date: 2023-06-05"
"#+filetags: :one:two:"
"#+identifier: 20230605T102234"
"\n")
"\n"))))
(should (and (equal (denote--format-front-matter "" "" nil "" 'markdown-yaml)
(mapconcat #'identity
'("---"
"title: \"\""
"date: "
"tags: []"
"identifier: \"\""
"---"
"\n")
"\n"))
(equal
(denote--format-front-matter
"Some test" "2023-06-05" '("one" "two")
"20230605T102234" 'markdown-yaml)
(mapconcat #'identity
'("---"
"title: \"Some test\""
"date: 2023-06-05"
"tags: [\"one\", \"two\"]"
"identifier: \"20230605T102234\""
"---"
"\n")
"\n"))))
(should (and (equal (denote--format-front-matter "" "" nil "" 'markdown-toml)
(mapconcat #'identity
'("+++"
"title = \"\""
"date = "
"tags = []"
"identifier = \"\""
"+++"
"\n")
"\n"))
(equal
(denote--format-front-matter
"Some test" "2023-06-05" '("one" "two")
"20230605T102234" 'markdown-toml)
(mapconcat #'identity
'("+++"
"title = \"Some test\""
"date = 2023-06-05"
"tags = [\"one\", \"two\"]"
"identifier = \"20230605T102234\""
"+++"
"\n")
"\n")))))
(ert-deftest denote-test--denote-format-file-name ()
(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 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"))))
(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
kws
title
(denote--file-extension 'org)
""))
(should-error (denote-format-file-name
(denote-directory)
""
kws
title
(denote--file-extension 'org)
""))
(should-error (denote-format-file-name
(denote-directory)
"0123456"
kws
title
(denote--file-extension '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"))))
(ert-deftest denote-test--denote-get-file-extension ()
(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 denote-test--denote-get-file-extension-sans-encryption ()
(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")))
(ert-deftest denote-test--denote-filetype-heuristics ()
;; 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))))
(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 denote-test--denote-get-identifier ()
"Test that `denote-get-identifier' returns an identifier."
(should (and (equal (denote-get-identifier) (format-time-string denote-id-format (current-time)))
(equal (denote-get-identifier "2024-02-01 10:34") "20240201T103400")
(equal (denote-get-identifier 1705644188) "20240119T080308")
(equal (denote-get-identifier '(26026 4251)) "20240119T080307")))
(should-error (denote-get-identifier "Invalid date")))
(ert-deftest denote-test--denote-retrieve-filename-identifier ()
(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 denote-test--denote-retrieve-filename-title ()
(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 denote-test--denote-retrieve-filename-keywords ()
(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 denote-test--denote-retrieve-filename-signature ()
(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 denote-test--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 denote-test--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")))
;;;; denote-journal-extras.el
(ert-deftest dt-denote--date-convert ()
"Test that `denote--date-convert' works with dates."
(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)))
(require 'denote-journal-extras)
;; 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 denote-test--denote-journal-extras-daily--title-format ()
"Make sure that `denote-journal-extras-daily--title-format' yields the desired format."
(should (and
;; These three should prompt, but I am here treating the
;; prompt as if it already returned a string. The test for
;; the `denote-title-prompt' can be separate.
(stringp
(cl-letf (((symbol-function 'denote-title-prompt) #'identity)
(denote-journal-extras-title-format nil))
(denote-journal-extras-daily--title-format)))
(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))))
(stringp
(cl-letf (((symbol-function 'denote-title-prompt) #'identity)
(denote-journal-extras-title-format t))
(denote-journal-extras-daily--title-format)))
(stringp
(cl-letf (((symbol-function 'denote-title-prompt) #'identity)
(denote-journal-extras-title-format :some-arbitrary-keyword))
(denote-journal-extras-daily--title-format)))
;; And these return the following values
(string-match-p
"\\<.*?\\>"
(let ((denote-journal-extras-title-format 'day))
(denote-journal-extras-daily--title-format)))
(string-match-p
"\\<.*?\\> [0-9]\\{,2\\} \\<.*?\\> [0-9]\\{,4\\}"
(let ((denote-journal-extras-title-format 'day-date-month-year))
(denote-journal-extras-daily--title-format)))
(string-match-p
"\\<.*?\\> [0-9]\\{,2\\} \\<.*?\\> [0-9]\\{,4\\} [0-9]\\{,2\\}:[0-9]\\{,2\\} \\<.*?\\>"
(let ((denote-journal-extras-title-format 'day-date-month-year-12h))
(denote-journal-extras-daily--title-format)))
(string-match-p
"\\<.*?\\> [0-9]\\{,2\\} \\<.*?\\> [0-9]\\{,4\\} [0-9]\\{,2\\}:[0-9]\\{,2\\}"
(let ((denote-journal-extras-title-format 'day-date-month-year-24h))
(denote-journal-extras-daily--title-format))))))
(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
;; Local Variables:
;; read-symbol-shorthands: (("dt" . "denote-test-"))
;; End: