1
0
mirror of https://git.savannah.gnu.org/git/emacs/org-mode.git synced 2024-11-21 06:55:35 +00:00

Remove `org-get-tags-string'

* lisp/org.el (org-get-tags-string): Move to "org-compat".
(org-make-tag-string): New function
(org-set-tags-to):
(org-set-tags):
(org-set-current-tags-overlay):
(org-entry-properties):
(org-agenda-prepare-buffers):
* lisp/org-mouse.el (org-mouse-set-tags):
* lisp/ox-ascii.el (org-ascii--build-title):
* lisp/ox-beamer.el (org-beamer-select-environment):
* lisp/ox-latex.el (org-latex-format-inlinetask-default-function):
* lisp/ox-md.el (org-md-headline):
(org-md--build-toc):
* lisp/ox-texinfo.el (org-texinfo-format-headline-default-function):
(org-texinfo-format-inlinetask-default-function):
* contrib/lisp/ox-groff.el (org-groff-headline):
(org-groff-inlinetask): Use new function.
* lisp/org-compat.el (org-get-tags-string): New function.
This commit is contained in:
Nicolas Goaziou 2018-04-18 23:57:51 +02:00
parent 2a293843ad
commit edc159c2f2
9 changed files with 40 additions and 43 deletions

View File

@ -977,8 +977,7 @@ holding contextual information."
(when priority (format " [\\#%c] " priority))
text
(when tags
(format " \\fC:%s:\\fP "
(mapconcat 'identity tags ":"))))))
(format " \\fC%s\\fP " (org-make-tag-string tags))))))
(full-text-no-tag
(if (functionp org-groff-format-headline-function)
;; User-defined formatting function.
@ -1120,8 +1119,7 @@ holding contextual information."
(when todo (format "\\fB%s\\fP " todo))
(when priority (format " [\\#%c] " priority))
title
(when tags (format " \\fC:%s:\\fP "
(mapconcat 'identity tags ":"))))))
(when tags (format " \\fC%s\\fP " (org-make-tag-string tags))))))
(format (concat "\n.DS I\n"
"%s\n"
".sp"

View File

@ -395,6 +395,11 @@ use of this function is for the stuck project list."
(declare (obsolete "use `org-get-tags' instead." "Org 9.2"))
(org-get-tags pos 'local))
(defun org-get-tags-string ()
"Get the TAGS string in the current headline."
(declare (obsolete "use `org-make-tag-string' instead." "Org 9.2"))
(org-make-tag-string (org-get-tags nil t)))
;;;; Obsolete link types
(eval-after-load 'org

View File

@ -448,7 +448,7 @@ SCHEDULED: or DEADLINE: or ANYTHINGLIKETHIS:"
;; set new tags if any
(when tags
(end-of-line)
(insert " :" (mapconcat 'identity tags ":") ":")
(insert " " (org-make-tag-string tags))
(org-set-tags nil t))))
(defun org-mouse-insert-checkbox ()

View File

@ -14211,10 +14211,9 @@ If DATA is nil or the empty string, all tags are removed."
(let ((data
(pcase (if (stringp data) (org-trim data) data)
((or `nil "") nil)
((pred listp) (format ":%s:" (mapconcat #'identity data ":")))
((pred listp) (org-make-tag-string data))
((pred stringp)
(format ":%s:"
(mapconcat #'identity (org-split-string data ":+") ":")))
(org-make-tag-string (org-split-string data ":+")))
(_ (error "Invalid tag specification: %S" data)))))
(org-with-wide-buffer
(org-back-to-heading t)
@ -14263,7 +14262,7 @@ When JUST-ALIGN is non-nil, only align tags."
(org-set-tags nil t)
(end-of-line))
(message "All tags realigned to column %d" org-tags-column))
(let* ((current (org-get-tags-string))
(let* ((current (org-make-tag-string (org-get-tags nil t)))
(tags
(if just-align current
;; Get a new set of tags from the user.
@ -14436,7 +14435,7 @@ Also insert END."
(defun org-set-current-tags-overlay (current prefix)
"Add an overlay to CURRENT tag with PREFIX."
(let ((s (concat ":" (mapconcat 'identity current ":") ":")))
(let ((s (org-make-tag-string current)))
(put-text-property 0 (length s) 'face '(secondary-selection org-tag) s)
(org-overlay-display org-tags-overlay (concat prefix s))))
@ -14642,15 +14641,11 @@ Returns the new tags string, or nil to not change the current settings."
(mapconcat 'identity current ":")
nil))))
(defun org-get-tags-string ()
"Get the TAGS string in the current headline."
(unless (org-at-heading-p t)
(user-error "Not on a heading"))
(save-excursion
(beginning-of-line 1)
(if (looking-at ".*[ \t]\\(:[[:alnum:]_@#%:]+:\\)[ \t]*$")
(match-string-no-properties 1)
"")))
(defun org-make-tag-string (tags)
"Return string associated to TAGS.
TAGS is a list of strings."
(if (null tags) ""
(format ":%s:" (mapconcat #'identity tags ":"))))
(defun org--get-local-tags ()
"Return list of tags for the current headline.
@ -15031,14 +15026,15 @@ strings."
props)
(when specific (throw 'exit props)))
(when (or (not specific) (string= specific "TAGS"))
(let ((value (org-string-nw-p (org-get-tags-string))))
(when value (push (cons "TAGS" value) props)))
(let ((tags (org-get-tags nil t)))
(when tags
(push (cons "TAGS" (org-make-tag-string tags))
props)))
(when specific (throw 'exit props)))
(when (or (not specific) (string= specific "ALLTAGS"))
(let ((value (org-get-tags)))
(when value
(push (cons "ALLTAGS"
(format ":%s:" (mapconcat #'identity value ":")))
(let ((tags (org-get-tags)))
(when tags
(push (cons "ALLTAGS" (org-make-tag-string tags))
props)))
(when specific (throw 'exit props)))
(when (or (not specific) (string= specific "BLOCKED"))
@ -17915,7 +17911,7 @@ When a buffer is unmodified, it is just killed. When modified, it is saved
(pall '(:org-archived t :org-comment t))
(inhibit-read-only t)
(org-inhibit-startup org-agenda-inhibit-startup)
(rea (concat ":" org-archive-tag ":"))
(rea (org-make-tag-string (list org-archive-tag)))
re pos)
(setq org-tag-alist-for-agenda nil
org-tag-groups-alist-for-agenda nil)

View File

@ -671,8 +671,7 @@ possible. It doesn't apply to `inlinetask' elements."
(plist-get info :with-tags)
(let ((tag-list (org-export-get-tags element info)))
(and tag-list
(format ":%s:"
(mapconcat 'identity tag-list ":"))))))
(org-make-tag-string tag-list)))))
(priority
(and (plist-get info :with-priority)
(let ((char (org-element-property :priority element)))

View File

@ -1076,11 +1076,11 @@ aid, but the tag does not have any semantic meaning."
(org-use-fast-tag-selection t)
(org-fast-tag-selection-single-key t))
(org-set-tags)
(let ((tags (or (ignore-errors (org-get-tags-string)) "")))
(let ((tags (org-get-tags nil t)))
(cond
;; For a column, automatically ask for its width.
((eq org-last-tag-selection-key ?|)
(if (string-match ":BMCOL:" tags)
(if (member "BMCOL" tags)
(org-set-property "BEAMER_col" (read-string "Column width: "))
(org-delete-property "BEAMER_col")))
;; For an "againframe" section, automatically ask for reference
@ -1096,7 +1096,8 @@ aid, but the tag does not have any semantic meaning."
(read-string "Frame reference (*Title, #custom-id, id:...): "))
(org-set-property "BEAMER_act"
(read-string "Overlay specification: "))))
((string-match (concat ":B_\\(" (mapconcat 'car envs "\\|") "\\):") tags)
((let ((tags-re (concat "B_" (regexp-opt (mapcar #'car envs) t))))
(cl-some (lambda (tag) (string-match tags-re tag)) tags))
(org-entry-put nil "BEAMER_env" (match-string 1 tags)))
(t (org-entry-delete nil "BEAMER_env"))))))

View File

@ -2132,8 +2132,9 @@ See `org-latex-format-inlinetask-function' for details."
(when priority (format "\\framebox{\\#%c} " priority))
title
(when tags
(format "\\hfill{}\\textsc{:%s:}"
(mapconcat #'org-latex--protect-text tags ":"))))))
(format "\\hfill{}\\textsc{%s}"
(org-make-tag-string
(mapcar #'org-latex--protect-text tags)))))))
(concat "\\begin{center}\n"
"\\fbox{\n"
"\\begin{minipage}[c]{.6\\textwidth}\n"

View File

@ -211,8 +211,7 @@ a communication channel."
(tags (and (plist-get info :with-tags)
(let ((tag-list (org-export-get-tags headline info)))
(and tag-list
(format " :%s:"
(mapconcat 'identity tag-list ":"))))))
(concat " " (org-make-tag-string tag-list))))))
(priority
(and (plist-get info :with-priority)
(let ((char (org-element-property :priority headline)))
@ -589,10 +588,8 @@ contents according to the current headline."
(org-export-get-reference headline info))))
(tags (and (plist-get info :with-tags)
(not (eq 'not-in-toc (plist-get info :with-tags)))
(let ((tags (org-export-get-tags headline info)))
(and tags
(format ":%s:"
(mapconcat #'identity tags ":")))))))
(org-make-tag-string
(org-export-get-tags headline info)))))
(concat indentation bullet title tags)))
(org-export-collect-headlines info n (and local keyword)) "\n")
"\n"))

View File

@ -914,10 +914,10 @@ holding contextual information."
(todo _todo-type priority text tags)
"Default format function for a headline.
See `org-texinfo-format-headline-function' for details."
(concat (when todo (format "@strong{%s} " todo))
(when priority (format "@emph{#%s} " priority))
(concat (and todo (format "@strong{%s} " todo))
(and priority (format "@emph{#%s} " priority))
text
(when tags (format " :%s:" (mapconcat 'identity tags ":")))))
(and tags (concat " " (org-make-tag-string tags)))))
;;;; Inline Src Block
@ -955,7 +955,7 @@ See `org-texinfo-format-inlinetask-function' for details."
(concat (when todo (format "@strong{%s} " todo))
(when priority (format "#%c " priority))
title
(when tags (format ":%s:" (mapconcat #'identity tags ":"))))))
(when tags (org-make-tag-string tags)))))
(format "@center %s\n\n%s\n" full-title contents)))
;;;; Italic