diff --git a/doc/org-manual.org b/doc/org-manual.org index e542bf7b2..96fa3157a 100644 --- a/doc/org-manual.org +++ b/doc/org-manual.org @@ -11660,6 +11660,7 @@ neither checks for valid syntax nor changes the contents in any way. For example and source blocks, Org code-escapes the contents before inclusion. +#+cindex: @samp{minlevel}, include If an included file is not specified as having any markup language, Org assumes it be in Org format and proceeds as usual with a few exceptions. Org makes the footnote labels (see [[*Creating Footnotes]]) @@ -11674,6 +11675,7 @@ top-level headline: : #+INCLUDE: "~/my-book/chapter2.org" :minlevel 1 +#+cindex: @samp{lines}, include Inclusion of only portions of files are specified using ranges parameter with =:lines= keyword. The line at the upper end of the range will not be included. The start and/or the end of the range may @@ -11693,6 +11695,7 @@ Therefore, #+texinfo: @noindent includes the first 20 lines of the headline named =conclusion=. +#+cindex: @samp{only-contents}, include To extract only the contents of the matched object, set =:only-contents= property to non-~nil~. This omits any planning lines or property drawers. For example, to include the body of the heading diff --git a/lisp/org.el b/lisp/org.el index 191a16868..3d66bf76d 100644 --- a/lisp/org.el +++ b/lisp/org.el @@ -8209,12 +8209,10 @@ When REMOVE is non-nil, remove the subtree from the clipboard." (force-level (cond (level (prefix-numeric-value level)) - ;; When point is right after the stars in an otherwise - ;; empty headline, use stars as the forced level. - ((and (looking-at-p "[ \t]*$") - (string-match-p "^\\*+ *" - (buffer-substring (line-beginning-position) - (point)))) + ;; When point is after the stars in an otherwise empty + ;; headline, use the number of stars as the forced level. + ((and (org-match-line "^\\*+[ \t]*$") + (not (eq ?* (char-after)))) (org-outline-level)) ((looking-at-p org-outline-regexp-bol) (org-outline-level)))) (previous-level