Subject: bug#35383: 27.0.50; Complete process of decoding Gnus group names

From: "Basil L. Contovounesios" <[email-masked]>
Date: Sat, 18 May 2019 23:12:30 +0100

Eric Abrahamsen <[email-masked]> writes:

> The attached patch should go into master, and then master merged into
> scratch/gnus-decoded.

[...]

> diff --git a/lisp/gnus/gnus-start.el b/lisp/gnus/gnus-start.el
> index 2f8a260bf1..16d167613e 100644
> --- a/lisp/gnus/gnus-start.el
> +++ b/lisp/gnus/gnus-start.el
> @@ -583,11 +583,11 @@ gnus-subscribe-randomly
>  
>  (defun gnus-subscribe-alphabetically (newgroup)
>    "Subscribe new NEWGROUP and insert it in alphabetical order."
> -  (let ((groups (cdr gnus-newsrc-alist))
> +  (let ((groups (cdr gnus-group-list))
>  	before)
>      (while (and (not before) groups)
> -      (if (string< newgroup (caar groups))
> -	  (setq before (caar groups))
> +      (if (string< newgroup (car groups))
> +	  (setq before (car groups))
>  	(setq groups (cdr groups))))
>      (gnus-subscribe-newsgroup newgroup before)))

I noticed gnus-start.el (already) uses seq.el functions without first
loading the library, so how about the following minor addendum?

diff --git a/lisp/gnus/gnus-start.el b/lisp/gnus/gnus-start.el
index 16d167613e..c1e55e4e25 100644
--- a/lisp/gnus/gnus-start.el
+++ b/lisp/gnus/gnus-start.el
@@ -31,6 +31,7 @@
 (require 'gnus-range)
 (require 'gnus-util)
 (require 'gnus-cloud)
+(require 'seq)
 (autoload 'message-make-date "message")
 (autoload 'gnus-agent-read-servers-validate "gnus-agent")
 (autoload 'gnus-agent-save-local "gnus-agent")
@@ -583,12 +584,9 @@ gnus-subscribe-randomly
 
 (defun gnus-subscribe-alphabetically (newgroup)
   "Subscribe new NEWGROUP and insert it in alphabetical order."
-  (let ((groups (cdr gnus-group-list))
-	before)
-    (while (and (not before) groups)
-      (if (string< newgroup (car groups))
-	  (setq before (car groups))
-	(setq groups (cdr groups))))
+  (let ((before (seq-find (lambda (group)
+                            (string< newgroup group))
+                          (cdr gnus-group-list))))
     (gnus-subscribe-newsgroup newgroup before)))
 
 (defun gnus-subscribe-hierarchically (newgroup)

Thanks,

-- 
Basil