Tags completion ignores narrowing

* lisp/org.el (org-get-buffer-tags): Ignore narrowing, if any.  Small
  refactoring.
This commit is contained in:
Nicolas Goaziou 2014-11-10 09:43:01 +01:00
parent 34bbb39454
commit 7af7edc505
1 changed files with 10 additions and 10 deletions

View File

@ -15232,16 +15232,16 @@ Returns the new tags string, or nil to not change the current settings."
(defun org-get-buffer-tags ()
"Get a table of all tags used in the buffer, for completion."
(let (tags)
(save-excursion
(goto-char (point-min))
(while (re-search-forward
(org-re "[ \t]:\\([[:alnum:]_@#%:]+\\):[ \t\r\n]") nil t)
(when (equal (char-after (point-at-bol 0)) ?*)
(mapc (lambda (x) (add-to-list 'tags x))
(org-split-string (org-match-string-no-properties 1) ":")))))
(mapc (lambda (s) (add-to-list 'tags s)) org-file-tags)
(mapcar 'list tags)))
(org-with-wide-buffer
(goto-char (point-min))
(let ((tag-re (concat org-outline-regexp-bol
"\\(?:.*?[ \t]\\)?"
(org-re ":\\([[:alnum:]_@#%:]+\\):[ \t]*$")))
tags)
(while (re-search-forward tag-re nil t)
(dolist (tag (org-split-string (org-match-string-no-properties 1) ":"))
(push tag tags)))
(mapcar #'list (append org-file-tags (org-uniquify tags))))))
;;;; The mapping API