unofficial mirror of bug-gnu-emacs@gnu.org 
 help / color / mirror / code / Atom feed
From: "Basil L. Contovounesios" <basil@contovou.net>
To: Adam Porter <adam@alphapapa.net>
Cc: 69822@debbugs.gnu.org
Subject: bug#69822: [PATCH] format-spec pads when it should only truncate
Date: Sat, 16 Mar 2024 11:35:16 +0100	[thread overview]
Message-ID: <87edcapiqj.fsf@epfl.ch> (raw)
In-Reply-To: <cc0e3544-d0df-405b-8646-1159a21d9274@alphapapa.net> (Adam Porter's message of "Fri, 15 Mar 2024 21:28:15 -0500")

Adam Porter [2024-03-15 21:28 -0500] wrote:

> Please see the attached patch which fixes a bug in `format-spec': that a format
> spec like "%>15t", which is intended to limit the width of a string to 15
> characters, would also pad a string less than that length to be that length.

In this format string, 15 is the 'width' (which controls padding), not
the 'precision' (which controls truncation).

To truncate beyond 15 without padding, specify a precision instead of a
width: "%>.15t".

So I'm not sure there's a bug here, or at least not the one you
describe.

What's not clear in the documentation is what happens when one specifies
< or > without an explicit precision, as in the example you give.  I'm
guessing this was the source of confusion here.  But I think this can be
addressed as a docfix.  Or am I missing something?

Thanks,
-- 
Basil





      parent reply	other threads:[~2024-03-16 10:35 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-03-16  2:28 bug#69822: [PATCH] format-spec pads when it should only truncate Adam Porter
2024-03-16 10:22 ` Eli Zaretskii
2024-03-17  4:12   ` Adam Porter
2024-03-17  6:23     ` Eli Zaretskii
2024-03-17 12:11       ` Basil L. Contovounesios
2024-03-18  1:16         ` Adam Porter
2024-03-21  9:52           ` Basil L. Contovounesios
2024-03-21 10:47             ` Adam Porter
2024-03-21 11:03               ` Basil L. Contovounesios
2024-03-23 13:59                 ` Adam Porter
2024-03-16 10:35 ` Basil L. Contovounesios [this message]

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=87edcapiqj.fsf@epfl.ch \
    --to=basil@contovou.net \
    --cc=69822@debbugs.gnu.org \
    --cc=adam@alphapapa.net \
    /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 public inbox

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

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