bug-gnu-emacs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

bug#65703: gnus-cut-thread loop condition oddity


From: Mattias Engdegård
Subject: bug#65703: gnus-cut-thread loop condition oddity
Date: Sat, 2 Sep 2023 16:24:38 +0200

This is about code I know nothing about but a tool of mine noticed it in the 
passing:

The loop in gnus-cut-thread in lisp/gnus/gnus-sum.el, replicated below, has a 
very odd loop condition: the latter half looks misplaced, as if it would belong 
in the loop body.

In particular, there is a definite possibility that the little `while` loop at 
the end will end up supplying the value for the loop condition of the outer 
loop, which of course terminates it since `while` forms are always nil.

Maybe someone who knows Gnus please take a look?

  (while (and
          thread
          (or
           (gnus-summary-article-sparse-p (mail-header-number (car thread)))
           (gnus-summary-article-ancient-p
            (mail-header-number (car thread))))
          (if (or (<= (length (cdr thread)) 1)           ; Should this be here?
                  (eq gnus-fetch-old-headers 'invisible))
              (setq gnus-newsgroup-limit
                    (delq (mail-header-number (car thread))
                          gnus-newsgroup-limit)
                    thread (cadr thread))
            (when (gnus-invisible-cut-children (cdr thread))
              (let ((th (cdr thread)))
                (while th                                ; And this?
                  (if (memq (mail-header-number (caar th))
                            gnus-newsgroup-limit)
                      (setq thread (car th)
                            th nil)
                    (setq th (cdr th))))))))))






reply via email to

[Prev in Thread] Current Thread [Next in Thread]