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: tpeplt
Subject: Re: Commands to insert a heading and a new page
Date: Wed, 27 Mar 2024 18:48:24 -0400
User-agent: Gnus/5.13 (Gnus v5.13)

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))

‘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]