help-gnu-emacs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Commands to insert a heading and a new page


From: Heime
Subject: Re: Commands to insert a heading and a new page
Date: Thu, 28 Mar 2024 09:42:29 +0000





Sent with Proton Mail secure email.

On Thursday, March 28th, 2024 at 10:48 AM, tpeplt <tpeplt@gmail.com> wrote:

> Heime heimeborgia@protonmail.com writes:
> 
> > I would like to have two commands, one to insert a heading, the other to
> > insert a new page in a buffer. So I can easily traverse the code in a 
> > buffer.
> 
> 
> The Emacs function ‘insert’ inserts text into the current buffer:
> 
> (insert &rest ARGS)
> 
> Insert the arguments, either strings or characters, at point.
> 
> A simple function to insert a form-feed character:
> 
> (defun new-page ()
> "Insert a page separator into the current buffer."
> (interactive)
> (newline)
> (insert ?\f) ;Form feed is \f or Ctrl-l or ASCII 012
> (newline))

That does the job.
 
> ‘insert’ accepts either characters or strings, so it could be used to
> define a command that inserts whatever text you want in a heading.
> 
> (newline)
> (insert "Header line 1\n")
> (insert "Line 2\n")
> (insert (format "Parameter is %s.\n" parm))
> 
> --



reply via email to

[Prev in Thread] Current Thread [Next in Thread]