.emacs.d

the most bloated Emacs config on this planet
git clone https://git.trogloxene.org/.emacs.d.git
Log | Files | Refs

commit e4608d6dca5d7cc4e8903c5cb823bdb6e86c3642
parent befb687d687d18eb11e9c70c0cf5c3561823e7d5
Author: andsy10 <andsy1016@gmail.com>
Date:   Mon, 12 Oct 2026 18:33:03 +0800

Optimize image support for denote links

Diffstat:
Mlisp/init-org.el | 17++++++++++++++++-
1 file changed, 16 insertions(+), 1 deletion(-)

diff --git a/lisp/init-org.el b/lisp/init-org.el @@ -94,6 +94,7 @@ (after-init . denote-rename-buffer-mode) (dired-mode . denote-dired-mode) :commands my-denote-find-file my-denote-find-backlink-with-location my-org-dblock-update-all + :autoload denote-retrieve-filename-identifier :config (defun my-denote-find-file (&optional arg) "Find file use denote-open-or-create." @@ -132,6 +133,17 @@ (kill-current-buffer))))) (message "Updated %s file(s)" changed))) + (defvar my-denote-link-image-html-width 600) + (defun my-denote-link-image-fix (fun file file-type &rest args) + "Use custom `denote-org-link-format' if target file is an image." + (let ((denote-org-link-format + (if (org-file-image-p file) + (format "#+attr_html: :width %dpx\n[[denote:%%s]]" + my-denote-link-image-html-width) + denote-org-link-format))) + (apply fun file file-type args))) + (advice-add #'denote-link :around #'my-denote-link-image-fix) + :init (setq denote-directory org-directory denote-org-store-link-to-heading 'context @@ -260,7 +272,10 @@ :config (setq-default org-download-image-dir "./images/" org-download-heading-lvl nil) - (setq org-download-dragndrop t + (setq org-download-timestamp "%Y%m%dT%H%M%S--" + org-download-link-format "[[denote:%s]]\n" + org-download-abbreviate-filename-function #'denote-retrieve-filename-identifier + org-download-dragndrop t org-download-method 'directory org-image-actual-width nil org-download-image-html-width 600