GNU bug report logs - #12777
24.2; Please support '$' in format specifications

Previous Next

Package: emacs;

Reported by: Ivan Vilata i Balaguer <ivan <at> selidor.net>

Date: Thu, 1 Nov 2012 13:16:02 UTC

Severity: wishlist

Tags: fixed

Found in version 24.2

Fixed in version 26.1

Done: npostavs <at> users.sourceforge.net

Bug is archived. No further changes may be made.

To add a comment to this bug, you must first unarchive it, by sending
a message to control AT debbugs.gnu.org, with unarchive 12777 in the body.
You can then email your comments to 12777 AT debbugs.gnu.org in the normal way.

Toggle the display of automated, internal messages from the tracker.

View this report as an mbox folder, status mbox, maintainer mbox


Report forwarded to bug-gnu-emacs <at> gnu.org:
bug#12777; Package emacs. (Thu, 01 Nov 2012 13:16:02 GMT) Full text and rfc822 format available.

Acknowledgement sent to Ivan Vilata i Balaguer <ivan <at> selidor.net>:
New bug report received and forwarded. Copy sent to bug-gnu-emacs <at> gnu.org. (Thu, 01 Nov 2012 13:16:02 GMT) Full text and rfc822 format available.

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

From: Ivan Vilata i Balaguer <ivan <at> selidor.net>
To: bug-gnu-emacs <at> gnu.org
Subject: 24.2; Please support '$' in format specifications
Date: Thu, 01 Nov 2012 14:12:59 +0100
Hello!  It'd be nice if the "format" function allowed "%m$"
specifications (as long supported by glibc) so that arguments can be
formatted in a different order than they were provided to the function.

- It's very useful for translating format strings, e.g:

      (format "%d %s-%s" 2 "1KiB" "blocks") -> "2 1KiB-blocks"
      v    some string translation...
      (format "%1$d %3$s de %2$d" 2 "1KiB" "bloques") -> "2 bloques de 1KiB"

- It allows more flexible conversions for simple exporting templates.
  For instance Org mode passes an hyperlink URL and text through a
  customizable LaTeX format string like "\\href{%s}{%s}".  Producing
  footnotes instead would be as simple as setting the format string to
  "%2$s\\footnote{%1$s}".  Currently it's impossible to place the text
  before the URL.

Thank you very much.


In GNU Emacs 24.2.1 (powerpc-unknown-linux-gnu, GTK+ Version 2.24.10)
 of 2012-09-09 on praetorius, modified by Debian
Windowing system distributor `The X.Org Foundation', version 11.0.11204000
Configured using:
 `configure '--build' 'powerpc-linux-gnu' '--build' 'powerpc-linux-gnu'
 '--prefix=/usr' '--sharedstatedir=/var/lib' '--libexecdir=/usr/lib'
 '--localstatedir=/var/lib' '--infodir=/usr/share/info'
 '--mandir=/usr/share/man' '--with-pop=yes'
 '--enable-locallisppath=/etc/emacs24:/etc/emacs:/usr/local/share/emacs/24.2/site-lisp:/usr/local/share/emacs/site-lisp:/usr/share/emacs/24.2/site-lisp:/usr/share/emacs/site-lisp'
 '--with-crt-dir=/usr/lib/powerpc-linux-gnu' '--with-x=yes'
 '--with-x-toolkit=gtk' '--with-toolkit-scroll-bars'
 'build_alias=powerpc-linux-gnu' 'CFLAGS=-g -O2 -fstack-protector
 --param=ssp-buffer-size=4 -Wformat -Werror=format-security -Wall'
 'CPPFLAGS=-D_FORTIFY_SOURCE=2''

Important settings:
  value of $LC_ALL: nil
  value of $LC_COLLATE: nil
  value of $LC_CTYPE: nil
  value of $LC_MESSAGES: nil
  value of $LC_MONETARY: nil
  value of $LC_NUMERIC: nil
  value of $LC_TIME: nil
  value of $LANG: ca_ES.UTF-8
  value of $XMODIFIERS: nil
  locale-coding-system: utf-8-unix
  default enable-multibyte-characters: t

