From 89e67b136839bedb5af912cfc9b6f684a7efca99 Mon Sep 17 00:00:00 2001 From: Carsten Dominik Date: Sun, 27 Apr 2008 07:39:53 +0200 Subject: [PATCH] Fixed bug with tag-alignment when inserting text before the tags. It could happen that the tags then moved into the invisible part of the line. Fixed now. --- lisp/org.el | 28 ++++++++++++++-------------- 1 file changed, 14 insertions(+), 14 deletions(-) diff --git a/lisp/org.el b/lisp/org.el index 2c670abbf..b18952834 100644 --- a/lisp/org.el +++ b/lisp/org.el @@ -1711,7 +1711,7 @@ displaying the tags menu is not even shown, until you press C-c again." "Non-nil means, fast tags selection interface will also offer TODO states. This is an undocumented feature, you should not rely on it.") -(defcustom org-tags-column -80 +(defcustom org-tags-column (if (featurep 'xemacs) -79 -80) "The column to which tags should be indented in a headline. If this number is positive, it specifies the column. If it is negative, it means that the tags should be flushright to that column. For example, @@ -8954,25 +8954,25 @@ If ONOFF is `on' or `off', don't toggle but set to this state." (defun org-align-tags-here (to-col) ;; Assumes that this is a headline - (let ((pos (point)) (col (current-column)) tags) + (let ((pos (point)) (col (current-column)) ncol tags-l p) (beginning-of-line 1) (if (and (looking-at (org-re ".*?\\([ \t]+\\)\\(:[[:alnum:]_@:]+:\\)[ \t]*$")) (< pos (match-beginning 2))) (progn - (setq tags (match-string 2)) + (setq tags-l (- (match-end 2) (match-beginning 2))) (goto-char (match-beginning 1)) (insert " ") - (delete-region (point) (1+ (match-end 0))) - (backward-char 1) - (org-move-to-column - (max (1+ (current-column)) - (1+ col) - (if (> to-col 0) - to-col - (- (abs to-col) (length tags)))) - t) - (insert tags) - (org-move-to-column (min (current-column) col) t)) + (delete-region (point) (1+ (match-beginning 2))) + (setq ncol (max (1+ (current-column)) + (1+ col) + (if (> to-col 0) + to-col + (- (abs to-col) tags-l)))) + (setq p (point)) + (insert (make-string (- ncol (current-column)) ?\ )) + (setq ncol (current-column)) + (tabify p (point-at-eol)) + (org-move-to-column (min ncol col) t)) (goto-char pos)))) (defun org-set-tags (&optional arg just-align) -- 2.11.4.GIT