mirror of
https://git.savannah.gnu.org/git/emacs/org-mode.git
synced 2024-09-29 20:37:51 +00:00
Merge branch 'maint'
This commit is contained in:
commit
5bc540eae1
12
lisp/org.el
12
lisp/org.el
|
@ -22568,16 +22568,16 @@ ELEMENT."
|
|||
(org--get-expected-indentation element t))
|
||||
;; POS is after contents in a greater element. Indent like
|
||||
;; the beginning of the element.
|
||||
;;
|
||||
;; As a special case, if point is at the end of a footnote
|
||||
;; definition or an item, indent like the very last element
|
||||
;; within. If that last element is an item, indent like its
|
||||
;; contents.
|
||||
((and (not (eq type 'paragraph))
|
||||
((and (memq type org-element-greater-elements)
|
||||
(let ((cend (org-element-property :contents-end element)))
|
||||
(and cend (<= cend pos))))
|
||||
;; As a special case, if point is at the end of a footnote
|
||||
;; definition or an item, indent like the very last element
|
||||
;; within. If that last element is an item, indent like
|
||||
;; its contents.
|
||||
(if (memq type '(footnote-definition item plain-list))
|
||||
(let ((last (org-element-at-point)))
|
||||
(goto-char pos)
|
||||
(org--get-expected-indentation
|
||||
last (eq (org-element-type last) 'item)))
|
||||
(goto-char start)
|
||||
|
|
|
@ -783,27 +783,31 @@
|
|||
(org-test-with-temp-text "- A\n B\n\n<point>"
|
||||
(let ((org-adapt-indentation nil)) (org-indent-line))
|
||||
(org-get-indentation))))
|
||||
(should
|
||||
(= 2
|
||||
(org-test-with-temp-text
|
||||
"- A\n \begin{cases} 1 + 1\n \end{cases}\n\n<point>"
|
||||
(let ((org-adapt-indentation nil)) (org-indent-line))
|
||||
(org-get-indentation))))
|
||||
;; Likewise, on a blank line at the end of a footnote definition,
|
||||
;; indent at column 0 if line belongs to the definition. Otherwise,
|
||||
;; indent like the definition itself.
|
||||
(should
|
||||
(zerop
|
||||
(org-test-with-temp-text "* H\n[fn:1] Definition\n"
|
||||
(goto-char (point-max))
|
||||
(org-test-with-temp-text "* H\n[fn:1] Definition\n<point>"
|
||||
(let ((org-adapt-indentation t)) (org-indent-line))
|
||||
(org-get-indentation))))
|
||||
(should
|
||||
(zerop
|
||||
(org-test-with-temp-text "* H\n[fn:1] Definition\n\n\n\n"
|
||||
(goto-char (point-max))
|
||||
(org-test-with-temp-text "* H\n[fn:1] Definition\n\n\n\n<point>"
|
||||
(let ((org-adapt-indentation t)) (org-indent-line))
|
||||
(org-get-indentation))))
|
||||
;; After the end of the contents of a greater element, indent like
|
||||
;; the beginning of the element.
|
||||
(should
|
||||
(= 1
|
||||
(org-test-with-temp-text " #+BEGIN_CENTER\n Contents\n#+END_CENTER"
|
||||
(forward-line 2)
|
||||
(org-test-with-temp-text
|
||||
" #+BEGIN_CENTER\n Contents\n<point>#+END_CENTER"
|
||||
(org-indent-line)
|
||||
(org-get-indentation))))
|
||||
;; On blank lines after a paragraph, indent like its last non-empty
|
||||
|
@ -818,20 +822,18 @@
|
|||
;; according to parent.
|
||||
(should
|
||||
(= 2
|
||||
(org-test-with-temp-text "A\n\n B\n\nC"
|
||||
(goto-char (point-max))
|
||||
(org-test-with-temp-text "A\n\n B\n\nC<point>"
|
||||
(org-indent-line)
|
||||
(org-get-indentation))))
|
||||
(should
|
||||
(= 1
|
||||
(org-test-with-temp-text " A\n\n[fn:1] B\n\n\nC"
|
||||
(goto-char (point-max))
|
||||
(org-test-with-temp-text " A\n\n[fn:1] B\n\n\nC<point>"
|
||||
(org-indent-line)
|
||||
(org-get-indentation))))
|
||||
(should
|
||||
(= 1
|
||||
(org-test-with-temp-text " #+BEGIN_CENTER\n Contents\n#+END_CENTER"
|
||||
(forward-line 1)
|
||||
(org-test-with-temp-text
|
||||
" #+BEGIN_CENTER\n<point> Contents\n#+END_CENTER"
|
||||
(org-indent-line)
|
||||
(org-get-indentation))))
|
||||
;; Within code part of a source block, use language major mode if
|
||||
|
@ -839,16 +841,16 @@
|
|||
;; according to line above.
|
||||
(should
|
||||
(= 6
|
||||
(org-test-with-temp-text "#+BEGIN_SRC emacs-lisp\n (and A\nB)\n#+END_SRC"
|
||||
(forward-line 2)
|
||||
(org-test-with-temp-text
|
||||
"#+BEGIN_SRC emacs-lisp\n (and A\n<point>B)\n#+END_SRC"
|
||||
(let ((org-src-tab-acts-natively t)
|
||||
(org-edit-src-content-indentation 0))
|
||||
(org-indent-line))
|
||||
(org-get-indentation))))
|
||||
(should
|
||||
(= 1
|
||||
(org-test-with-temp-text "#+BEGIN_SRC emacs-lisp\n (and A\nB)\n#+END_SRC"
|
||||
(forward-line 2)
|
||||
(org-test-with-temp-text
|
||||
"#+BEGIN_SRC emacs-lisp\n (and A\n<point>B)\n#+END_SRC"
|
||||
(let ((org-src-tab-acts-natively nil)
|
||||
(org-edit-src-content-indentation 0))
|
||||
(org-indent-line))
|
||||
|
@ -856,15 +858,16 @@
|
|||
;; Otherwise, indent like the first non-blank line above.
|
||||
(should
|
||||
(zerop
|
||||
(org-test-with-temp-text "#+BEGIN_CENTER\nline1\n\n line2\n#+END_CENTER"
|
||||
(forward-line 3)
|
||||
(org-test-with-temp-text
|
||||
"#+BEGIN_CENTER\nline1\n\n<point> line2\n#+END_CENTER"
|
||||
(org-indent-line)
|
||||
(org-get-indentation))))
|
||||
;; Align node properties according to `org-property-format'. Handle
|
||||
;; nicely empty values.
|
||||
(should
|
||||
(equal "* H\n:PROPERTIES:\n:key: value\n:END:"
|
||||
(org-test-with-temp-text "* H\n:PROPERTIES:\n<point>:key: value\n:END:"
|
||||
(org-test-with-temp-text
|
||||
"* H\n:PROPERTIES:\n<point>:key: value\n:END:"
|
||||
(let ((org-property-format "%-10s %s")) (org-indent-line))
|
||||
(buffer-string))))
|
||||
(should
|
||||
|
|
Loading…
Reference in a new issue