diff options
author | Oleh Krehel <ohwoeowho@gmail.com> | 2015-07-28 15:16:49 +0200 |
---|---|---|
committer | Oleh Krehel <ohwoeowho@gmail.com> | 2015-07-28 15:16:49 +0200 |
commit | 00142f4edf35c6ff28528f8a1772aff6ac27bbfc (patch) | |
tree | 4f1eae70c7ec1c09eabf53e381880483de5b52be | |
parent | ceae5d651b80295f35c01ecfc53661c7e8eceba7 (diff) | |
download | org-mode-00142f4edf35c6ff28528f8a1772aff6ac27bbfc.tar.gz |
lisp/org.el (org-set-tags): Simplify further
* lisp/org.el (org-set-tags): Use let* for c0 p0 c1 rpl di tc;
Restructure so that no check on c0 is needed; Don't return a useless
tags var from cond; Change and into an equivalent when.
-rwxr-xr-x | lisp/org.el | 36 |
1 files changed, 21 insertions, 15 deletions
diff --git a/lisp/org.el b/lisp/org.el index 0e06595..4703536 100755 --- a/lisp/org.el +++ b/lisp/org.el @@ -14985,22 +14985,28 @@ When JUST-ALIGN is non-nil, only align tags." ((re-search-forward (concat "\\([ \t]*" (regexp-quote current) "\\)[ \t]*$") (point-at-eol) t) - (let (c0 p0 c1 rpl di tc) - (if (equal tags "") - (setq rpl "") - (goto-char (match-beginning 0)) - (setq c0 (current-column) - ;; compute offset for the case of org-indent-mode active - di (if (org-bound-and-true-p org-indent-mode) + (if (equal tags "") + (replace-match "" t t) + (goto-char (match-beginning 0)) + (let* ((c0 (current-column)) + ;; compute offset for the case of org-indent-mode active + (di (if (org-bound-and-true-p 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) (string-width 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))) - tags)) + 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) (string-width tags))))) + (rpl (concat (make-string (max 0 (- c1 c0)) ?\ ) tags))) + (replace-match rpl t t) + (when (and (not (featurep 'xemacs)) indent-tabs-mode) + (tabify p0 (point)))))) (t (error "Tags alignment failed"))) (org-move-to-column col) (unless just-align |