summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorNicolas Goaziou <mail@nicolasgoaziou.fr>2016-10-19 22:52:58 +0200
committerNicolas Goaziou <mail@nicolasgoaziou.fr>2018-01-10 15:58:21 +0100
commitd30bea7cee4f54cbc5ad9075be8584ac5252b6a7 (patch)
treef71e3184c24bacc4dd76b743aadefe4d0f35f7a7
parent4403d4685e19fb99ba9bfec2bd4ff6781c66981f (diff)
downloadorg-mode-d30bea7cee4f54cbc5ad9075be8584ac5252b6a7.tar.gz
Fold CLOCK and LOGBOOK drawers upon creating them
* lisp/org-clock.el (org-clock-find-position): Use a faster call to hide clock drawer. * lisp/org.el (org-log-beginning): Make sure logbook drawer is folded as soon as inserted. (org-store-log-note): Remove unnecessary call to `org-cycle-hide-drawers'.
-rw-r--r--lisp/org-clock.el8
-rw-r--r--lisp/org.el7
2 files changed, 8 insertions, 7 deletions
diff --git a/lisp/org-clock.el b/lisp/org-clock.el
index ed8f118..26e102a 100644
--- a/lisp/org-clock.el
+++ b/lisp/org-clock.el
@@ -1531,9 +1531,9 @@ line and position cursor in that line."
(let ((beg (point)))
(insert ":" drawer ":\n:END:\n")
(org-indent-region beg (point))
- (goto-char beg)
- (org-flag-drawer t)
- (forward-line))))
+ (org-flag-region
+ (line-end-position -1) (1- (point)) t 'org-hide-drawer)
+ (forward-line -1))))
;; When a clock drawer needs to be created because of the
;; number of clock items or simply if it is missing, collect
;; all clocks in the section and wrap them within the drawer.
@@ -1557,7 +1557,7 @@ line and position cursor in that line."
(let ((end (point-marker)))
(goto-char beg)
(save-excursion (insert ":" drawer ":\n"))
- (org-flag-drawer t)
+ (org-flag-region (line-end-position) (1- end) t 'org-hide-drawer)
(org-indent-region (point) end)
(forward-line)
(unless org-log-states-order-reversed
diff --git a/lisp/org.el b/lisp/org.el
index d9fa9a1..9d76484 100644
--- a/lisp/org.el
+++ b/lisp/org.el
@@ -12918,7 +12918,9 @@ narrowing."
(unless (bolp) (insert "\n"))
(let ((beg (point)))
(insert ":" drawer ":\n:END:\n")
- (org-indent-region beg (point)))
+ (org-indent-region beg (point))
+ (org-flag-region
+ (line-end-position -1) (1- (point)) t 'org-hide-drawer))
(end-of-line -1)))))
(t
(org-end-of-meta-data org-log-state-notes-insert-after-drawers)
@@ -13084,8 +13086,7 @@ EXTRA is additional text that will be inserted into the notes buffer."
(indent-line-to ind)
(insert line)))
(message "Note stored")
- (org-back-to-heading t)
- (org-cycle-hide-drawers 'children))
+ (org-back-to-heading t))
;; Fix `buffer-undo-list' when `org-store-log-note' is called
;; from within `org-add-log-note' because `buffer-undo-list'
;; is then modified outside of `org-with-remote-undo'.