lisp/org-attach.el (org-attach-attach): Put org-attach-after-change-hook
at the end to make sure user can access attach link in org-store-links.

From f21ef819ab6670f1ed64a731d5d7b5fb29119f33 Mon Sep 17 00:00:00 2001
From: stardiviner <numbch...@gmail.com>
Date: Thu, 29 Aug 2024 11:31:53 +0800
Subject: [PATCH] org-attach.el: put org-attach-after-change-hook at the end

lisp/org-attach.el (org-attach-attach): Put org-attach-after-change-hook
at the end to make sure user can access attach link in org-store-links.
---
 lisp/org-attach.el | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/lisp/org-attach.el b/lisp/org-attach.el
index 7a03d170e..d43cbc74c 100644
--- a/lisp/org-attach.el
+++ b/lisp/org-attach.el
@@ -615,8 +615,6 @@ METHOD may be `cp', `mv', `ln', `lns' or `url' default taken from
             (url-copy-file file attach-file)
           (error "The remote resource %S is considered unsafe, and will not be downloaded"
                  file))))
-      (run-hook-with-args 'org-attach-after-change-hook attach-dir)
-      (org-attach-tag)
       (cond ((eq org-attach-store-link-p 'attached)
 	     (push (list (concat "attachment:" (file-name-nondirectory attach-file))
 			 (file-name-nondirectory attach-file))
@@ -629,6 +627,8 @@ METHOD may be `cp', `mv', `ln', `lns' or `url' default taken from
 	     (push (list (concat "file:" attach-file)
 			 (file-name-nondirectory attach-file))
 		   org-stored-links)))
+      (run-hook-with-args 'org-attach-after-change-hook attach-dir)
+      (org-attach-tag)
       (if visit-dir
           (dired attach-dir)
         (message "File %S is now an attachment" basename)))))
-- 
2.39.3 (Apple Git-146)

-- 

[ stardiviner ]
I try to make every word tell the meaning that I want to express without 
misunderstanding.

Blog: https://stardiviner.github.io/
IRC(libera.chat, freenode): stardiviner, Matrix: stardiviner
GPG: F09F650D7D674819892591401B5DF1C95AE89AC3

Attachment: signature.asc
Description: PGP signature

Reply via email to