all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
* bug#25839: 26.0.50; Bug in gnus-registry-article-marks-to-chars
@ 2017-02-22 17:23 Eric Abrahamsen
  2017-02-22 18:16 ` Noam Postavsky
  0 siblings, 1 reply; 7+ messages in thread
From: Eric Abrahamsen @ 2017-02-22 17:23 UTC (permalink / raw)
  To: 25839

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


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.

[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: 0001-Use-char-to-string-in-gnus-registry-article-marks-to.patch --]
[-- Type: text/x-diff, Size: 1555 bytes --]

From b05ff977a349688fc006fac399b0f29516f0ecef Mon Sep 17 00:00:00 2001
From: Eric Abrahamsen <eric@ericabrahamsen.net>
Date: Wed, 22 Feb 2017 09:21:53 -0800
Subject: [PATCH] Use char-to-string in gnus-registry-article-marks-to-chars

* lisp/gnus/gnus-registry.el (gnus-registry-article-marks-to-chars):
  Otherwise it was running a list of characters through mapconcat,
  which produced an error.
---
 lisp/gnus/gnus-registry.el | 16 +++++++++-------
 1 file changed, 9 insertions(+), 7 deletions(-)

diff --git a/lisp/gnus/gnus-registry.el b/lisp/gnus/gnus-registry.el
index f728b19111..8229927176 100644
--- a/lisp/gnus/gnus-registry.el
+++ b/lisp/gnus/gnus-registry.el
@@ -967,13 +967,15 @@ 'gnus-registry-user-format-function-M
 (defun gnus-registry-article-marks-to-chars (headers)
   "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 "")))
+         (marks (when id (gnus-registry-get-id-key id 'mark)))
+	 (mark-chars
+	  (delq nil (mapcar (lambda (mark)
+			      (plist-get
+			       (cdr-safe
+				(assoc mark gnus-registry-marks))
+			       :char))
+			    marks))))
+    (mapconcat #'char-to-string mark-chars "")))
 
 ;; use like this:
 ;; (defalias 'gnus-user-format-function-M 'gnus-registry-article-marks-to-names)
-- 
2.11.1


[-- Attachment #3: Type: text/plain, Size: 172 bytes --]



In GNU Emacs 26.0.50 (build 28, x86_64-unknown-linux-gnu, GTK+ Version 3.22.8)
 of 2017-02-19 built on clem
Repository revision: c8d14cfc6c2d19077d137c7e917fbb4f104de222

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

* bug#25839: 26.0.50; Bug in gnus-registry-article-marks-to-chars
  2017-02-22 17:23 bug#25839: 26.0.50; Bug in gnus-registry-article-marks-to-chars Eric Abrahamsen
@ 2017-02-22 18:16 ` Noam Postavsky
  2017-02-22 18:34   ` Eric Abrahamsen
  0 siblings, 1 reply; 7+ messages in thread
From: Noam Postavsky @ 2017-02-22 18:16 UTC (permalink / raw)
  To: Eric Abrahamsen; +Cc: 25839

On Wed, Feb 22, 2017 at 12:23 PM, Eric Abrahamsen
<eric@ericabrahamsen.net> 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).





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

* bug#25839: 26.0.50; Bug in gnus-registry-article-marks-to-chars
  2017-02-22 18:16 ` Noam Postavsky
@ 2017-02-22 18:34   ` Eric Abrahamsen
  2017-02-22 18:53     ` Noam Postavsky
  0 siblings, 1 reply; 7+ messages in thread
From: Eric Abrahamsen @ 2017-02-22 18:34 UTC (permalink / raw)
  To: Noam Postavsky; +Cc: Eric Abrahamsen, 25839


On 02/22/17 13:16 PM, Noam Postavsky wrote:
> On Wed, Feb 22, 2017 at 12:23 PM, Eric Abrahamsen
> <eric@ericabrahamsen.net> 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.

E





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

* bug#25839: 26.0.50; Bug in gnus-registry-article-marks-to-chars
  2017-02-22 18:34   ` Eric Abrahamsen
@ 2017-02-22 18:53     ` Noam Postavsky
  2017-02-23  3:18       ` npostavs
  0 siblings, 1 reply; 7+ messages in thread
From: Noam Postavsky @ 2017-02-22 18:53 UTC (permalink / raw)
  To: Eric Abrahamsen; +Cc: 25839

On Wed, Feb 22, 2017 at 1:34 PM, Eric Abrahamsen
<eric@ericabrahamsen.net> wrote:
>
> On 02/22/17 13:16 PM, Noam Postavsky wrote:
>> On Wed, Feb 22, 2017 at 12:23 PM, Eric Abrahamsen
>> <eric@ericabrahamsen.net> 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)





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

* bug#25839: 26.0.50; Bug in gnus-registry-article-marks-to-chars
  2017-02-22 18:53     ` Noam Postavsky
