Bastien Guerry 3 лет назад
Родитель
Сommit
bd10c31e70
1 измененных файлов с 13 добавлено и 2 удалено
  1. 13 2
      lisp/org.el

+ 13 - 2
lisp/org.el

@@ -7424,7 +7424,9 @@ Assume point is at a heading or an inlinetask beginning."
 	   (col (+ (current-indentation) diff)))
        (when (wholenump col)
 	 (while (< (point) end-marker)
-	   (indent-line-to col)
+           (if (natnump diff)
+	       (insert (make-string diff 32))
+             (delete-char (abs diff)))
 	   (forward-line)))))
    (catch 'no-shift
      (when (or (zerop diff) (not (eq org-adapt-indentation t)))
@@ -18881,7 +18883,16 @@ ELEMENT."
 	  (current-indentation))))
       ((and
 	(eq org-adapt-indentation 'headline-data)
-	(memq type '(planning clock node-property property-drawer drawer)))
+        (or (memq type '(planning clock node-property property-drawer drawer))
+            ;; FIXME: when storing a note in a LOGBOOK drawer,
+            ;; `org-store-log-note' needs to insert a new line before
+            ;; the newly inserted note, thus the `type' at point will
+            ;; return `paragraph' instead of the expected `drawer', so
+            ;; we need to manually detect the drawer.
+            (and (looking-at-p "^$")
+                 (save-excursion
+                   (backward-char)
+                   (looking-back org-drawer-regexp (point-at-bol))))))
        (org--get-expected-indentation
 	(org-element-property :parent element) t))
       ((memq type '(headline inlinetask nil))