Merge branch 'maint'

This commit is contained in:
Kyle Meyer 2020-12-08 23:50:56 -05:00
commit 3e39f82cd4
2 changed files with 66 additions and 4 deletions

View file

@ -7396,10 +7396,11 @@ Assume point is at a heading or an inlinetask beginning."
(org-indent-region (match-beginning 0) (match-end 0)))
(when (looking-at org-logbook-drawer-re)
(let ((end-marker (move-marker (make-marker) (match-end 0)))
(ci (current-indentation)))
(while (and (not (> (point) end-marker)) (>= ci diff))
(indent-line-to (+ ci diff))
(forward-line))))
(col (+ (current-indentation) diff)))
(when (wholenump col)
(while (< (point) end-marker)
(indent-line-to col)
(forward-line)))))
(catch 'no-shift
(when (or (zerop diff) (not (eq org-adapt-indentation t)))
(throw 'no-shift nil))

View file

@ -4710,6 +4710,32 @@ Text.
(org-demote)
(forward-line 2)
(org-get-indentation))))))
;; When `org-adapt-indentation' is non-nil, log drawers are
;; adjusted.
(should
(equal
"** H\n :LOGBOOK:\n - a\n :END:\n b"
(org-test-with-temp-text "* H\n :LOGBOOK:\n - a\n :END:\n b"
(let ((org-odd-levels-only nil)
(org-adapt-indentation t))
(org-demote))
(buffer-string))))
(should
(equal
"** H\n :LOGBOOK:\n - a\n :END:\n b"
(org-test-with-temp-text "* H\n :LOGBOOK:\n - a\n :END:\n b"
(let ((org-odd-levels-only nil)
(org-adapt-indentation 'headline-data))
(org-demote))
(buffer-string))))
(should
(equal
"** H\n :LOGBOOK:\n - a\n :END:"
(org-test-with-temp-text "* H\n:LOGBOOK:\n- a\n:END:"
(let ((org-odd-levels-only nil)
(org-adapt-indentation t))
(org-demote))
(buffer-string))))
;; Ignore contents of source blocks or example blocks when
;; indentation should be preserved (through
;; `org-src-preserve-indentation' or "-i" flag).
@ -4878,6 +4904,41 @@ Text.
(org-promote))
(forward-line)
(org-get-indentation))))
;; When `org-adapt-indentation' is non-nil, log drawers are
;; adjusted.
(should
(equal
"* H\n :LOGBOOK:\n - a\n :END:\n b"
(org-test-with-temp-text "** H\n :LOGBOOK:\n - a\n :END:\n b"
(let ((org-odd-levels-only nil)
(org-adapt-indentation t))
(org-promote))
(buffer-string))))
(should
(equal
"* H\n :LOGBOOK:\n - a\n :END:\n b"
(org-test-with-temp-text "** H\n :LOGBOOK:\n - a\n :END:\n b"
(let ((org-odd-levels-only nil)
(org-adapt-indentation 'headline-data))
(org-promote))
(buffer-string))))
(should
(equal
"* H\n:LOGBOOK:\n- a\n:END:"
(org-test-with-temp-text "** H\n:LOGBOOK:\n- a\n:END:"
(let ((org-odd-levels-only nil)
(org-adapt-indentation t))
(org-promote))
(buffer-string))))
(should
(equal
"# H\n:LOGBOOK:\n- a\n:END:"
(org-test-with-temp-text "* H\n:LOGBOOK:\n- a\n:END:"
(let ((org-odd-levels-only nil)
(org-allow-promoting-top-level-subtree t)
(org-adapt-indentation t))
(org-promote))
(buffer-string))))
;; Ignore contents of source blocks or example blocks when
;; indentation should be preserved (through
;; `org-src-preserve-indentation' or "-i" flag).