summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorKyle Meyer <kyle@kyleam.com>2020-08-23 22:39:44 -0400
committerKyle Meyer <kyle@kyleam.com>2020-08-23 22:39:44 -0400
commitcdfc404bed0fabeee65938af329240f183040493 (patch)
treeed04ca47ddab0bd7d6f7841e080a1a168e3f6e77
parent312a646fb8f60735aea1992654e4d06cf37daf3f (diff)
parent7b657c50e7761646d2cc4a02346ac546a4a01a6d (diff)
downloadorg-mode-cdfc404bed0fabeee65938af329240f183040493.tar.gz
Merge branch 'maint' into master
-rw-r--r--lisp/org-clock.el11
-rw-r--r--lisp/org.el14
-rw-r--r--testing/lisp/test-org.el11
3 files changed, 29 insertions, 7 deletions
diff --git a/lisp/org-clock.el b/lisp/org-clock.el
index 0dd4954..9efd99b 100644
--- a/lisp/org-clock.el
+++ b/lisp/org-clock.el
@@ -35,6 +35,10 @@
(declare-function notifications-notify "notifications" (&rest params))
(declare-function org-element-property "org-element" (property element))
(declare-function org-element-type "org-element" (element))
+(declare-function org-inlinetask-at-task-p "org-inlinetask" ())
+(declare-function org-inlinetask-goto-beginning "org-inlinetask" ())
+(declare-function org-inlinetask-goto-end "org-inlinetask" ())
+(declare-function org-inlinetask-in-task-p "org-inlinetask" ())
(declare-function org-link-display-format "ol" (s))
(declare-function org-link-heading-search-string "ol" (&optional string))
(declare-function org-link-make-string "ol" (link &optional description))
@@ -1956,7 +1960,12 @@ PROPNAME lets you set a custom text property instead of :org-clock-minutes."
"Return time, clocked on current item in total."
(save-excursion
(save-restriction
- (org-narrow-to-subtree)
+ (if (and (featurep 'org-inlinetask)
+ (or (org-inlinetask-at-task-p)
+ (org-inlinetask-in-task-p)))
+ (narrow-to-region (save-excursion (org-inlinetask-goto-beginning) (point))
+ (save-excursion (org-inlinetask-goto-end) (point)))
+ (org-narrow-to-subtree))
(org-clock-sum tstart)
org-clock-file-total-minutes)))
diff --git a/lisp/org.el b/lisp/org.el
index fb95590..71dbc61 100644
--- a/lisp/org.el
+++ b/lisp/org.el
@@ -12290,7 +12290,8 @@ According to `org-use-tag-inheritance', tags may be inherited
from parent headlines, and from the whole document, through
`org-file-tags'. In this case, the returned list of tags
contains tags in this order: file tags, tags inherited from
-parent headlines, local tags.
+parent headlines, local tags. If a tag appears multiple times,
+only the most local tag is returned.
However, when optional argument LOCAL is non-nil, only return
tags specified at the headline.
@@ -12306,12 +12307,13 @@ Inherited tags have the `inherited' text property."
(let ((ltags (org--get-local-tags)) itags)
(if (or local (not org-use-tag-inheritance)) ltags
(while (org-up-heading-safe)
- (setq itags (append (mapcar #'org-add-prop-inherited
- (org--get-local-tags))
- itags)))
+ (setq itags (nconc (mapcar #'org-add-prop-inherited
+ (org--get-local-tags))
+ itags)))
(setq itags (append org-file-tags itags))
- (delete-dups
- (append (org-remove-uninherited-tags itags) ltags))))))))
+ (nreverse
+ (delete-dups
+ (nreverse (nconc (org-remove-uninherited-tags itags) ltags))))))))))
(defun org-get-buffer-tags ()
"Get a table of all tags used in the buffer, for completion."
diff --git a/testing/lisp/test-org.el b/testing/lisp/test-org.el
index 4f8c745..6144a7a 100644
--- a/testing/lisp/test-org.el
+++ b/testing/lisp/test-org.el
@@ -6953,6 +6953,17 @@ Paragraph<point>"
(let ((org-use-fast-tag-selection nil)
(org-tags-column 1))
(org-set-tags-command)))
+ (buffer-substring (point) (line-end-position)))))
+ ;; Handle tags both set locally and inherited.
+ (should
+ (equal "b :foo:"
+ (org-test-with-temp-text "* a :foo:\n** <point>b :foo:"
+ (cl-letf (((symbol-function 'completing-read)
+ (lambda (prompt coll &optional pred req initial &rest args)
+ initial)))
+ (let ((org-use-fast-tag-selection nil)
+ (org-tags-column 1))
+ (org-set-tags-command)))
(buffer-substring (point) (line-end-position))))))
(ert-deftest test-org/toggle-tag ()