unofficial mirror of bug-gnu-emacs@gnu.org 
 help / color / mirror / code / Atom feed
From: dick <dick.r.chiang@gmail.com>
To: 37590@debbugs.gnu.org
Subject: bug#37590: 27.0.50; gnus-group-set-info setcdr exception
Date: Wed, 02 Oct 2019 15:10:54 -0400	[thread overview]
Message-ID: <871rvvhsjl.fsf@dick> (raw)
In-Reply-To: <874l0rhsse.fsf@dick> (dick's message of "Wed, 02 Oct 2019 15:05:37 -0400")

[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #1: patch --]
[-- Type: text/x-diff, Size: 1526 bytes --]

From 92862ab4d7e9f8400229add13a6e16e437d6dbd3 Mon Sep 17 00:00:00 2001
From: dickmao <none>
Date: Wed, 2 Oct 2019 14:22:26 -0400
Subject: [PATCH] Avoid setcdr exception when gnus-newsrc-alist is empty

Exception occurs when using debbugs-gnu.
* lisp/gnus/gnus-group.el (gnus-group-set-info): check if
  gnus-newsrc-alist is a consp
---
 lisp/gnus/gnus-group.el | 13 ++++++++-----
 1 file changed, 8 insertions(+), 5 deletions(-)

diff --git a/lisp/gnus/gnus-group.el b/lisp/gnus/gnus-group.el
index 915125b655..bca5d35f24 100644
--- a/lisp/gnus/gnus-group.el
+++ b/lisp/gnus/gnus-group.el
@@ -4466,11 +4466,14 @@ gnus-group-set-info
 			     (gnus-list-of-unread-articles (car info)))))
 	    ;; The above `setcar' will only affect the hashtable, not
 	    ;; the alist: update the alist separately.
-	    (push info (cdr (setq gnus-newsrc-alist
-				   (remove (assoc-string
-					    (gnus-info-group info)
-					    gnus-newsrc-alist)
-					   gnus-newsrc-alist)))))
+            (setf (alist-get (car info)
+                             ;; avoid usurping dummy info at the head
+                             ;; of gnus-newsrc-alist
+                             (if (consp gnus-newsrc-alist)
+                                 (cdr gnus-newsrc-alist)
+                               gnus-newsrc-alist)
+                             nil nil #'equal)
+                  (cdr info)))
 	(error "No such group: %s" (gnus-info-group info))))))
 
 ;; Ad-hoc function for inserting data from a different newsrc.eld
-- 
2.23.0






  reply	other threads:[~2019-10-02 19:10 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-10-02 19:05 bug#37590: 27.0.50; gnus-group-set-info setcdr exception dick
2019-10-02 19:10 ` dick [this message]
2019-10-02 20:53   ` Eric Abrahamsen

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://www.gnu.org/software/emacs/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=871rvvhsjl.fsf@dick \
    --to=dick.r.chiang@gmail.com \
    --cc=37590@debbugs.gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

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

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).