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 13:12:28 +0000 Message-ID: <87a5uhq4qp.fsf@posteo.net> References: <87lee29m1c.fsf@posteo.net> <83cyzerne5.fsf@gnu.org> 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="39251"; mail-complaints-to="usenet@ciao.gmane.io" Cc: 65468@debbugs.gnu.org To: Eli Zaretskii Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Wed Aug 23 15:17:29 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 1qYnjk-0009tv-2O for geb-bug-gnu-emacs@m.gmane-mx.org; Wed, 23 Aug 2023 15:17:28 +0200 Original-Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1qYnjL-0002N3-QK; Wed, 23 Aug 2023 09:17:03 -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 1qYnjG-0002MY-NO for bug-gnu-emacs@gnu.org; Wed, 23 Aug 2023 09:16:58 -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 1qYnjG-0005cU-FF for bug-gnu-emacs@gnu.org; Wed, 23 Aug 2023 09:16:58 -0400 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1qYnjJ-0003Ax-Ng for bug-gnu-emacs@gnu.org; Wed, 23 Aug 2023 09:17:01 -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 13:17:01 +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.169279656212130 (code B ref 65468); Wed, 23 Aug 2023 13:17:01 +0000 Original-Received: (at 65468) by debbugs.gnu.org; 23 Aug 2023 13:16:02 +0000 Original-Received: from localhost ([127.0.0.1]:33154 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1qYniM-00039a-6a for submit@debbugs.gnu.org; Wed, 23 Aug 2023 09:16:02 -0400 Original-Received: from mout02.posteo.de ([185.67.36.66]:38535) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1qYniJ-000393-S0 for 65468@debbugs.gnu.org; Wed, 23 Aug 2023 09:16:01 -0400 Original-Received: from submission (posteo.de [185.67.36.169]) by mout02.posteo.de (Postfix) with ESMTPS id B3213240104 for <65468@debbugs.gnu.org>; Wed, 23 Aug 2023 15:15:49 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=posteo.net; s=2017; t=1692796549; bh=3Qt9HPbocbxIaWS4dTQ1GD3AnXuuS9U8ls6WGgy3Afc=; h=From:To:Cc:Subject:Date:Message-ID:MIME-Version:Autocrypt:OpenPGP: From; b=a7xWyA4UhSMpLBAfin5v6LMm7+U4GJ2bUAKifeJ/um3eQwAsYM8IRr5F0fMJrT+Aw GpUMTFNOw6+V8UUpgXXI8gengyF2cmlKJ4Pena/D6mfOxxFjVi6PF7/UJqABmQjVBx rGWYBy8GpjFP3Hr9W5fULEEGUU3afb5rZB/25ZUtXMeRGNMk0nj/j0T6+QjDpt1KQ/ G3a1ZrTm6/PzwmN9iGesFINt3Nug+uuc30vBM/IWJiq1or2/hgdcpvhMVlY+DKYxvz MSkVJM5NHbKvZdgLBClVSSEAdV9FtW+2/MDVaS2BCbZOWn2B7KXfP3e+ZgS+z2HWZt xTD0XSqlITeQg== Original-Received: from customer (localhost [127.0.0.1]) by submission (posteo.de) with ESMTPSA id 4RW6Cj5kspz9rxD; Wed, 23 Aug 2023 15:15:45 +0200 (CEST) In-reply-to: <83cyzerne5.fsf@gnu.org> Autocrypt: addr=thievol@posteo.net; prefer-encrypt=mutual; keydata=xsDNBF8ylcIBDADG+hy+zR6L4/vbdDDZuSaMmSrU3A5QZJpeBCvxTr7MpzzruZbhLPW1K3R6N2MAedi8Y+C8o27FVRIjpdbaKMGu9je7JV/TbUQYo3SOwCK1vM4LUn4V6ZLzSYkuiEt4eyMoiDdyvN0pkcK6P9x9DCetcEVszXzQg+yzCVrQ2hXWDXWT4M18EC3wtO7RHPouMqGiwBFhBAYErCqFWFxQHkfbtG/4yGyJ58rglb65O3qijjMWvYwcWZun9/7qm8Z4/4mHopmo2zgU+OrptnLSZfkZGz3Y7Uf452xQGVq0Fv75NPvQru7y+DYVhuVXXyAmGxt+vf4rIiixMBbhKEPjcxEPAa2LTzex2IsTZR+QVG9uDnqCWcgaOEQ58fzXNvNhtwwF/Rgio2XWAJVdmFWS59/k9W58CIUSNKBMZh2XeGdEmtHvDtCxW3z6FJha36RzOM3fMNNiAGdFZJA84gcdloJR+sHCDTTPT3784fjr+V8An7sI581NGFzkRQqPvEQCZbUAEQEAAc0SdGhpZXZvbEBwb3N0ZW8ubmV0wsEOBBMBCgA4AhsDBQsJCAcCBhUKCQgLAgQWAgMBAh4BAheAFiEEI9twfRN7r3nig/xwDsVtFB0W75MFAmL3HCoACgkQDsVtFB0W75OVEAv/f6XxmtIFz08fUb8hBp/zJP6IC4/rhhh+0GMRIRzLN8DK0jV8JCzYdFHiRJOy2lNIOpmrrCmjRRxferc2G42+ePFIsslxhU46VSz1Z83NwIG3mpdYNV5WUTUdgzx ExHTNTFCd7NKv0nlHKQaAtdXm5bYnSHsnL7cx8z OpenPGP: url=https://posteo.de/keys/thievol@posteo.net.asc; preference=encrypt 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:268240 Archived-At: --=-=-= Content-Type: text/plain Content-Transfer-Encoding: quoted-printable Eli Zaretskii writes: >> From: Thierry Volpiatto >> Date: Wed, 23 Aug 2023 08:44:16 +0000 >>=20 >>=20 >> This because `describe-theme-1` is not looping in buffer to find >> `deftheme` definition. > > We never did better, did we? IOW, this issue exists for a long time, > right? > > If so, I think this should go to master, not to the emacs-29 branch. I will not push anything, just proposing patch if any interest to fix this issue, here a new patch that provide a separate function for this part of code: diff --git a/lisp/cus-theme.el b/lisp/cus-theme.el index 5d3f2585976..c6c9d9c892b 100644 =2D-- a/lisp/cus-theme.el +++ b/lisp/cus-theme.el @@ -490,6 +490,29 @@ It includes all faces in list FACES." (with-current-buffer standard-output (describe-theme-1 theme)))) =20 +(defun describe-theme-from-file (&optional file short) + "Describe theme from its file FILE without loading it. + +If FILE is nil try to find the file from the theme name in +`custom-theme-load-path'. +If SHORT is non nil show only the first line of documentation." + (let ((file (or file + (locate-file (concat (symbol-name theme) "-theme.el") + (custom-theme--load-path) + '("" "c"))))) + (with-temp-buffer + (insert-file-contents file) + (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 (if short + (car (split-string (nth 2 sexp) "\n")) + (nth 2 sexp)))))))))) + (defun describe-theme-1 (theme) (prin1 theme) (princ " is a custom theme") @@ -510,16 +533,9 @@ It includes all faces in list FACES." (princ "It is loaded but disabled.")) (setq doc (get theme 'theme-documentation))) (princ "It is not loaded.") =2D ;; Attempt to grab the theme documentation + ;; Attempt to grab the theme documentation from file. (when fn =2D (with-temp-buffer =2D (insert-file-contents fn) =2D (let ((sexp (let ((read-circle nil)) =2D (condition-case nil =2D (read (current-buffer)) =2D (end-of-file nil))))) =2D (and (eq (car-safe sexp) 'deftheme) =2D (setq doc (nth 2 sexp))))))) + (setq doc (describe-theme-from-file fn)))) (princ "\n\nDocumentation:\n") (princ (if (stringp doc) (substitute-command-keys doc) =2D-=20 Thierry --=-=-= Content-Type: application/pgp-signature; name="signature.asc" -----BEGIN PGP SIGNATURE----- iQHHBAEBCgAxFiEEI9twfRN7r3nig/xwDsVtFB0W75MFAmTmBn4THHRoaWV2b2xA cG9zdGVvLm5ldAAKCRAOxW0UHRbvk3J0C/0Tn/omzwaXoy9P1r5LZ64WmXfGp3m/ 7DJmFCvJItjeX8ZTmNcVCKCztVJsAzw6Ad9Tn2Tov997szt0PXEaGfN4Ttj9npY/ jOi8fXjy9NA7ifx0ttjT7R5iP8+5GCFSl+NgsBJVX+ETkrFKac+R9lWzQ/F5eIpU lkEahQbJ4skq/Ce14hauuZvnx0/s2TqSjF5GeF5sqmm+AFq7t5CYUoUUNU9gm21/ OqZrNhjry3vhCx4j1JR6b7MMEU0aNLSIO8dlXqIpVIIR82KOFUqu5bOkq5TX+xgd HojaPkmJefhWPRIk64ESaiA4lbieGCSJK+aWnfD/bpihFZsvCf3wYUu66xrFGoAq dQD83iUY6cAYeFU8emLRYCq/opMIwxWuaxHpw2AP1xY982CrtJxh6+8Dks022Mzf RVe+R0XsMaNbDRPYv+uTtOobvZwMtsYAAqz590XQkSm5q7GgAps3s17kflry/wZm E40PlnDf8Nt4skTNO2GBQEPvneLtSdlF1Wk= =rGz+ -----END PGP SIGNATURE----- --=-=-=--