all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
* bug#12777: 24.2; Please support '$' in format specifications
@ 2012-11-01 13:12 Ivan Vilata i Balaguer
  2017-06-14  0:45 ` npostavs
  0 siblings, 1 reply; 2+ messages in thread
From: Ivan Vilata i Balaguer @ 2012-11-01 13:12 UTC (permalink / raw)
  To: 12777


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/





^ permalink raw reply	[flat|nested] 2+ messages in thread

* bug#12777: 24.2; Please support '$' in format specifications
  2012-11-01 13:12 bug#12777: 24.2; Please support '$' in format specifications Ivan Vilata i Balaguer
@ 2017-06-14  0:45 ` npostavs
  0 siblings, 0 replies; 2+ messages in thread
From: npostavs @ 2017-06-14  0:45 UTC (permalink / raw)
  To: Ivan Vilata i Balaguer; +Cc: 12777

tags 12777 fixed
close 12777 26.1
quit

Ivan Vilata i Balaguer <ivan@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





^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2017-06-14  0:45 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2012-11-01 13:12 bug#12777: 24.2; Please support '$' in format specifications Ivan Vilata i Balaguer
2017-06-14  0:45 ` npostavs

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.