GNU bug report logs - #69822
[PATCH] format-spec pads when it should only truncate

Previous Next

Package: emacs;

Reported by: Adam Porter <adam <at> alphapapa.net>

Date: Sat, 16 Mar 2024 02:30:02 UTC

Severity: normal

Tags: patch

Done: Adam Porter <adam <at> alphapapa.net>

Bug is archived. No further changes may be made.

Full log


Message #8 received at 69822 <at> debbugs.gnu.org (full text, mbox):

From: Eli Zaretskii <eliz <at> gnu.org>
To: Adam Porter <adam <at> alphapapa.net>
Cc: 69822 <at> debbugs.gnu.org
Subject: Re: bug#69822: [PATCH] format-spec pads when it should only truncate
Date: Sat, 16 Mar 2024 12:22:26 +0200
> Date: Fri, 15 Mar 2024 21:28:15 -0500
> From: Adam Porter <adam <at> alphapapa.net>
> 
> 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.

I don't understand why you consider it a bug.  According to the doc
string (see below), this:

  (format-spec "%>15t" '((?t . "0123456789")))

should behave the same as this:

  (format "%15s" "0123456789")

And in my testing, it does: both produce "     0123456789".

So I don't think I agree that there's a bug here to begin with.  The
doc string of format-spec says:

  The width and truncation modifiers behave like the corresponding
  ones in ‘format’ when applied to %s.




This bug report was last modified 1 year and 56 days ago.

Previous Next


GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997,2003 nCipher Corporation Ltd, 1994-97 Ian Jackson.