unofficial mirror of help-gnu-emacs@gnu.org
 help / color / mirror / Atom feed
From: tpeplt <tpeplt@gmail.com>
To: Heime <heimeborgia@protonmail.com>
Cc: Heime via Users list for the GNU Emacs text editor
	<help-gnu-emacs@gnu.org>
Subject: Re: Commands to insert a heading and a new page
Date: Wed, 27 Mar 2024 18:48:24 -0400	[thread overview]
Message-ID: <87le63fg07.fsf@gmail.com> (raw)
In-Reply-To: <4WUuQL20YTsYDAkZrAEn-bQhNMGdVJVvGstbcI3F-ubHqcgctXVdEryoO7rgjvU51mk_uwxQYtCjS89ffdnVD6-dQd8wvE7kem231VD-a6s=@protonmail.com> (Heime's message of "Tue, 26 Mar 2024 09:16:17 +0000")

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	other threads:[~2024-03-27 22:48 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-03-26  9:16 Commands to insert a heading and a new page Heime
2024-03-27 22:48 ` tpeplt [this message]
2024-03-28  3:12   ` Emanuel Berg
2024-03-31 15:49     ` [External] : " Drew Adams
2024-03-31 18:40       ` tpeplt
2024-03-31 20:32         ` Drew Adams
2024-04-01  2:07           ` Emanuel Berg
2024-04-01 16:53             ` Drew Adams
2024-04-01  1:20       ` Emanuel Berg
2024-03-28  9:42   ` Heime

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://www.gnu.org/software/emacs/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=87le63fg07.fsf@gmail.com \
    --to=tpeplt@gmail.com \
    --cc=heimeborgia@protonmail.com \
    --cc=help-gnu-emacs@gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).