@ 2017-02-23  3:18       ` npostavs
  2017-03-01  3:01         ` npostavs
  0 siblings, 1 reply; 7+ messages in thread
From: npostavs @ 2017-02-23  3:18 UTC (permalink / raw)
  To: Eric Abrahamsen; +Cc: 25839

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

tags 25839 patch
quit

Forwarding message to list.


[-- Attachment #2: Type: message/rfc822, Size: 6910 bytes --]

[-- Attachment #2.1.1: Type: text/plain, Size: 838 bytes --]


On 02/22/17 13:53 PM, Noam Postavsky wrote:
> On Wed, Feb 22, 2017 at 1:34 PM, Eric Abrahamsen
> <eric@ericabrahamsen.net> wrote:
>>
>> On 02/22/17 13:16 PM, Noam Postavsky wrote:
>>> On Wed, Feb 22, 2017 at 12:23 PM, Eric Abrahamsen
>>> <eric@ericabrahamsen.net> 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.


[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2.1.2: 0001-Don-t-use-mapconcat-with-chars-in-gnus-registry-mark.patch --]
[-- Type: text/x-diff, Size: 1354 bytes --]

From 2f2c368ba872478476cee1d1b6e121480ec64cfc Mon Sep 17 00:00:00 2001
From: Eric Abrahamsen <eric@ericabrahamsen.net>
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


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

* bug#25839: 26.0.50; Bug in gnus-registry-article-marks-to-chars
  2017-02-23  3:18       ` npostavs
@ 2017-03-01  3:01         ` npostavs
  2017-03-14 19:25           ` Ted Zlatanov
  0 siblings, 1 reply; 7+ messages in thread
From: npostavs @ 2017-03-01  3:01 UTC (permalink / raw)
  To: Eric Abrahamsen; +Cc: 25839

tags 25839 fixed
close 25839 26.1
quit

> From: Eric Abrahamsen <eric@ericabrahamsen.net>
> Date: Wed, 22 Feb 2017 17:26:11 -0800
> Subject: [PATCH] Don't use mapconcat with chars in gnus registry marks

Pushed to master [1: 16e304f38e].

1: 2017-02-28 21:57:07 -0500 16e304f38e57a9a31f1468ba6ebcb8a71efd253d
  Don't use mapconcat with chars in gnus registry marks (Bug#25839)





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

* bug#25839: 26.0.50; Bug in gnus-registry-article-marks-to-chars
  2017-03-01  3:01         ` npostavs
@ 2017-03-14 19:25           ` Ted Zlatanov
  0 siblings, 0 replies; 7+ messages in thread
From: Ted Zlatanov @ 2017-03-14 19:25 UTC (permalink / raw)
  To: npostavs; +Cc: Eric Abrahamsen, 25839

On Tue, 28 Feb 2017 22:01:24 -0500 npostavs@users.sourceforge.net wrote: 

n> tags 25839 fixed
n> close 25839 26.1
n> quit

>> From: Eric Abrahamsen <eric@ericabrahamsen.net>
>> Date: Wed, 22 Feb 2017 17:26:11 -0800
>> Subject: [PATCH] Don't use mapconcat with chars in gnus registry marks

n> Pushed to master [1: 16e304f38e].

n> 1: 2017-02-28 21:57:07 -0500 16e304f38e57a9a31f1468ba6ebcb8a71efd253d
n>   Don't use mapconcat with chars in gnus registry marks (Bug#25839)

That's so much better :) Thanks!

Ted





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

end of thread, other threads:[~2017-03-14 19:25 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2017-02-22 17:23 bug#25839: 26.0.50; Bug in gnus-registry-article-marks-to-chars Eric Abrahamsen
2017-02-22 18:16 ` Noam Postavsky
2017-02-22 18:34   ` Eric Abrahamsen
2017-02-22 18:53     ` Noam Postavsky
2017-02-23  3:18       ` npostavs
2017-03-01  3:01         ` npostavs
2017-03-14 19:25           ` Ted Zlatanov

Code repositories for project(s) associated with this external index

	https://git.savannah.gnu.org/cgit/emacs.git
	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.