summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorNicolas Goaziou <n.goaziou@gmail.com>2010-09-09 15:19:53 +0200
committerDavid Maus <dmaus@ictsoc.de>2010-09-09 19:24:46 +0200
commit06c332cfee2bdfb6c30ac0a016ce643c4da7e0a5 (patch)
tree7d13a68d98552e4e9bf37e2651b5698aa5d27343
parent9209139d1e0d4499fe86815fa79758fdf07dc9a0 (diff)
downloadorg-mode-06c332cfee2bdfb6c30ac0a016ce643c4da7e0a5.tar.gz
Fix notes indentation
* org.el (org-store-log-note): Indent new notes to the right column. Also take `org-list-two-spaces-after-bullet-regexp' into consideration when creating the note.
-rw-r--r--lisp/org.el29
1 files changed, 21 insertions, 8 deletions
diff --git a/lisp/org.el b/lisp/org.el
index dfd6d79..95d1f31 100644
--- a/lisp/org.el
+++ b/lisp/org.el
@@ -11823,7 +11823,7 @@ EXTRA is additional text that will be inserted into the notes buffer."
"Finish taking a log note, and insert it to where it belongs."
(let ((txt (buffer-string))
(note (cdr (assq org-log-note-purpose org-log-note-headings)))
- lines ind)
+ lines ind bul)
(kill-buffer (current-buffer))
(while (string-match "\\`#.*\n[ \t\n]*" txt)
(setq txt (replace-match "" t t txt)))
@@ -11863,13 +11863,26 @@ EXTRA is additional text that will be inserted into the notes buffer."
(move-marker org-log-note-marker nil)
(end-of-line 1)
(if (not (bolp)) (let ((inhibit-read-only t)) (insert "\n")))
- (org-indent-line-function)
- (insert "- " (pop lines))
- (beginning-of-line 1)
- (looking-at "[ \t]*")
- (setq ind (concat (match-string 0) " "))
- (end-of-line 1)
- (while lines (insert "\n" ind (pop lines)))
+ (setq ind (save-excursion
+ (if (org-in-item-p)
+ (progn
+ (goto-char (org-list-top-point))
+ (org-get-indentation))
+ (skip-chars-backward " \r\t\n")
+ (cond
+ ((and (org-at-heading-p)
+ (org-adapt-indentation))
+ (1+ (org-current-level)))
+ ((org-at-heading-p) 0)
+ (t (org-get-indentation))))))
+ (setq bul (org-list-bullet-string "-"))
+ (org-indent-line-to ind)
+ (insert bul (pop lines))
+ (let ((ind-body (+ (length bul) ind)))
+ (while lines
+ (insert "\n")
+ (org-indent-line-to ind-body)
+ (insert (pop lines))))
(message "Note stored")
(org-back-to-heading t)
(org-cycle-hide-drawers 'children)))))