Fix `org-toggle-tag

* lisp/org.el (org-toggle-tag): Fix
  d777d5e0b7.

Reported-by: Josh Moller-Mara <jmm@cns.nyu.edu>
<http://lists.gnu.org/archive/html/emacs-orgmode/2017-08/msg00278.html>
This commit is contained in:
Galen Menzel 2017-08-11 11:02:01 +02:00 committed by Nicolas Goaziou
parent 8fa6c015a4
commit 10b1cfb031
1 changed files with 6 additions and 2 deletions

View File

@ -14747,8 +14747,12 @@ If ONOFF is `on' or `off', don't toggle but set to this state."
(let ((current
(when (re-search-forward "[ \t]:\\([[:alnum:]_@#%:]+\\):[ \t]*$"
(line-end-position) t)
(prog1 (nreverse (org-split-string (match-string 1) ":"))
(replace-match ""))))
(let ((tags (match-string 1)))
;; Clear current tags.
(replace-match "")
;; Reverse the tags list so any new tag is appended to
;; the current list of tags.
(nreverse (org-split-string tags ":")))))
res)
(pcase onoff
(`off (setq current (delete tag current)))