GNU bug report logs - #65468
29.1; describe-theme fails to describe some themes not loaded

Previous Next

Package: emacs;

Reported by: Thierry Volpiatto <thievol <at> posteo.net>

Date: Wed, 23 Aug 2023 08:55:01 UTC

Severity: normal

Tags: patch

Found in version 29.1

Done: Stefan Kangas <stefankangas <at> gmail.com>

Bug is archived. No further changes may be made.

Full log


View this message in rfc822 format

From: Mauro Aranda <maurooaranda <at> gmail.com>
To: Thierry Volpiatto <thievol <at> posteo.net>
Cc: 65468 <at> debbugs.gnu.org
Subject: bug#65468: 29.1; describe-theme fails to describe some themes not loaded
Date: Wed, 23 Aug 2023 06:53:03 -0300
Thierry Volpiatto <thievol <at> posteo.net> writes:

> This because `describe-theme-1` is not looping in buffer to find
> `deftheme` definition.

It is a convention that the first form should be a call to deftheme.
But it seems built-in themes have deviated from that convention.  And
other themes might as well, I don't know.

>
> Try (describe-theme 'leuven) to reproduce (if not already loaded of 
course).
>

At least for the leuven themes, it should be easy to make them follow
the convention.

> This patch fixes it:
>
> diff --git a/lisp/cus-theme.el b/lisp/cus-theme.el
> index 5d3f2585976..3640d1ec329 100644
> --- a/lisp/cus-theme.el
> +++ b/lisp/cus-theme.el
> @@ -513,13 +513,15 @@ It includes all faces in list FACES."
>        ;; Attempt to grab the theme documentation
>        (when fn
>  	(with-temp-buffer
> -	  (insert-file-contents fn)
> -	  (let ((sexp (let ((read-circle nil))
> -			(condition-case nil
> -			    (read (current-buffer))
> -			  (end-of-file nil)))))
> -            (and (eq (car-safe sexp) 'deftheme)
> -		 (setq doc (nth 2 sexp)))))))
> +          (insert-file-contents fn)
> +          (catch 'found
> +            (let (sexp)
> +              (while (setq sexp (let ((read-circle nil))
> +	                          (condition-case nil
> +		                      (read (current-buffer))
> +		                    (end-of-file nil))))
> +                (when (eq (car-safe sexp) 'deftheme)
> +	          (throw 'found (setq doc (nth 2 sexp))))))))))
>      (princ "\n\nDocumentation:\n")
>      (princ (if (stringp doc)
>  	       (substitute-command-keys doc)
>
> However for the modus themes it will fail as well because deftheme is
> nested inside a eval-when-compile.

I feel like if there are more themes that suffer from this problem,
they could solve it by following the convention.  And for other themes,
it seems like either way we have to give it more thought, because AFAICS
following the convention is more difficult and the patch doesn't solve
it either.

> And while I am at it, the docstring of Leuven-dark is wrong (guess it has
> been copy/pasted from Leuven without modifications).

This has been fixed already, thanks.




This bug report was last modified 1 year and 306 days ago.

Previous Next


GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997,2003 nCipher Corporation Ltd, 1994-97 Ian Jackson.