Closed MirkoHernandez closed 3 months ago
Hello @MirkoHernandez!
Are you building directly from denote.git or is this the latest packaged version?
Can you try M-x toggle-debug-on-error
and re-run the function? We want to get a backtrace which will help figure out what is happening.
I'm using guix to install the package, it is version 2.3.0 ( I checked the latest tagged version and it is the same).
I did use toggle-debug-on-error and the error was in the following function in the current-file
field, which it is changed here to use denote-filetype-heuristic
, originally it just uses buffer-file-name
.
(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-form (plist-get params :rx))
(missing-only (plist-get params :missing-only))
(block-name (plist-get params :block-name))
(denote-link-add-links-sort (plist-get params :reverse))
(current-file (denote-filetype-heuristics (buffer-file-name))))
(when block-name
(insert "#+name: " block-name "\n"))
(if missing-only
(progn
(denote-link-add-missing-links (if rx-form (macroexpand `(rx ,rx-form)) regexp))
(join-line)) ;; remove trailing empty line left by denote-link--prepare-links
(when-let ((files (delete current-file
(denote-directory-files-matching-regexp (if rx-form (macroexpand `(rx ,rx-form)) regexp)))
))
(insert (denote-link--prepare-links files current-file nil))
(join-line)))))
From: Mirko Hernández @.***> Date: Mon, 3 Jun 2024 13:24:02 -0700
I'm using guix to install the package, it is version 2.3.0 ( I checked the latest tagged version and it is the same).
Oh, I think we have a problem here. I updated to version 2.3.5 to trigger a rebuild on GNU ELPA that fixes some minor problems. It seems that Guix is behind that commit then.
I will tag commit 914e5be now.
-- Protesilaos Stavrou https://protesilaos.com
Sorry @protesilaos! the issue was on my part. I tested the 2.3.5 version (using --with-latest) and it still gave me the error. It turns out I had some code redefining org-dblock-write:denote-links
(to sort by signature I guess, I can't recall). The 2.3.0 version was working properly as well, I checked that version too. Sorry about that.
Sorry @protesilaos! the issue was on my part. I tested the 2.3.5 version (using --with-latest) and it still gave me the error. It turns out I had some code redefining
org-dblock-write:denote-links
(to sort by signature I guess, I can't recall). The 2.3.0 version was working properly as well, I checked that version too. Sorry about that.
I think I might be having a similar issue, I found that calling org-dblock-update
on a denote dblock without loading 'denote-org-extras
first result in the error org-update-dblock: Symbol’s function definition is void: org-dblock-write:denote-links
.
I'm now using this in my use-package config as a workaround
Hello @Kolmas225! Are you using the latest version from GNU ELPA? It comes with autoloads for the dynamic blocks. Like this:
;; 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)))
If that does not work, then we need to review what is happening. The goal is to not have to explicitly require denote-org-extras
.
Hello @Kolmas225! Are you using the latest version from GNU ELPA? It comes with autoloads for the dynamic blocks. Like this:
I should be on the latest version right now
installed version: 2.3.5 b8fd5af
Also I took a screencast of reproducing the error when not explicitly requiring denote-org-extras
:
Screencast from 2024-06-08 13-58-02.webm
@Kolmas225 I just made the change. Please let me know if it works for you.
@Kolmas225 I just made the change. Please let me know if it works for you.
It fixes the issue for me, thank you!
I recently updated denote and I'm having trouble updating dblocks. An error occurs in denote-format-link, it can't find the proper file type, instead of 'org (for example) the dblock function tries to use the name of the file.
I believe that the problem originates in org-dblock-write:denote-links.
Edit: I just confirmed that setting current-file to
(denote-filetype-heuristics (buffer-file-name))
solves the issue, should it be current-file-type?