GNU bug report logs - #22101
Emacs-25: inaccuracy in documentation of `mapconcat' in .../lispref/functions.texi

Previous Next

Package: emacs;

Reported by: Alan Mackenzie <acm <at> muc.de>

Date: Sun, 6 Dec 2015 10:25:02 UTC

Severity: minor

Done: Alan Mackenzie <acm <at> muc.de>

Bug is archived. No further changes may be made.

Full log


View this message in rfc822 format

From: help-debbugs <at> gnu.org (GNU bug Tracking System)
To: Alan Mackenzie <acm <at> muc.de>
Cc: tracker <at> debbugs.gnu.org
Subject: bug#22101: closed (Emacs-25: inaccuracy in documentation of
 `mapconcat' in .../lispref/functions.texi)
Date: Mon, 07 Dec 2015 10:53:02 +0000
[Message part 1 (text/plain, inline)]
Your message dated Mon, 7 Dec 2015 10:54:58 +0000
with message-id <20151207105457.GA1904 <at> acm.fritz.box>
and subject line Re: bug#22101: Emacs-25: inaccuracy in documentation of `mapconcat' in	.../lispref/functions.texi
has caused the debbugs.gnu.org bug report #22101,
regarding Emacs-25: inaccuracy in documentation of `mapconcat' in .../lispref/functions.texi
to be marked as done.

(If you believe you have received this mail in error, please contact
help-debbugs <at> gnu.org.)


-- 
22101: http://debbugs.gnu.org/cgi/bugreport.cgi?bug=22101
GNU Bug Tracking System
Contact help-debbugs <at> gnu.org with problems
[Message part 2 (message/rfc822, inline)]
From: Alan Mackenzie <acm <at> muc.de>
To: bug-gnu-emacs <at> gnu.org
Subject: Emacs-25: inaccuracy in documentation of `mapconcat' in
 .../lispref/functions.texi
Date: Sun, 6 Dec 2015 10:26:22 +0000
Hello, Emacs.

In the elisp manual, mapconcat is described thusly:

     `mapconcat' applies FUNCTION to each element of SEQUENCE: the
     results, which must be strings, are concatenated.  Between each
              ^^^^^^^^^^^^^^^^^^^^^
     pair of result strings, `mapconcat' inserts the string SEPARATOR.
                                                 ^^^^^^^^^^
     Usually SEPARATOR contains a space or comma or other suitable
     punctuation.

The results returned by FUNCTION need not be strings; they may be of any
sequence type acceptable to `concat'.  The same applies to SEPARATOR.

Either the code or the documentation is wrong.  I strongly believe it's
the documentation.

Here's a patch to fix it.  I will apply this patch to the emacs-25 branch
soon, if I don't hear any objections.



diff --git a/doc/lispref/functions.texi b/doc/lispref/functions.texi
index 8835667..1b949f2 100644
--- a/doc/lispref/functions.texi
+++ b/doc/lispref/functions.texi
@@ -861,13 +861,15 @@ Mapping Functions
 
 @defun mapconcat function sequence separator
 @code{mapconcat} applies @var{function} to each element of
-@var{sequence}: the results, which must be strings, are concatenated.
-Between each pair of result strings, @code{mapconcat} inserts the string
+@var{sequence}: the results, which must be sequences, are
+concatenated.  These result sequences are usually strings, but may
+also be lists of numbers or vectors of numbers.  Between each pair of
+result sequences, @code{mapconcat} inserts the sequence
 @var{separator}.  Usually @var{separator} contains a space or comma or
 other suitable punctuation.
 
 The argument @var{function} must be a function that can take one
-argument and return a string.  The argument @var{sequence} can be any
+argument and return a sequence.  The argument @var{sequence} can be any
 kind of sequence except a char-table; that is, a list, a vector, a
 bool-vector, or a string.
 


-- 
Alan Mackenzie (Nuremberg, Germany).


[Message part 3 (message/rfc822, inline)]
From: Alan Mackenzie <acm <at> muc.de>
To: Eli Zaretskii <eliz <at> gnu.org>
Cc: 22101-done <at> debbugs.gnu.org
Subject: Re: bug#22101: Emacs-25: inaccuracy in documentation of `mapconcat'
 in	.../lispref/functions.texi
Date: Mon, 7 Dec 2015 10:54:58 +0000
Hello, Eli.

On Sun, Dec 06, 2015 at 06:04:46PM +0200, Eli Zaretskii wrote:
> > Date: Sun, 6 Dec 2015 10:26:22 +0000
> > From: Alan Mackenzie <acm <at> muc.de>

[ .... ]

> IMO, this errs on the other side: it seems to allow sequences that
> will be rejected by mapconcat or by concat that it calls.  I suggest
> the following alternative wording:

>  @code{mapconcat} applies @var{function} to each element of
>  @var{sequence}; the results, which must be sequences of characters
>  (strings, vectors, or lists), are concatenated into a single string
>  return value.  Between each pair of result sequences,
>  @code{mapconcat} inserts the characters from @var{separator}, which
>  also must be a string, or a vector or list of characters.

>  The argument @var{function} must be a function that can take one
>  argument and return a sequence of characters: a string, a vector, or
>  a list.  The argument @var{sequence} can be any kind of sequence
>  except a char-table; that is, a list, a vector, a bool-vector, or a
>  string.

> WDYT?

I think it's good.  I have just taken the liberty of committing your
version, with two changes: I have added @xref{Sequences Arrays Vectors}
at the end of the first paragraph.  I have changed "return" to "returns"
to indicate that the "returning" is mandatory, and not a subclause of the
"can" bit.  (A small point, but I think it's more correct.)

-- 
Alan Mackenzie (Nuremberg, Germany).


This bug report was last modified 9 years and 163 days ago.

Previous Next


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