all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
From: Michael Heerdegen via Users list for the GNU Emacs text editor <help-gnu-emacs@gnu.org>
To: help-gnu-emacs@gnu.org
Subject: Re: Format with %-*
Date: Tue, 09 Jul 2024 10:59:10 +0200	[thread overview]
Message-ID: <87msmreyap.fsf@web.de> (raw)
In-Reply-To: ku24jC2qEuUlHupWmh_U-aZnQ-Q7fl5ftsKH6eL6hOfU-UKDpfUhlentaQxohvijsQo5xE1TP0WXn9xz235-YdOCdja0-PNSODK8K5CBQqU=@protonmail.com

Heime <heimeborgia@protonmail.com> writes:

> How can I construct a format that uses a space spx followed by a field
> of width 13
> into which I insert a label lbv2.

In Elisp we typically use `string-pad' and `truncate-string-to-width'.

It's also possible to add padding with `format' though - like in

(format "%10s" "test") -> "      test"

See `format' docstring.


Michael.




  parent reply	other threads:[~2024-07-09  8:59 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-07-08 16:07 Format with %-* Heime
2024-07-08 17:47 ` Bruno Barbier
2024-07-08 19:53   ` Heime
2024-07-09  8:07     ` Bruno Barbier
2024-07-09  8:59     ` Michael Heerdegen via Users list for the GNU Emacs text editor [this message]
2024-07-09 13:39       ` Emanuel Berg

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

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

  git send-email \
    --in-reply-to=87msmreyap.fsf@web.de \
    --to=help-gnu-emacs@gnu.org \
    --cc=michael_heerdegen@web.de \
    /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.
Code repositories for project(s) associated with this external index

	https://git.savannah.gnu.org/cgit/emacs.git
	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.