Subject: Re: bug#64543: [PATCH] package-report-bug: don't fail on custom groups defined by eval

From: Philip Kaludercic <[email-masked]>
Date: Fri, 14 Jul 2023 19:44:15 +0000

Spencer Baugh <[email-masked]> writes:

> Philip Kaludercic <[email-masked]> writes:
>
>> [email-masked] writes:
>>> Good point.  I was just copying the last condition in the and.  Lifted
>>> them both out of the loop:
>>>
>>> From 2873d4c482acfd1ced749d593fd512c408e0a578 Mon Sep 17 00:00:00 2001
>>> From: Spencer Baugh <[email-masked]>
>>> Date: Sun, 9 Jul 2023 22:21:03 -0400
>>> Subject: [PATCH] Support transforming the dirname used by uniquify
>>
>> Wrong patch?
> Oops! Here's the right one:
>
> From fb31777bcc1935de351eaa35c1ed679c66d24a92 Mon Sep 17 00:00:00 2001
> From: Spencer Baugh <[email-masked]>
> Date: Sun, 9 Jul 2023 12:59:50 -0400
> Subject: [PATCH] package-report-bug: don't fail on custom groups defined by
>  eval
>
> Previously we just assumed that the car of an element of
> custom-current-group-alist was a filename.  But actually it can be nil
> if a custom group was defined by just evaling Lisp.
>
> * lisp/emacs-lisp/package.el (package-report-bug): Don't fail when a
> custom group was defined by eval.
> ---
>  lisp/emacs-lisp/package.el | 15 ++++++++-------
>  1 file changed, 8 insertions(+), 7 deletions(-)
>
> diff --git a/lisp/emacs-lisp/package.el b/lisp/emacs-lisp/package.el
> index 3e6acd9b388..58ca19f7fe2 100644
> --- a/lisp/emacs-lisp/package.el
> +++ b/lisp/emacs-lisp/package.el
> @@ -4637,13 +4637,14 @@ package-report-bug
>          vars)
>      (dolist-with-progress-reporter (group custom-current-group-alist)
>          "Scanning for modified user options..."
> -      (dolist (ent (get (cdr group) 'custom-group))
> -        (when (and (custom-variable-p (car ent))
> -                   (boundp (car ent))
> -                   (not (eq (custom--standard-value (car ent))
> -                            (default-toplevel-value (car ent))))
> -                   (file-in-directory-p (car group) (package-desc-dir desc)))
> -          (push (car ent) vars))))
> +      (when (and (car group)
> +                 (file-in-directory-p (car group) (package-desc-dir desc)))
> +        (dolist (ent (get (cdr group) 'custom-group))
> +          (when (and (custom-variable-p (car ent))
> +                     (boundp (car ent))
> +                     (not (eq (custom--standard-value (car ent))
> +                              (default-toplevel-value (car ent)))))
> +            (push (car ent) vars)))))
>      (dlet ((reporter-prompt-for-summary-p t))
>        (reporter-submit-bug-report maint name vars))))

LGTM.

Eli, would it be OK to push this to emacs-29, as this is a bug in the
existing code?  Most of the changes are indentation/whitespace changes
anyway.