diff options
author | Carsten Dominik <carsten.dominik@gmail.com> | 2010-08-17 08:30:15 +0200 |
---|---|---|
committer | Carsten Dominik <carsten.dominik@gmail.com> | 2010-08-17 08:34:21 +0200 |
commit | bf3405a6ba971d535ad8401e95708851e2ed0b84 (patch) | |
tree | 32d71debc82b9406e8420b4705f62e64058c4e25 | |
parent | 17ace08e0f883c176b577eec09b19012af8c2d0a (diff) | |
download | org-mode-bf3405a6ba971d535ad8401e95708851e2ed0b84.tar.gz |
Fix tags column for the case when org-indent-mode is active
* lisp/org.el (org-set-tags): Consider org-indent-mode when computing the
tags column.
-rw-r--r-- | lisp/org.el | 18 |
1 files changed, 12 insertions, 6 deletions
diff --git a/lisp/org.el b/lisp/org.el index 9cb3799..67c5b3c 100644 --- a/lisp/org.el +++ b/lisp/org.el @@ -12775,7 +12775,7 @@ With prefix ARG, realign all tags in headings in the current buffer." (col (current-column)) (org-setting-tags t) table current-tags inherited-tags ; computed below when needed - tags p0 c0 c1 rpl) + tags p0 c0 c1 rpl di tc level) (if arg (save-excursion (goto-char (point-min)) @@ -12825,6 +12825,9 @@ With prefix ARG, realign all tags in headings in the current buffer." ;; Insert new tags at the correct column (beginning-of-line 1) + (setq level (or (and (looking-at org-outline-regexp) + (- (match-end 0) (point) 1)) + 1)) (cond ((and (equal current "") (equal tags ""))) ((re-search-forward @@ -12833,11 +12836,14 @@ With prefix ARG, realign all tags in headings in the current buffer." (if (equal tags "") (setq rpl "") (goto-char (match-beginning 0)) - (setq c0 (current-column) p0 (if (equal (char-before) ?*) - (1+ (point)) (point)) - c1 (max (1+ c0) (if (> org-tags-column 0) - org-tags-column - (- (- org-tags-column) (length tags)))) + (setq c0 (current-column) + ;; compute offset for the case of org-indent-mode active + di (if org-indent-mode + (* (1- org-indent-indentation-per-level) (1- level)) + 0) + p0 (if (equal (char-before) ?*) (1+ (point)) (point)) + tc (+ org-tags-column (if (> org-tags-column 0) (- di) di)) + c1 (max (1+ c0) (if (> tc 0) tc (- (- tc) (length tags)))) rpl (concat (make-string (max 0 (- c1 c0)) ?\ ) tags))) (replace-match rpl t t) (and (not (featurep 'xemacs)) c0 indent-tabs-mode (tabify p0 (point))) |