summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorIhor Radchenko <yantar92@gmail.com>2020-12-17 14:03:30 +0800
committerBastien <bzg@gnu.org>2020-12-17 07:26:31 +0100
commitde6d90224cc7be7ab072314e4b8ca05a712b527c (patch)
treec9a83727cca38d3f915dd4ac414f4943c0184eb9
parent6bdb664406244b0078c360b713024b1e99a2f778 (diff)
downloadorg-mode-de6d90224cc7be7ab072314e4b8ca05a712b527c.tar.gz
org-attach: Consider inlinetasks when calculating attach dir
* lisp/org-attach.el (org-attach): When inside inlinetask, return attachment dir of that task. When outside inlinetask, return attachment dir of the main task ignoring any inlinetasks above point. The call to `org-back-to-heading-or-point-min` does not move point to the actual heading when there is inlinetask above the point. The result is incorrect return value or even creation of property drawer below *...** END line of the last inline task before point.
-rw-r--r--lisp/org-attach.el9
1 files changed, 8 insertions, 1 deletions
diff --git a/lisp/org-attach.el b/lisp/org-attach.el
index e6aa97e..d117bdd 100644
--- a/lisp/org-attach.el
+++ b/lisp/org-attach.el
@@ -256,7 +256,14 @@ Shows a list of commands and prompts for another key to execute a command."
(unless marker
(error "No item in current line")))
(org-with-point-at marker
- (org-back-to-heading-or-point-min t)
+ (if (and (featurep 'org-inlinetask)
+ (not (org-inlinetask-in-task-p)))
+ (org-with-limited-levels
+ (org-back-to-heading-or-point-min t))
+ (if (and (featurep 'org-inlinetask)
+ (org-inlinetask-in-task-p))
+ (org-inlinetask-goto-beginning)
+ (org-back-to-heading-or-point-min t)))
(save-excursion
(save-window-excursion
(unless org-attach-expert