From 1264a527256b472e8cc911b55fcdd4a85856d443 Mon Sep 17 00:00:00 2001 From: JaeYoo-Im Date: Tue, 4 Oct 2022 22:01:27 +0900 Subject: [PATCH] Emacs : org link remove add --- .doom.d/config.el | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/.doom.d/config.el b/.doom.d/config.el index b72a553..b151b88 100644 --- a/.doom.d/config.el +++ b/.doom.d/config.el @@ -153,6 +153,14 @@ same directory as the org-buffer and insert a link to this file." (user-error "Error pasting the image, make sure you have an image in the clipboard!")) )) +(defun my-org-remove-link-and-trash-linked-file () + "Remove `org-mode' link at point and trash linked file." + (interactive) + (let* ((link (org-element-context)) + (path (org-element-property :path link))) + (move-file-to-trash path) + (delete-region (org-element-property :begin link) + (org-element-property :end link)))) (defun as-windows-path (unix-path) "Takes a unix path and returns a matching WSL path"