Bläddra i källkod

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'.
Nicolas Goaziou 8 år sedan
förälder
incheckning
d30bea7cee
2 ändrade filer med 8 tillägg och 7 borttagningar
  1. 4 4
      lisp/org-clock.el
  2. 4 3
      lisp/org.el

+ 4 - 4
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

+ 4 - 3
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'.