unofficial mirror of bug-gnu-emacs@gnu.org 
 help / color / mirror / code / Atom feed
From: Mauro Aranda <maurooaranda@gmail.com>
To: Thierry Volpiatto <thievol@posteo.net>
Cc: 65468@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	[thread overview]
Message-ID: <b63ccc03-17c0-137b-6538-3175dc681fb7@gmail.com> (raw)
In-Reply-To: <87lee29m1c.fsf@posteo.net>

Thierry Volpiatto <thievol@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.





  reply	other threads:[~2023-08-23  9:53 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-08-23  8:44 bug#65468: 29.1; describe-theme fails to describe some themes not loaded Thierry Volpiatto
2023-08-23  9:53 ` Mauro Aranda [this message]
2023-08-23 11:01   ` Thierry Volpiatto
2023-08-23 11:57   ` Eli Zaretskii
2023-08-24 10:16     ` Mauro Aranda
2023-08-25  3:48       ` Protesilaos Stavrou
2023-08-23 11:47 ` Eli Zaretskii
2023-08-23 13:12   ` Thierry Volpiatto
2023-08-26  7:57     ` Eli Zaretskii
2023-08-26 15:31       ` Thierry Volpiatto
2023-09-09 11:33       ` Mauro Aranda
2023-09-09 11:47         ` Eli Zaretskii
2023-09-09 11:51         ` Stefan Kangas

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://www.gnu.org/software/emacs/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=b63ccc03-17c0-137b-6538-3175dc681fb7@gmail.com \
    --to=maurooaranda@gmail.com \
    --cc=65468@debbugs.gnu.org \
    --cc=thievol@posteo.net \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).