~protesilaos/denote

1

Recursive DBlock insertion

Details
Message ID
<87h6k7erb2.fsf@hu.mail-host-address-is-not-set>
DKIM signature
missing
Download raw message
Hi Prot,

I am currently running Denote Version: 2.2.4.

When calling 'denote-org-dblock-insert-files' inside a file which has
filetag 'xyz' and then try to insert all files having the same filetag
'xyz' then I get:

org-element--cache-for-removal: org-element--cache: Emergency exit

is the *Messages* buffer and only '#+BEGIN:' is inserted in the buffer.

I suspect, that some kind of infinite recursion is going on trying to
also insert the current file, because of its filetag 'xyz'...

If I remove the filetag 'xyz' from the current file before attempting
'denote-org-dblock-insert-files', it works as expected.

Many thanks for the good work and this new feature!
Best, Hanspeter
Details
Message ID
<87a5ob2uch.fsf@protesilaos.com>
In-Reply-To
<87h6k7erb2.fsf@hu.mail-host-address-is-not-set> (view parent)
DKIM signature
pass
Download raw message
> From: Hanspeter Gisler <hpgisleropen@bluewin.ch>
> Date: Sun, 24 Dec 2023 13:08:33 +0100
>
> Hi Prot,

Hello Hanspeter,

I am sorry for the late response. I am slow to respond due to my limited
typing time.

> I am currently running Denote Version: 2.2.4.
>
> When calling 'denote-org-dblock-insert-files' inside a file which has
> filetag 'xyz' and then try to insert all files having the same filetag
> 'xyz' then I get:
>
> org-element--cache-for-removal: org-element--cache: Emergency exit
>
> is the *Messages* buffer and only '#+BEGIN:' is inserted in the buffer.
>
> I suspect, that some kind of infinite recursion is going on trying to
> also insert the current file, because of its filetag 'xyz'...
>
> If I remove the filetag 'xyz' from the current file before attempting
> 'denote-org-dblock-insert-files', it works as expected.

I cannot reproduce this on my end. I have a file with a "test" keyword
and use it to produce a dynamic block that matches files with the "test"
keyword.

Looking at the code, we have an instruction to omit the current file:

    (defun denote-org-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."
      (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 reverse :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))))

Could it be something else? The fact that the cache is mentioned in the
error message seems strange.

> Many thanks for the good work and this new feature!

You are welcome! Again, apologies for the late reply.

Have a nice day,
Prot

P.S. I am phasing out SourceHut: <https://protesilaos.com/codelog/2024-01-27-sourcehut-no-more/>.
Development continues on GitHub with GitLab as a mirror.

-- 
Protesilaos Stavrou
https://protesilaos.com
Reply to thread Export thread (mbox)