summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorNicolas Goaziou <mail@nicolasgoaziou.fr>2018-04-18 17:55:10 +0200
committerNicolas Goaziou <mail@nicolasgoaziou.fr>2018-04-19 11:51:54 +0200
commitf05493504a33a12c829d6f8a1d935578ce979a7c (patch)
treeb05429b8e1c17d0debbb9071e724d3b20a97c2ad
parentfbe56f89f75a8979e0ba48001a822518df2c66fe (diff)
downloadorg-mode-f05493504a33a12c829d6f8a1d935578ce979a7c.tar.gz
Replace `org-get-tags-at' with `org-get-tags'
* contrib/lisp/org-drill.el (org-part-of-drill-entry-p): * lisp/org-agenda.el (org-agenda-finalize): (org-search-view): (org-agenda-get-todos): (org-agenda-get-timestamps): (org-agenda-get-sexps): (org-agenda-get-progress): (org-agenda-get-deadlines): (org-agenda-get-scheduled): (org-agenda-get-blocks): (org-agenda-change-all-lines): * lisp/org-bibtex.el (org-bibtex-headline): * lisp/org-clock.el (org-clock-get-table-data): * lisp/org-pcomplete.el (org-get-tags): * lisp/org.el (org-trust-scanner-tags): (org-get-local-tags-at): (org-get-local-tags): (org-set-tags): (org-map-entries): (org-entry-properties): Use `org-get-tags' instead of `org-get-tags-at'.
-rw-r--r--contrib/lisp/org-drill.el2
-rw-r--r--lisp/org-agenda.el26
-rw-r--r--lisp/org-bibtex.el2
-rw-r--r--lisp/org-clock.el2
-rw-r--r--lisp/org-compat.el2
-rw-r--r--lisp/org-pcomplete.el2
-rw-r--r--lisp/org.el61
7 files changed, 25 insertions, 72 deletions
diff --git a/contrib/lisp/org-drill.el b/contrib/lisp/org-drill.el
index 7c4a299..12c7dba 100644
--- a/contrib/lisp/org-drill.el
+++ b/contrib/lisp/org-drill.el
@@ -774,7 +774,7 @@ situation use `org-part-of-drill-entry-p'."
or a subheading within a drill item?"
(or (org-drill-entry-p)
;; Does this heading INHERIT the drill tag
- (member org-drill-question-tag (org-get-tags-at))))
+ (member org-drill-question-tag (org-get-tags))))
(defun org-drill-goto-drill-entry-heading ()
diff --git a/lisp/org-agenda.el b/lisp/org-agenda.el
index 07c789b..ae3e42f 100644
--- a/lisp/org-agenda.el
+++ b/lisp/org-agenda.el
@@ -3805,9 +3805,9 @@ FILTER-ALIST is an alist of filters we need to apply when
(while (equal (forward-line) 0)
(when (setq mrk (get-text-property (point) 'org-hd-marker))
(put-text-property (point-at-bol) (point-at-eol)
- 'tags (org-with-point-at mrk
- (delete-dups
- (mapcar 'downcase (org-get-tags-at))))))))))
+ 'tags
+ (org-with-point-at mrk
+ (mapcar #'downcase (org-get-tags)))))))))
(run-hooks 'org-agenda-finalize-hook)
(when org-agenda-top-headline-filter
(org-agenda-filter-top-headline-apply
@@ -4588,7 +4588,7 @@ is active."
(and (eq org-agenda-show-inherited-tags t)
(or (eq org-agenda-use-tag-inheritance t)
(memq 'todo org-agenda-use-tag-inheritance))))
- tags (org-get-tags-at nil (not inherited-tags))
+ tags (org-get-tags nil (not inherited-tags))
txt (org-agenda-format-item
""
(buffer-substring-no-properties
@@ -5380,7 +5380,7 @@ and the timestamp type relevant for the sorting strategy in
(and (eq org-agenda-show-inherited-tags t)
(or (eq org-agenda-use-tag-inheritance t)
(memq 'todo org-agenda-use-tag-inheritance))))
- tags (org-get-tags-at nil (not inherited-tags))
+ tags (org-get-tags nil (not inherited-tags))
level (make-string (org-reduced-level (org-outline-level)) ? )
txt (org-agenda-format-item "" txt level category tags t)
priority (1+ (org-get-priority txt)))
@@ -5590,7 +5590,7 @@ displayed in agenda view."
(or (eq org-agenda-use-tag-inheritance t)
(memq 'agenda
org-agenda-use-tag-inheritance)))))
- (tags (org-get-tags-at nil (not inherited-tags)))
+ (tags (org-get-tags nil (not inherited-tags)))
(level (make-string (org-reduced-level (org-outline-level))
?\s))
(head (and (looking-at "\\*+[ \t]+\\(.*\\)")
@@ -5654,7 +5654,7 @@ displayed in agenda view."
(and (eq org-agenda-show-inherited-tags t)
(or (eq org-agenda-use-tag-inheritance t)
(memq 'agenda org-agenda-use-tag-inheritance))))
- tags (org-get-tags-at nil (not inherited-tags))
+ tags (org-get-tags nil (not inherited-tags))
todo-state (org-get-todo-state)
warntime (get-text-property (point) 'org-appt-warntime)
extra nil)
@@ -5804,7 +5804,7 @@ then those holidays will be skipped."
(and (eq org-agenda-show-inherited-tags t)
(or (eq org-agenda-use-tag-inheritance t)
(memq 'todo org-agenda-use-tag-inheritance))))
- tags (org-get-tags-at nil (not inherited-tags))
+ tags (org-get-tags nil (not inherited-tags))
level (make-string (org-reduced-level (org-outline-level)) ? ))
(looking-at "\\*+[ \t]+\\([^\r\n]+\\)")
(setq txt (match-string 1))
@@ -6055,7 +6055,7 @@ specification like [h]h:mm."
(or (eq org-agenda-use-tag-inheritance t)
(memq 'agenda
org-agenda-use-tag-inheritance)))))
- (tags (org-get-tags-at nil (not inherited-tags)))
+ (tags (org-get-tags nil (not inherited-tags)))
(time
(cond
;; No time of day designation if it is only
@@ -6255,7 +6255,7 @@ scheduled items with an hour specification like [h]h:mm."
(or (eq org-agenda-use-tag-inheritance t)
(memq 'agenda
org-agenda-use-tag-inheritance)))))
- (tags (org-get-tags-at nil (not inherited-tags)))
+ (tags (org-get-tags nil (not inherited-tags)))
(level (make-string (org-reduced-level (org-outline-level))
?\s))
(head (buffer-substring (point) (line-end-position)))
@@ -6362,7 +6362,7 @@ scheduled items with an hour specification like [h]h:mm."
(or (eq org-agenda-use-tag-inheritance t)
(memq 'agenda org-agenda-use-tag-inheritance))))
- tags (org-get-tags-at nil (not inherited-tags)))
+ tags (org-get-tags nil (not inherited-tags)))
(setq level (make-string (org-reduced-level (org-outline-level)) ? ))
(looking-at "\\*+[ \t]+\\(.*\\)")
(setq head (match-string 1))
@@ -8930,9 +8930,7 @@ If FORCE-TAGS is non nil, the car of it returns the new tags."
(line (org-current-line))
(org-agenda-buffer (current-buffer))
(thetags (with-current-buffer (marker-buffer hdmarker)
- (org-with-wide-buffer
- (goto-char hdmarker)
- (org-get-tags-at))))
+ (org-get-tags hdmarker)))
props m pl undone-face done-face finish new dotime level cat tags)
(save-excursion
(goto-char (point-max))
diff --git a/lisp/org-bibtex.el b/lisp/org-bibtex.el
index 9dab0b4..94eef74 100644
--- a/lisp/org-bibtex.el
+++ b/lisp/org-bibtex.el
@@ -355,7 +355,7 @@ and `org-exclude-tags-from-inheritance'."
org-bibtex-no-export-tags))
tag))
(if org-bibtex-inherit-tags
- (org-get-tags-at)
+ (org-get-tags)
(org-get-local-tags-at)))))))
(when type
(let ((entry (format
diff --git a/lisp/org-clock.el b/lisp/org-clock.el
index 227b52b..5139b41 100644
--- a/lisp/org-clock.el
+++ b/lisp/org-clock.el
@@ -2795,7 +2795,7 @@ PROPERTIES: The list properties specified in the `:properties' parameter
(org-clock-sum ts te
(when matcher
`(lambda ()
- (let* ((tags-list (org-get-tags-at))
+ (let* ((tags-list (org-get-tags))
(org-scanner-tags tags-list)
(org-trust-scanner-tags t))
(funcall ,matcher nil tags-list nil)))))
diff --git a/lisp/org-compat.el b/lisp/org-compat.el
index e7ea415..c0fe070 100644
--- a/lisp/org-compat.el
+++ b/lisp/org-compat.el
@@ -383,6 +383,8 @@ use of this function is for the stuck project list."
"use `org-show-all' instead."
"Org 9.2")
+(define-obsolete-function-alias 'org-get-tags-at 'org-get-tags "Org 9.2")
+
;;;; Obsolete link types
diff --git a/lisp/org-pcomplete.el b/lisp/org-pcomplete.el
index 536130d..9966951 100644
--- a/lisp/org-pcomplete.el
+++ b/lisp/org-pcomplete.el
@@ -33,7 +33,7 @@
(declare-function org-make-org-heading-search-string "org" (&optional string))
(declare-function org-get-buffer-tags "org" ())
-(declare-function org-get-tags "org" ())
+(declare-function org-get-tags "org" (&optional pos local))
(declare-function org-buffer-property-keys "org" (&optional specials defaults columns))
(declare-function org-entry-properties "org" (&optional pom which))
(declare-function org-tag-alist-to-string "org" (alist &optional skip-key))
diff --git a/lisp/org.el b/lisp/org.el
index 77c6a1a..48ebf03 100644
--- a/lisp/org.el
+++ b/lisp/org.el
@@ -13591,9 +13591,9 @@ Can be set by the action argument to `org-scan-tags' and `org-map-entries'.")
"The current tag list while the tags scanner is running.")
(defvar org-trust-scanner-tags nil
- "Should `org-get-tags-at' use the tags for the scanner.
+ "Should `org-get-tags' use the tags for the scanner.
This is for internal dynamical scoping only.
-When this is non-nil, the function `org-get-tags-at' will return the value
+When this is non-nil, the function `org-get-tags' will return the value
of `org-scanner-tags' instead of building the list by itself. This
can lead to large speed-ups when the tags scanner is used in a file with
many entries, and when the list of tags is retrieved, for example to
@@ -14153,58 +14153,11 @@ When DOWNCASE is non-nil, expand downcased TAGS."
(defun org-get-local-tags-at (&optional pos)
"Get a list of tags defined in the current headline."
- (org-get-tags-at pos 'local))
+ (org-get-tags pos 'local))
(defun org-get-local-tags ()
"Get a list of tags defined in the current headline."
- (org-get-tags-at nil 'local))
-
-(defun org-get-tags-at (&optional pos local)
- "Get a list of all headline tags applicable at POS.
-POS defaults to point. If tags are inherited, the list contains
-the targets in the same sequence as the headlines appear, i.e.
-the tags of the current headline come last.
-When LOCAL is non-nil, only return tags from the current headline,
-ignore inherited ones."
- (interactive)
- (if (and org-trust-scanner-tags
- (or (not pos) (equal pos (point)))
- (not local))
- org-scanner-tags
- (let (tags ltags lastpos parent)
- (save-excursion
- (save-restriction
- (widen)
- (goto-char (or pos (point)))
- (save-match-data
- (catch 'done
- (condition-case nil
- (progn
- (org-back-to-heading t)
- (while (not (equal lastpos (point)))
- (setq lastpos (point))
- (when (looking-at ".+?:\\([[:alnum:]_@#%:]+\\):[ \t]*$")
- (setq ltags (org-split-string
- (match-string-no-properties 1) ":"))
- (when parent
- (setq ltags (mapcar 'org-add-prop-inherited ltags)))
- (setq tags (append
- (if parent
- (org-remove-uninherited-tags ltags)
- ltags)
- tags)))
- (or org-use-tag-inheritance (throw 'done t))
- (when local (throw 'done t))
- (or (org-up-heading-safe) (error nil))
- (setq parent t)))
- (error nil)))))
- (if local
- tags
- (reverse (delete-dups
- (reverse (append
- (org-remove-uninherited-tags
- org-file-tags)
- tags)))))))))
+ (org-get-tags nil 'local))
(defun org-add-prop-inherited (s)
(add-text-properties 0 (length s) '(inherited t) s)
@@ -14348,7 +14301,7 @@ When JUST-ALIGN is non-nil, only align tags."
(current-tags (org-split-string current ":"))
(inherited-tags
(nreverse (nthcdr (length current-tags)
- (nreverse (org-get-tags-at))))))
+ (nreverse (org-get-tags))))))
(replace-regexp-in-string
"\\([-+&]+\\|,\\)"
":"
@@ -14821,7 +14774,7 @@ the scanner. The following items can be given here:
If your function needs to retrieve the tags including inherited tags
at the *current* entry, you can use the value of the variable
`org-scanner-tags' which will be much faster than getting the value
-with `org-get-tags-at'. If your function gets properties with
+with `org-get-tags'. If your function gets properties with
`org-entry-properties' at the *current* entry, bind `org-trust-scanner-tags'
to t around the call to `org-entry-properties' to get the same speedup.
Note that if your function moves around to retrieve tags and properties at
@@ -15102,7 +15055,7 @@ strings."
(when value (push (cons "TAGS" value) props)))
(when specific (throw 'exit props)))
(when (or (not specific) (string= specific "ALLTAGS"))
- (let ((value (org-get-tags-at)))
+ (let ((value (org-get-tags)))
(when value
(push (cons "ALLTAGS"
(format ":%s:" (mapconcat #'identity value ":")))