GNU bug report logs - #36418
26.2.90; mapconcat "SEPARATOR must be a string." is incorrect

Previous Next

Package: emacs;

Reported by: Xu Chunyang <mail <at> xuchunyang.me>

Date: Fri, 28 Jun 2019 13:24:02 UTC

Severity: minor

Found in version 26.2.90

Done: Eli Zaretskii <eliz <at> gnu.org>

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 36418 in the body.
You can then email your comments to 36418 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#36418; Package emacs. (Fri, 28 Jun 2019 13:24:02 GMT) Full text and rfc822 format available.

Acknowledgement sent to Xu Chunyang <mail <at> xuchunyang.me>:
New bug report received and forwarded. Copy sent to bug-gnu-emacs <at> gnu.org. (Fri, 28 Jun 2019 13:24:02 GMT) Full text and rfc822 format available.

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

From: Xu Chunyang <mail <at> xuchunyang.me>
To: bug-gnu-emacs <at> gnu.org
Subject: 26.2.90; mapconcat "SEPARATOR must be a string." is incorrect
Date: Fri, 28 Jun 2019 21:23:24 +0800
C-h f mapconcat says

> SEPARATOR must be a string.

but nil works fine

    (mapconcat #'identity '("a" "b") nil)
    ;; => "ab"

and `string-join` relies on this fact (by the way, string-join's
docstring doesn't explain the case when separator is omitted or nil)

    (defsubst string-join (strings &optional separator)
      "Join all STRINGS using SEPARATOR."
      (mapconcat 'identity strings separator))

C-h S mapconcat says

> SEPARATOR, which also must be a string, or a vector or list of
> characters.

C-h f concat says

> Each argument may be a string or a list or vector of characters (integers).




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#36418; Package emacs. (Sat, 06 Jul 2019 04:18:02 GMT) Full text and rfc822 format available.

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

From: Stefan Kangas <stefan <at> marxist.se>
To: Xu Chunyang <mail <at> xuchunyang.me>
Cc: 36418 <at> debbugs.gnu.org
Subject: Re: bug#36418: 26.2.90;
 mapconcat "SEPARATOR must be a string." is incorrect
Date: Sat, 6 Jul 2019 06:17:08 +0200
Xu Chunyang <mail <at> xuchunyang.me> writes:

> C-h f mapconcat says
>
>> SEPARATOR must be a string.
>
> but nil works fine
>
>     (mapconcat #'identity '("a" "b") nil)
>     ;; => "ab"

This seems to have been added in commit aecbbd57, which fixes
Bug#35710:

   https://debbugs.gnu.org/cgi/bugreport.cgi?bug=35710

Perhaps Eli would want to weigh in on this?

> and `string-join` relies on this fact (by the way, string-join's
> docstring doesn't explain the case when separator is omitted or nil)
>
>     (defsubst string-join (strings &optional separator)
>       "Join all STRINGS using SEPARATOR."
>       (mapconcat 'identity strings separator))

This could be expanded, in my opinion.

> C-h S mapconcat says
>
>> SEPARATOR, which also must be a string, or a vector or list of
>> characters.
>
> C-h f concat says
>
>> Each argument may be a string or a list or vector of characters (integers).

In other words, since SEPARATOR can be a "list of characters", it
follows that it can also be nil (which is equivalent to the empty list).

Thanks,
Stefan Kangas




Reply sent to Eli Zaretskii <eliz <at> gnu.org>:
You have taken responsibility. (Sat, 06 Jul 2019 07:34:02 GMT) Full text and rfc822 format available.

Notification sent to Xu Chunyang <mail <at> xuchunyang.me>:
bug acknowledged by developer. (Sat, 06 Jul 2019 07:34:02 GMT) Full text and rfc822 format available.

Message #13 received at 36418-done <at> debbugs.gnu.org (full text, mbox):

From: Eli Zaretskii <eliz <at> gnu.org>
To: Stefan Kangas <stefan <at> marxist.se>
Cc: 36418-done <at> debbugs.gnu.org, mail <at> xuchunyang.me
Subject: Re: bug#36418: 26.2.90;
 mapconcat "SEPARATOR must be a string." is incorrect
Date: Sat, 06 Jul 2019 10:32:51 +0300
> From: Stefan Kangas <stefan <at> marxist.se>
> Date: Sat, 6 Jul 2019 06:17:08 +0200
> Cc: 36418 <at> debbugs.gnu.org
> 
> > C-h S mapconcat says
> >
> >> SEPARATOR, which also must be a string, or a vector or list of
> >> characters.
> >
> > C-h f concat says
> >
> >> Each argument may be a string or a list or vector of characters (integers).
> 
> In other words, since SEPARATOR can be a "list of characters", it
> follows that it can also be nil (which is equivalent to the empty list).

Right, I fixed the doc string.




bug archived. Request was from Debbugs Internal Request <help-debbugs <at> gnu.org> to internal_control <at> debbugs.gnu.org. (Sat, 03 Aug 2019 11:24:05 GMT) Full text and rfc822 format available.

This bug report was last modified 5 years and 322 days ago.

Previous Next


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