Function: outline-invent-heading
outline-invent-heading is a byte-compiled function defined in
outline.el.gz.
Signature
(outline-invent-heading HEAD UP)
Documentation
Create a heading by using heading HEAD as a template.
When UP is non-nil, the created heading will be one level above. Otherwise, it will be one level below.
Source Code
;; Defined in /usr/src/emacs/lisp/outline.el.gz
(defun outline-invent-heading (head up)
"Create a heading by using heading HEAD as a template.
When UP is non-nil, the created heading will be one level above.
Otherwise, it will be one level below."
(save-match-data
;; Let's try to invent one by repeating or deleting the last char.
(let ((new-head (if up (substring head 0 -1)
(concat head (substring head -1)))))
(if (string-match (concat "\\`\\(?:" outline-regexp "\\)")
new-head)
;; Why bother checking that it is indeed higher/lower level ?
new-head
;; Didn't work, so ask what to do.
(read-string (format-message "%s heading for `%s': "
(if up "Parent" "Demoted") head)
head nil nil t)))))