Subject: bug#25839: 26.0.50; Bug in gnus-registry-article-marks-to-chars

From: [email-masked]
Date: Wed, 22 Feb 2017 22:18:02 -0500

tags 25839 patch
quit

Forwarding message to list.

Subject: Re: bug#25839: 26.0.50; Bug in gnus-registry-article-marks-to-chars
From: Eric Abrahamsen <[email-masked]>
To: Noam Postavsky <[email-masked]>
Date: Wed, 22 Feb 2017 17:28:24 -0800

On 02/22/17 13:53 PM, Noam Postavsky wrote:
> On Wed, Feb 22, 2017 at 1:34 PM, Eric Abrahamsen
> <[email-masked]> wrote:
>>
>> On 02/22/17 13:16 PM, Noam Postavsky wrote:
>>> On Wed, Feb 22, 2017 at 12:23 PM, Eric Abrahamsen
>>> <[email-masked]> wrote:
>>>>
>>>> The current implementation of gnus-registry-article-marks-to-chars
>>>> errors out because it tries to use mapconcat on a list of characters.
>>>> I've attached a patch that extracts the characters first and then uses
>>>> the mapconcat with char-to-string.
>>>>
>>>
>>>> +    (mapconcat #'char-to-string mark-chars "")))
>>>
>>> AFAIK, this should be the same as (apply #'string mark-chars).
>>
>> Good point! Let me stare at this a bit longer, and post another patch.
>>
>
> Or actually even simpler: (concat mark-chars)

Very nice! Here's another one.

>From 2f2c368ba872478476cee1d1b6e121480ec64cfc Mon Sep 17 00:00:00 2001
From: Eric Abrahamsen <[email-masked]>
Date: Wed, 22 Feb 2017 17:26:11 -0800
Subject: [PATCH] Don't use mapconcat with chars in gnus registry marks

* lisp/gnus/gnus-registry.el (gnus-registry-article-marks-to-chars):
  Instead, use a plain concat, which will create a string out of a
  list of chars.
---
 lisp/gnus/gnus-registry.el | 13 +++++++------
 1 file changed, 7 insertions(+), 6 deletions(-)

diff --git a/lisp/gnus/gnus-registry.el b/lisp/gnus/gnus-registry.el
index f728b19111..51f6459d2f 100644
--- a/lisp/gnus/gnus-registry.el
+++ b/lisp/gnus/gnus-registry.el
@@ -968,12 +968,13 @@ gnus-registry-article-marks-to-chars
   "Show the marks for an article by the :char property."
   (let* ((id (mail-header-message-id headers))
          (marks (when id (gnus-registry-get-id-key id 'mark))))
-    (mapconcat (lambda (mark)
-                 (plist-get
-                  (cdr-safe
-                   (assoc mark gnus-registry-marks))
-                  :char))
-               marks "")))
+    (concat (delq nil
+		  (mapcar
+		   (lambda (m)
+		     (plist-get
+		      (cdr-safe (assoc m gnus-registry-marks))
+		      :char))
+		   marks)))))
 
 ;; use like this:
 ;; (defalias 'gnus-user-format-function-M 'gnus-registry-article-marks-to-names)
-- 
2.11.1