unofficial mirror of bug-gnu-emacs@gnu.org 
 help / color / mirror / code / Atom feed
* bug#65703: gnus-cut-thread loop condition oddity
@ 2023-09-02 14:24 Mattias Engdegård
  0 siblings, 0 replies; only message in thread
From: Mattias Engdegård @ 2023-09-02 14:24 UTC (permalink / raw)
  To: 65703; +Cc: Lars Ingebrigtsen, Andrew G Cohen

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))))))))))






^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2023-09-02 14:24 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-09-02 14:24 bug#65703: gnus-cut-thread loop condition oddity Mattias Engdegård

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).