mirror of
https://git.savannah.gnu.org/git/emacs/org-mode.git
synced 2024-08-22 09:48:28 +00:00
org.el (org-fixup-indentation): Correctly indent meta lines.
* org.el (org-fixup-indentation): Correctly indent meta lines. Thanks to Sébastien Vauban for reporting this.
This commit is contained in:
parent
74cca9f57e
commit
6b04befa48
43
lisp/org.el
43
lisp/org.el
|
@ -7352,20 +7352,38 @@ After top level, it switches back to sibling level."
|
|||
However, if any line in the current entry has no indentation, or if it
|
||||
would end up with no indentation after the change, nothing at all is done."
|
||||
(save-excursion
|
||||
(let ((end (save-excursion (outline-next-heading)
|
||||
(point-marker)))
|
||||
(prohibit (if (> diff 0)
|
||||
"^\\S-"
|
||||
(concat "^ \\{0," (int-to-string (- diff)) "\\}\\S-")))
|
||||
col)
|
||||
(unless (save-excursion (end-of-line 1)
|
||||
(re-search-forward prohibit end t))
|
||||
(while (and (< (point) end)
|
||||
(re-search-forward "^[ \t]+" end t))
|
||||
(let* ((end (save-excursion (outline-next-heading)
|
||||
(point-marker)))
|
||||
;; FIXME we should use `org-end-of-meta-data-and-drawers'
|
||||
;; here but it matches misplaced :END:...
|
||||
(drawer-end (save-excursion
|
||||
(and (re-search-forward
|
||||
org-property-end-re end t)
|
||||
(match-end 0))))
|
||||
(prohibit (if (> diff 0)
|
||||
"^\\S-"
|
||||
(concat "^ \\{0," (int-to-string (- diff)) "\\}\\S-")))
|
||||
col)
|
||||
(while (re-search-forward
|
||||
(concat "\\(" (regexp-opt org-all-time-keywords)
|
||||
"\\|" "^[ \t]*:[a-zA-Z][a-zA-Z0-9]*:.*$"
|
||||
"\\)") drawer-end t)
|
||||
(beginning-of-line)
|
||||
(when (looking-at "^[ \t]+")
|
||||
(goto-char (match-end 0))
|
||||
(setq col (current-column))
|
||||
(if (< diff 0) (replace-match ""))
|
||||
(org-indent-to-column (+ diff col))))
|
||||
(org-indent-to-column (+ diff col))
|
||||
(setq drawer-end (+ diff drawer-end)))
|
||||
(end-of-line))
|
||||
(unless (save-excursion (end-of-line 1)
|
||||
(re-search-forward prohibit end t))
|
||||
(while (and (< (point) end)
|
||||
(re-search-forward "^[ \t]+" end t))
|
||||
(goto-char (match-end 0))
|
||||
(setq col (current-column))
|
||||
(if (< diff 0) (replace-match ""))
|
||||
(org-indent-to-column (+ diff col))))
|
||||
(move-marker end nil))))
|
||||
|
||||
(defun org-convert-to-odd-levels ()
|
||||
|
@ -13690,7 +13708,7 @@ Being in this list makes sure that they are offered for completion.")
|
|||
|
||||
(defsubst org-re-property (property)
|
||||
"Return a regexp matching PROPERTY.
|
||||
Match group 1 will be set to the value "
|
||||
Match group 1 will be set to the value of the property."
|
||||
(concat "^[ \t]*:" (regexp-quote property) ":[ \t]*\\(\\S-.*\\)"))
|
||||
|
||||
(defun org-property-action ()
|
||||
|
@ -20278,6 +20296,7 @@ If there is no such heading, return nil."
|
|||
(unless (eobp) (backward-char 1)))
|
||||
ad-do-it))
|
||||
|
||||
;; FIXME This should not match :END: for custom drawers?
|
||||
(defun org-end-of-meta-data-and-drawers ()
|
||||
"Jump to the first text after meta data and drawers in the current entry.
|
||||
This will move over empty lines, lines with planning time stamps,
|
||||
|
|
Loading…
Reference in a new issue