1
0
mirror of https://git.savannah.gnu.org/git/emacs/org-mode.git synced 2024-12-12 09:28:11 +00:00

org.el (org-set-regexps-and-options-for-tags): Fix the setting of tag groups when relying on `org-tag-alist'

* org.el (org-set-regexps-and-options-for-tags): Fix the
setting of tag groups when relying on `org-tag-alist', not on
tags directly set in the buffer with the #+TAGS option.

Thanks to Maurice for reporting this.
This commit is contained in:
Bastien Guerry 2013-07-06 16:15:18 +02:00
parent 0aa0fdd971
commit 4269178827

View File

@ -4834,41 +4834,49 @@ Support for group tags is controlled by the option
(mapcar 'org-add-prop-inherited ftags)))
(org-set-local 'org-tag-groups-alist nil)
;; Process the tags.
;; FIXME
(when tags
(let (e tgs g)
(while (setq e (pop tags))
(cond
((equal e "{")
(progn (push '(:startgroup) tgs)
(when (equal (nth 1 tags) ":")
(push (list (replace-regexp-in-string
"(.+)$" "" (nth 0 tags)))
org-tag-groups-alist)
(setq g 0))))
((equal e ":") (push '(:grouptags) tgs))
((equal e "}") (push '(:endgroup) tgs) (if g (setq g nil)))
((equal e "\\n") (push '(:newline) tgs))
((string-match (org-re "^\\([[:alnum:]_@#%]+\\)(\\(.\\))$") e)
(push (cons (match-string 1 e)
(string-to-char (match-string 2 e))) tgs)
(when (and (not tags) org-tag-alist)
(setq tags
(mapcar
(lambda (tg) (cond ((eq (car tg) :startgroup) "{")
((eq (car tg) :endgroup) "}")
((eq (car tg) :grouptags) ":")
(t (concat (car tg)
(if (characterp (cdr tg))
(format "(%s)" (char-to-string (cdr tg))) "")))))
org-tag-alist)))
(let (e tgs g)
(while (setq e (pop tags))
(cond
((equal e "{")
(progn (push '(:startgroup) tgs)
(when (equal (nth 1 tags) ":")
(push (list (replace-regexp-in-string
"(.+)$" "" (nth 0 tags)))
org-tag-groups-alist)
(setq g 0))))
((equal e ":") (push '(:grouptags) tgs))
((equal e "}") (push '(:endgroup) tgs) (if g (setq g nil)))
((equal e "\\n") (push '(:newline) tgs))
((string-match (org-re "^\\([[:alnum:]_@#%]+\\)(\\(.\\))$") e)
(push (cons (match-string 1 e)
(string-to-char (match-string 2 e))) tgs)
(if (and g (> g 0))
(setcar org-tag-groups-alist
(append (car org-tag-groups-alist)
(list (match-string 1 e)))))
(if g (setq g (1+ g))))
(t (push (list e) tgs)
(if (and g (> g 0))
(setcar org-tag-groups-alist
(append (car org-tag-groups-alist)
(list (match-string 1 e)))))
(if g (setq g (1+ g))))
(t (push (list e) tgs)
(if (and g (> g 0))
(setcar org-tag-groups-alist
(append (car org-tag-groups-alist) (list e))))
(if g (setq g (1+ g))))))
(org-set-local 'org-tag-alist nil)
(while (setq e (pop tgs))
(or (and (stringp (car e))
(assoc (car e) org-tag-alist))
(push e org-tag-alist)))
;; Return a list with tag variables
(list org-file-tags org-tag-alist org-tag-groups-alist))))))
(append (car org-tag-groups-alist) (list e))))
(if g (setq g (1+ g))))))
(org-set-local 'org-tag-alist nil)
(while (setq e (pop tgs))
(or (and (stringp (car e))
(assoc (car e) org-tag-alist))
(push e org-tag-alist)))
;; Return a list with tag variables
(list org-file-tags org-tag-alist org-tag-groups-alist)))))
(defvar org-ota nil)
(defun org-set-regexps-and-options ()