[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: Inserting heading level and titile from first non-blank line
From: |
Heime |
Subject: |
Re: Inserting heading level and titile from first non-blank line |
Date: |
Fri, 29 Mar 2024 12:59:37 +0000 |
On Friday, March 29th, 2024 at 9:34 PM, Heime <heimeborgia@protonmail.com>
wrote:
> I am adding a heading with the following function using
> (outline-insert-heading).
> And want ta adapt it for a user to select the heading level. As the title, of
> the heading I want to use the first non-blank line that follows the position
> of the heading.
>
> (defun kinus ()
> (interactive)
> (outline-insert-heading))
Have added save-excursion, but the insertion still happens at the
end of the line match, rather than at point.
(defun kinus ()
(interactive)
(save-excursion
(forward-line)
(while (looking-at "^[[:space:]]*$") (forward-line))
(insert (buffer-substring
(line-beginning-position) (line-end-position))) ))