Allow setting tags for headlines in the active region.

* org.el (org-set-tags): Allow setting tags for headlines in
the region when `org-loop-over-headlines-in-active-region' is
non-nil.
This commit is contained in:
Bastien Guerry 2012-05-08 15:29:51 +02:00
parent 10aba6b126
commit de4001705c
1 changed files with 94 additions and 84 deletions

View File

@ -13490,6 +13490,16 @@ If DATA is nil or the empty string, any tags will be removed."
"Set the tags for the current headline.
With prefix ARG, realign all tags in headings in the current buffer."
(interactive "P")
(if (and (org-region-active-p) org-loop-over-headlines-in-active-region)
(let ((cl (if (eq org-loop-over-headlines-in-active-region 'start-level)
'region-start-level 'region))
org-loop-over-headlines-in-active-region)
(org-map-entries
;; We don't use ARG and JUST-ALIGN here these args are not
;; useful when looping over headlines
`(org-set-tags)
org-loop-over-headlines-in-active-region
cl (if (outline-invisible-p) (org-end-of-subtree nil t))))
(let* ((re org-outline-regexp-bol)
(current (unless arg (org-get-tags-string)))
(col (current-column))
@ -13577,7 +13587,7 @@ With prefix ARG, realign all tags in headings in the current buffer."
(t (error "Tags alignment failed")))
(org-move-to-column col)
(unless just-align
(run-hooks 'org-after-tags-change-hook)))))
(run-hooks 'org-after-tags-change-hook))))))
(defun org-change-tag-in-region (beg end tag off)
"Add or remove TAG for each entry in the region.