-- 
Ivan Vilata i Balaguer -- https://elvil.net/




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#12777; Package emacs. (Wed, 14 Jun 2017 00:45:02 GMT) Full text and rfc822 format available.

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

From: npostavs <at> users.sourceforge.net
To: Ivan Vilata i Balaguer <ivan <at> selidor.net>
Cc: 12777 <at> debbugs.gnu.org
Subject: Re: bug#12777: 24.2; Please support '$' in format specifications
Date: Tue, 13 Jun 2017 20:45:53 -0400
tags 12777 fixed
close 12777 26.1
quit

Ivan Vilata i Balaguer <ivan <at> selidor.net> writes:

> Hello!  It'd be nice if the "format" function allowed "%m$"
> specifications (as long supported by glibc) so that arguments can be
> formatted in a different order than they were provided to the function.
>
> - It's very useful for translating format strings, e.g:
>
>       (format "%d %s-%s" 2 "1KiB" "blocks") -> "2 1KiB-blocks"
>       v    some string translation...
>       (format "%1$d %3$s de %2$d" 2 "1KiB" "bloques") -> "2 bloques de 1KiB"

This is now implemented in master.

http://lists.gnu.org/archive/html/emacs-devel/2017-05/msg00901.html
http://lists.gnu.org/archive/html/emacs-devel/2017-06/msg00000.html

[1: 0dd1bbb0bb]: 2017-06-02 00:22:13 +0200
  Implement field numbers in format strings
  http://git.savannah.gnu.org/cgit/emacs.git/commit/?id=0dd1bbb0bb228acab21b8e16f2f2a0b5a17b19ab

[2: 5324710841]: 2017-06-02 00:25:48 +0200
  Minor improvements to format field numbers
  http://git.savannah.gnu.org/cgit/emacs.git/commit/?id=53247108411a1e9d1aa5352c231fa049f3f918aa

[3: 8de2581a64]: 2017-06-01 16:06:38 -0700
  Limit format fields to more POSIX-like spec
  http://git.savannah.gnu.org/cgit/emacs.git/commit/?id=8de2581a64dac3785fc3877f7cd87c4164fd2936

[4: 0147cdd4d9]: 2017-06-03 01:31:52 -0700
  Document uniqueness limitation of ‘format’
  http://git.savannah.gnu.org/cgit/emacs.git/commit/?id=0147cdd4d96f1eaeef720ee0b89bddd27eaf4233

[5: 7d413cb4da]: 2017-06-03 11:19:02 +0200
  Fix a bug when using format field numbers
  http://git.savannah.gnu.org/cgit/emacs.git/commit/?id=7d413cb4da89e0bdd70068e6a5e1dbc57190ed10

[6: d5fcf9e458]: 2017-06-04 08:42:53 -0700
  Tune ‘format’ after recent fix
  http://git.savannah.gnu.org/cgit/emacs.git/commit/?id=d5fcf9e458053af1c50f0d4dad4c59db056790e5




Added tag(s) fixed. Request was from npostavs <at> users.sourceforge.net to control <at> debbugs.gnu.org. (Wed, 14 Jun 2017 00:45:02 GMT) Full text and rfc822 format available.

bug marked as fixed in version 26.1, send any further explanations to 12777 <at> debbugs.gnu.org and Ivan Vilata i Balaguer <ivan <at> selidor.net> Request was from npostavs <at> users.sourceforge.net to control <at> debbugs.gnu.org. (Wed, 14 Jun 2017 00:45:02 GMT) Full text and rfc822 format available.

bug archived. Request was from Debbugs Internal Request <help-debbugs <at> gnu.org> to internal_control <at> debbugs.gnu.org. (Wed, 12 Jul 2017 11:24:07 GMT) Full text and rfc822 format available.

This bug report was last modified 7 years and 348 days ago.

Previous Next


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