From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Philip Kaludercic Newsgroups: gmane.emacs.bugs Subject: bug#57639: [PATCH] Add new command 'toggle-theme' Date: Thu, 20 Oct 2022 17:42:52 +0000 Message-ID: <87wn8ujsrn.fsf@posteo.net> References: <875yhzmz25.fsf@posteo.net> <87wn99114w.fsf@posteo.net> <87wn98nlhq.fsf@gnus.org> <87lepo9c1e.fsf@posteo.net> <87r0zfkxzx.fsf@gnus.org> <87pmeyg24x.fsf@posteo.net> <87edvef8nc.fsf@gnus.org> <871qre2l63.fsf@posteo.net> <875ygqf7pc.fsf@gnus.org> <87r0ze15rt.fsf@posteo.net> <871qref5mq.fsf@gnus.org> <875ygohztx.fsf@posteo.net> <83tu489fm6.fsf@gnu.org> <8735bs3ta0.fsf@posteo.net> <87ilkn3jgj.fsf@posteo.net> <87ilkg472a.fsf@posteo.net> <87a65qla8d.fsf@posteo.net> Mime-Version: 1.0 Content-Type: text/plain Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="20417"; mail-complaints-to="usenet@ciao.gmane.io" Cc: Eli Zaretskii , 57639@debbugs.gnu.org, Stefan Kangas , larsi@gnus.org, info@protesilaos.com To: Stefan Monnier Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Thu Oct 20 19:43:09 2022 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 1olZZV-0005AP-9a for geb-bug-gnu-emacs@m.gmane-mx.org; Thu, 20 Oct 2022 19:43:09 +0200 Original-Received: from localhost ([::1] helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1olZZS-0001xt-1K for geb-bug-gnu-emacs@m.gmane-mx.org; Thu, 20 Oct 2022 13:43:06 -0400 Original-Received: from [::1] (helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1olZZR-0001nR-RP for geb-bug-gnu-emacs@m.gmane-mx.org; Thu, 20 Oct 2022 13:43:05 -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 1olZZO-0001nC-Vw for bug-gnu-emacs@gnu.org; Thu, 20 Oct 2022 13:43:03 -0400 Original-Received: from debbugs.gnu.org ([209.51.188.43]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1olZZO-0005ly-OU for bug-gnu-emacs@gnu.org; Thu, 20 Oct 2022 13:43:02 -0400 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1olZZO-0007Bw-JE for bug-gnu-emacs@gnu.org; Thu, 20 Oct 2022 13:43:02 -0400 X-Loop: help-debbugs@gnu.org Resent-From: Philip Kaludercic Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Thu, 20 Oct 2022 17:43:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 57639 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: patch Original-Received: via spool by 57639-submit@debbugs.gnu.org id=B57639.166628778127636 (code B ref 57639); Thu, 20 Oct 2022 17:43:02 +0000 Original-Received: (at 57639) by debbugs.gnu.org; 20 Oct 2022 17:43:01 +0000 Original-Received: from localhost ([127.0.0.1]:36084 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1olZZM-0007Bf-Qy for submit@debbugs.gnu.org; Thu, 20 Oct 2022 13:43:01 -0400 Original-Received: from mout02.posteo.de ([185.67.36.66]:42475) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1olZZL-0007BQ-B8 for 57639@debbugs.gnu.org; Thu, 20 Oct 2022 13:43:00 -0400 Original-Received: from submission (posteo.de [185.67.36.169]) by mout02.posteo.de (Postfix) with ESMTPS id CEE9C240106 for <57639@debbugs.gnu.org>; Thu, 20 Oct 2022 19:42:53 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=posteo.net; s=2017; t=1666287773; bh=tOW7qiu8j1bVE2pyM1WvJBDc+l0fDdSLNte+t0lsndo=; h=From:To:Cc:Subject:Autocrypt:Date:From; b=BA/EdZca4Y49oEoIHzNpuwobE8EIY/DhmnM2Gv2PBfZ4iutGCHSMCUUBEJHkqCDnQ g9fY6fb6Kn5ZgvfTnDFixgDFNORssLi2Ol/6GLHma1rmgd8zJ2fzEjIpZZwozbhxar lmOa8qTQM1WsXIZSVtVW7HPVZSY6lE/b9Tn3NXb2/d+D2G4mnBM14qZfVJIwzfgMxY eAt6RLPfGyT8is76lOLEjV32qq39I8b+EYLVvmdUHUQ08aEXxa22xiEzz9ZeznN5NT 7aUFGgvBRKkXL8ZyYXFUvYwIcGduaY2zFyZ48kRwqAoJ+qeNX5ddm3/7Jp3LYEp5m/ w8kfEekFxkbjw== Original-Received: from customer (localhost [127.0.0.1]) by submission (posteo.de) with ESMTPSA id 4MtZgc3XWCz9rxd; Thu, 20 Oct 2022 19:42:52 +0200 (CEST) In-Reply-To: (Stefan Monnier's message of "Thu, 20 Oct 2022 13:04:28 -0400") Autocrypt: addr=philipk@posteo.net; prefer-encrypt=nopreference; keydata= mDMEYHHqUhYJKwYBBAHaRw8BAQdAp3GdmYJ6tm5McweY6dEvIYIiry+Oz9rU4MH6NHWK0Ee0QlBo aWxpcCBLYWx1ZGVyY2ljIChnZW5lcmF0ZWQgYnkgYXV0b2NyeXB0LmVsKSA8cGhpbGlwa0Bwb3N0 ZW8ubmV0PoiQBBMWCAA4FiEEDM2H44ZoPt9Ms0eHtVrAHPRh1FwFAmBx6lICGwMFCwkIBwIGFQoJ CAsCBBYCAwECHgECF4AACgkQtVrAHPRh1FyTkgEAjlbGPxFchvMbxzAES3r8QLuZgCxeAXunM9gh io0ePtUBALVhh9G6wIoZhl0gUCbQpoN/UJHI08Gm1qDob5zDxnIHuDgEYHHqUhIKKwYBBAGXVQEF AQEHQNcRB+MUimTMqoxxMMUERpOR+Q4b1KgncDZkhrO2ql1tAwEIB4h4BBgWCAAgFiEEDM2H44Zo Pt9Ms0eHtVrAHPRh1FwFAmBx6lICGwwACgkQtVrAHPRh1Fw1JwD/Qo7kvtib8jy7puyWrSv0MeTS g8qIxgoRWJE/KKdkCLEA/jb9b9/g8nnX+UcwHf/4VfKsjExlnND3FrBviXUW6NcB 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" Xref: news.gmane.io gmane.emacs.bugs:245944 Archived-At: Stefan Monnier writes: >>>>> We could arrange for `autoload/loaddefs-gen` to recognize `deftheme` and >>>>> add the directory containing the file containing this `deftheme` to the >>>>> `custom-theme-load-path`. >>>> If this is possible I think this would be a nice idea. >>> It should be easy to do. >> Sadly I am stumped on how this could be done, as I have little >> experience with the bootstrapping process. Could you give me a few pointers? > > I was thinking of something like the patch below. > > > Stefan > > > diff --git a/lisp/emacs-lisp/loaddefs-gen.el b/lisp/emacs-lisp/loaddefs-gen.el > index ecc5f7e47bd..a07d0e9ad61 100644 > --- a/lisp/emacs-lisp/loaddefs-gen.el > +++ b/lisp/emacs-lisp/loaddefs-gen.el > @@ -286,8 +286,16 @@ loaddefs-generate--make-autoload > ;; Extract theme properties. > ((eq car 'deftheme) > (let* ((name (car-safe (cdr-safe form))) > - (props (nthcdr 3 form))) > - `(put ',name 'theme-properties (list ,@props)))) > + (props (nthcdr 3 form)) > + (dir (file-name-directory file))) > + `(progn > + (add-to-list 'custom-theme-load-path > + ,(if dir > + `(expand-file-name ,dir > + (file-name-directory > + (macroexp-file-name))) > + `(file-name-directory (macroexp-file-name)))) > + (put ',name 'theme-properties (list ,@props))))) > > ((eq car 'defgroup) > ;; In Emacs this is normally handled separately by cus-dep.el, but for Ah, I see. Initially my assumption was that you were talking about the automatic scraping of unannotated (deftheme ...) forms. I'll try this patch out, see how it works and report back.