unofficial mirror of bug-gnu-emacs@gnu.org 
 help / color / mirror / code / Atom feed
* bug#39290: [PATCH] Correct regexp for flags in 'format' doc string
@ 2020-01-26 14:21 Mattias Engdegård
  2020-01-26 18:08 ` Paul Eggert
  0 siblings, 1 reply; 4+ messages in thread
From: Mattias Engdegård @ 2020-01-26 14:21 UTC (permalink / raw)
  To: 39290

[-- Attachment #1: Type: text/plain, Size: 403 bytes --]

The doc string for 'format' contains

  where field is [0-9]+ followed by a literal dollar "$", flags is
  [+ #-0]+, width is [0-9]+, and precision is a literal period "."
  followed by [0-9]+.

The spec for flags isn't a correct regexp; the hyphen should be last.  This matters, because people copy it into their code without thinking (observed in the wild).

Patch acceptable for emacs-27?


[-- Attachment #2: 0001-Correct-regexp-for-flags-in-format-doc-string.patch --]
[-- Type: application/octet-stream, Size: 1010 bytes --]

From 5245a818d978a96c17c3ec7b99d93e32a07f90e6 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Mattias=20Engdeg=C3=A5rd?= <mattiase@acm.org>
Date: Sun, 26 Jan 2020 15:07:45 +0100
Subject: [PATCH] Correct regexp for flags in `format' doc string

* src/editfns.c (Fformat): Use the correct regexp for describing the
flags in a %-sequence (place the hyphen last).
---
 src/editfns.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/src/editfns.c b/src/editfns.c
index 4e35784e55..3f1b3aa4b7 100644
--- a/src/editfns.c
+++ b/src/editfns.c
@@ -3031,7 +3031,7 @@ DEFUN ("format", Fformat, Sformat, 1, MANY, 0,
   %<field><flags><width><precision>character
 
 where field is [0-9]+ followed by a literal dollar "$", flags is
-[+ #-0]+, width is [0-9]+, and precision is a literal period "."
+[+ #0-]+, width is [0-9]+, and precision is a literal period "."
 followed by [0-9]+.
 
 If a %-sequence is numbered with a field with positive value N, the
-- 
2.21.0 (Apple Git-122.2)


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

end of thread, other threads:[~2020-01-26 19:21 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2020-01-26 14:21 bug#39290: [PATCH] Correct regexp for flags in 'format' doc string Mattias Engdegård
2020-01-26 18:08 ` Paul Eggert
2020-01-26 19:19   ` Eli Zaretskii
2020-01-26 19:21     ` Mattias Engdegård

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