Subject: bug#75557: gnus-highlight-selected-tree is broken (fix)

From: Stefan Kangas <[email-masked]>
Date: Sat, 1 Mar 2025 20:04:45 -0800

fixed 75557 31.1
thanks

Pranshu Sharma <[email-masked]> writes:

> seems like buffer-live-p does not accept string buffer names anymore

It actually never did.

I installed the below change on master (in your name), thanks.

>
> diff --git a/lisp/gnus/gnus-salt.el b/lisp/gnus/gnus-salt.el
> index 6514d8d4174..75daf7e7cfa 100644
> --- a/lisp/gnus/gnus-salt.el
> +++ b/lisp/gnus/gnus-salt.el
> @@ -808,7 +808,7 @@ gnus-tree-perhaps-minimize
>
>  (defun gnus-highlight-selected-tree (article)
>    "Highlight the selected article in the tree."
> -  (when (buffer-live-p gnus-tree-buffer)
> +  (when (buffer-live-p (get-buffer gnus-tree-buffer))
>      (let ((buf (current-buffer))
>  	  region)
>        (set-buffer gnus-tree-buffer)

My only question is if we should perhaps make `buffer-live-p` throw an
error in case it is passed something of the wrong type.  Yes, it is a
backwards-incompatible change, but OTOH it would catch real bugs like
the above, instead of silently returning nil.

For example, we can currently do all of this nonsense:

    (buffer-live-p 123)                          => nil
    (buffer-live-p [foo])                        => nil
    (buffer-live-p (make-symbol "foo"))          => nil
    (buffer-live-p (lambda () (message "foo")))  => nil

Eli, Stefan, WDYT?