summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBastien Guerry <bzg@altern.org>2014-01-14 12:38:50 +0100
committerBastien Guerry <bzg@altern.org>2014-01-14 12:38:50 +0100
commit4a9820067a3fdb78c977a5077771b86d548764a4 (patch)
tree355bd43f09ac2ea093d21ee62fb87e3adbab4c57
parent3f7822d31b2bd4f69e0760c183ae0e51f3b04ed7 (diff)
downloadorg-mode-f5a4a7a8611e223186dc456b34650f134011f84f.tar.gz
Fix bug when demoting invisible headlinesrelease_8.2.5d
* org.el (org-demote): Ignore invisible text when aligning tags. (org-set-tags): When JUST-ALIGN is 'ignore-column, ignore invisible text when restoring the cursor to the correct column. This fixes a bug about demoting hidden headlines. If org-move-to-column temporarily ignore visibility specs, this will prevent org-demote to work correctly in hidden regions. Thanks to Susan Cragin for reporting this bug.
-rw-r--r--lisp/org.el13
1 files changed, 8 insertions, 5 deletions
diff --git a/lisp/org.el b/lisp/org.el
index 7c1b291..ee7965a 100644
--- a/lisp/org.el
+++ b/lisp/org.el
@@ -7959,7 +7959,7 @@ in the region."
(diff (abs (- level (length down-head) -1))))
(replace-match down-head nil t)
;; Fixup tag positioning
- (and org-auto-align-tags (org-set-tags nil t))
+ (and org-auto-align-tags (org-set-tags nil 'ignore-column))
(if org-adapt-indentation (org-fixup-indentation diff))
(run-hooks 'org-after-demote-entry-hook)))
@@ -14457,15 +14457,18 @@ If DATA is nil or the empty string, any tags will be removed."
(defvar org-indent-indentation-per-level)
(defun org-set-tags (&optional arg just-align)
"Set the tags for the current headline.
-With prefix ARG, realign all tags in headings in the current buffer."
+With prefix ARG, realign all tags in headings in the current buffer.
+When JUST-ALIGN is non-nil, only align tags.
+When JUST-ALIGN is 'ignore-column, align tags without trying to set
+the column by ignoring invisible text."
(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
+ ;; We don't use ARG and JUST-ALIGN here because 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))))
@@ -14554,7 +14557,7 @@ With prefix ARG, realign all tags in headings in the current buffer."
(and (not (featurep 'xemacs)) c0 indent-tabs-mode (tabify p0 (point)))
tags)
(t (error "Tags alignment failed")))
- (org-move-to-column col nil nil t)
+ (org-move-to-column col nil nil (not (eq just-align 'ignore-column)))
(unless just-align
(run-hooks 'org-after-tags-change-hook))))))