commit d0e6793497d57a90543d711310ad26fae7c9bcba
parent a7b15e14a14b2cd228fa369b6a566a272b2fe6b2
Author: James Wang <jianwang.academic@gmail.com>
Date: Wed, 15 Nov 2017 21:07:11 +0800
Use org-element-context to get the file name to rename
Fixes #63
Fixes #62
Diffstat:
1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/org-download.el b/org-download.el
@@ -345,7 +345,8 @@ It's inserted before the image link and is used to annotate it.")
"Rename image at point."
(interactive)
(let* ((dir-path (org-download--dir))
- (current-name (file-name-nondirectory (ffap-file-at-point)))
+ (current-name (file-name-nondirectory
+ (org-element-property :path (org-element-context))))
(current-path (concat dir-path "/" current-name))
(ext (file-name-extension current-name))
(new-name (read-string "Rename file at point to: "))