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.

Full log


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/




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.