Subject: Re: bug#49848: 27.2.50; map-merge plist return alist

From: Michael Heerdegen <[email-masked]>
Date: Tue, 03 Aug 2021 23:59:14 +0200

Rajeev N via "Bug reports for GNU Emacs, the Swiss army knife of text
editors" <[email-masked]> writes:

> (map-merge 'plist nil '(:a 1))
> expected: '(:a 1)
> got: '((:a . 1))

I can reproduce this behavior and consider it a bug.

The implementation of `map-merge' starts with an empty plist "RESULT"
(i.e., nil) and fills it like

      (map-do (lambda (key value)
                (setf (map-elt result key) value))
              (pop maps))

The setter of `map-elt' treats nil as empty alist (at the end, this is
decided by `map--plist-p' which doesn't consider nil a plist).

So the underlying problem is more general, maybe this is not the only
issue this ambiguity causes.

Michael.