From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Thierry Volpiatto Newsgroups: gmane.emacs.bugs Subject: bug#65468: 29.1; describe-theme fails to describe some themes not loaded Date: Wed, 23 Aug 2023 11:01:50 +0000 Message-ID: <878ra2dn9p.fsf@posteo.net> References: <87lee29m1c.fsf@posteo.net> Mime-Version: 1.0 Content-Type: multipart/signed; boundary="=-=-="; micalg=pgp-sha512; protocol="application/pgp-signature" Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="11953"; mail-complaints-to="usenet@ciao.gmane.io" Cc: 65468@debbugs.gnu.org To: Mauro Aranda Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Wed Aug 23 13:15:21 2023 Return-path: Envelope-to: geb-bug-gnu-emacs@m.gmane-mx.org Original-Received: from lists.gnu.org ([209.51.188.17]) by ciao.gmane.io with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1qYlpY-0002wt-7x for geb-bug-gnu-emacs@m.gmane-mx.org; Wed, 23 Aug 2023 13:15:20 +0200 Original-Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1qYlpF-0006NK-1H; Wed, 23 Aug 2023 07:15:01 -0400 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1qYlpD-0006N8-6B for bug-gnu-emacs@gnu.org; Wed, 23 Aug 2023 07:14:59 -0400 Original-Received: from debbugs.gnu.org ([2001:470:142:5::43]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1qYlpC-0003v0-Rz for bug-gnu-emacs@gnu.org; Wed, 23 Aug 2023 07:14:58 -0400 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1qYlpG-0005h0-5p for bug-gnu-emacs@gnu.org; Wed, 23 Aug 2023 07:15:02 -0400 X-Loop: help-debbugs@gnu.org Resent-From: Thierry Volpiatto Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Wed, 23 Aug 2023 11:15:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 65468 X-GNU-PR-Package: emacs Original-Received: via spool by 65468-submit@debbugs.gnu.org id=B65468.169278924921806 (code B ref 65468); Wed, 23 Aug 2023 11:15:02 +0000 Original-Received: (at 65468) by debbugs.gnu.org; 23 Aug 2023 11:14:09 +0000 Original-Received: from localhost ([127.0.0.1]:33001 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1qYloP-0005fe-3W for submit@debbugs.gnu.org; Wed, 23 Aug 2023 07:14:09 -0400 Original-Received: from mout01.posteo.de ([185.67.36.65]:51327) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1qYloN-0005fR-Gr for 65468@debbugs.gnu.org; Wed, 23 Aug 2023 07:14:08 -0400 Original-Received: from submission (posteo.de [185.67.36.169]) by mout01.posteo.de (Postfix) with ESMTPS id 83E9F240028 for <65468@debbugs.gnu.org>; Wed, 23 Aug 2023 13:13:58 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=posteo.net; s=2017; t=1692789238; bh=UtcrPPAR9jAJYwCwbL5O/O0bO0IrJnCcDbuNV5TYo/o=; h=From:To:Cc:Subject:Date:Message-ID:MIME-Version:From; b=WC6CjGOW7lCEGiK0z4RjjOFJQ1lu0jTcDbZuUcegMg2Br4bgSfgznA+WjahPZQgkm kgbDH1bM0Vd2/VgWYIS1zBLO0ZZSI0v/zX5iD+aH6GmzV02eiULRpX+4AUTFFRfLOE iC/2GVwWfpdCLRmVsAM0TvKrGpmAHxCngYEwFp13C9tyhF9UZxgMsAXOCPIlShPO+j WiAKivyOprGNixwbAzoGfmprTN9CWsC7IZM1BYZEeAS4V3I7euZ9OU3eEhV6Xk6oXO v09hFUk78dXWm05bKJR91sFS5o3FiA8gihUUKZZyy1LdMjaYRSs26NdjXrKdtZqwcs rwx4DYfXNpDZw== Original-Received: from customer (localhost [127.0.0.1]) by submission (posteo.de) with ESMTPSA id 4RW3W926fcz9rxH; Wed, 23 Aug 2023 13:13:56 +0200 (CEST) In-reply-to: X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list X-BeenThere: bug-gnu-emacs@gnu.org List-Id: "Bug reports for GNU Emacs, the Swiss army knife of text editors" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Original-Sender: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Xref: news.gmane.io gmane.emacs.bugs:268223 Archived-At: --=-=-= Content-Type: text/plain Content-Transfer-Encoding: quoted-printable Mauro Aranda writes: > Thierry Volpiatto 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. Maybe. >> >> 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. Yes. >> 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. For the themes that are in Emacs, should be easy to fix. > 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. It seems the themes installed from package are already loaded, not sure if it is true for all of them though. For what is `describe-theme-1` patch is is always better to cover more use cases even if not all cases are covered (e.g. modus themes), however having a new function that fetch documentation from file would be great and reusable elsewhere (I have here - in helm - to write my own function to= get the first line documentation of a theme). > >> 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. Good, thanks. =2D-=20 Thierry --=-=-= Content-Type: application/pgp-signature; name="signature.asc" -----BEGIN PGP SIGNATURE----- iQHHBAEBCgAxFiEEI9twfRN7r3nig/xwDsVtFB0W75MFAmTl6fITHHRoaWV2b2xA cG9zdGVvLm5ldAAKCRAOxW0UHRbvk37iC/4pc+SOQZj+e319MaC8sfkoW1GB+pC6 bKw3iztNX2LbWt96nVcFMQ++slw+QYxIyU6e50q6Dsd1H3YdpwnWiotX0HP9M82G 5uNgIs/8vzScw+nYPu3H5tfPz9tDSp/ImoXl6GmqC13lNzOpwv3VUoa9LAh0Y9HB SmeIxYztVDn4gQk0Rp6AoV8uF1e1/m/vdhRqGaurdF6RzqMjrnNXn/PTLIAXOg7E HMdx/wAUbCQTWLWgPkDwk4llFuR9NQ36oxD8TneoHwdcQiilz99A1FobYoPznLms 4tyhOwR8zAYzBktIgWNAkof3oRCvx5A6WnhMeK6if4aRjk7F24650aMubzHCaBHX oYoHNnn+FldmcODo/hsJp4HwRpAupD1v+88WzEUTyLsnRt+surVNLqMgdP3lUKxW i9Ag7Nc7rA3c1+gcXZBpqzaqasFSL7bI2+jJH6z1oR2pkLiqvDVfij2oHkARZ7mM kxeAIqLpfRC+oDxASomF7m+Dwi8E0w1R8OA= =YiZa -----END PGP SIGNATURE----- --=-=-=--