Merge branch 'master' into next

This commit is contained in:
Nicolas Goaziou 2018-11-27 23:23:09 +01:00
commit 776679ee0a
1 changed files with 17 additions and 14 deletions

View File

@ -7488,22 +7488,25 @@ unconditionally."
(member arg '((4) (16))) (member arg '((4) (16)))
(and (not invisible-ok) (and (not invisible-ok)
(invisible-p (max (1- (point)) (point-min))))) (invisible-p (max (1- (point)) (point-min)))))
;; Position point at the location of insertion. ;; Position point at the location of insertion. Make sure we
(if (not level) ;before first headline ;; end up on a visible headline if INVISIBLE-OK is nil.
(org-with-limited-levels (outline-next-heading)) (org-with-limited-levels
;; Make sure we end up on a visible headline if INVISIBLE-OK (if (not level) (outline-next-heading) ;before first headline
;; is nil. (org-back-to-heading invisible-ok)
(org-with-limited-levels (org-back-to-heading invisible-ok)) (when (equal arg '(16)) (org-up-heading-safe))
(cond ((equal arg '(16)) (org-end-of-subtree)))
(org-up-heading-safe) (unless (bolp) (insert "\n"))
(org-end-of-subtree t t))
(t
(org-end-of-subtree t t))))
(unless (bolp) (insert "\n")) ;ensure final newline
(unless (and blank? (org-previous-line-empty-p)) (unless (and blank? (org-previous-line-empty-p))
(org-N-empty-lines-before-current (if blank? 1 0))) (org-N-empty-lines-before-current (if blank? 1 0)))
(insert stars " \n") (insert stars " ")
(forward-char -1)) (when (eobp) (save-excursion (insert "\n")))
;; When INVISIBLE-OK is non-nil, ensure newly created headline
;; is visible.
(unless invisible-ok
(pcase (get-char-property-and-overlay (point) 'invisible)
(`(outline . ,o)
(move-overlay o (overlay-start o) (line-end-position 0)))
(_ nil))))
;; At a headline... ;; At a headline...
((org-at-heading-p) ((org-at-heading-p)
(cond ((bolp) (cond ((bolp)