From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Stefan Monnier via "Bug reports for GNU Emacs, the Swiss army knife of text editors" Newsgroups: gmane.emacs.bugs Subject: bug#57639: [PATCH] Add new command 'toggle-theme' Date: Tue, 18 Oct 2022 22:43:14 -0400 Message-ID: References: <875yhzmz25.fsf@posteo.net> <87o7v97zy2.fsf@gnus.org> <87bkr9newj.fsf@posteo.net> <871qs57yai.fsf@gnus.org> <87y1udlzlt.fsf@posteo.net> <87o7v953uf.fsf@gnus.org> <87tu50nca7.fsf@posteo.net> <87a6652lyb.fsf@posteo.net> <875ygtqdho.fsf@gnus.org> <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> Reply-To: Stefan Monnier Mime-Version: 1.0 Content-Type: text/plain Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="20859"; mail-complaints-to="usenet@ciao.gmane.io" User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/29.0.50 (gnu/linux) Cc: Philip Kaludercic , larsi@gnus.org, info@protesilaos.com, 57639@debbugs.gnu.org To: Eli Zaretskii Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Wed Oct 19 04:44:11 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 1okz3y-0005FJ-Bs for geb-bug-gnu-emacs@m.gmane-mx.org; Wed, 19 Oct 2022 04:44:10 +0200 Original-Received: from localhost ([::1]:49336 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1okz3x-0005Hw-1r for geb-bug-gnu-emacs@m.gmane-mx.org; Tue, 18 Oct 2022 22:44:09 -0400 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]:50670) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1okz3q-0005He-Jq for bug-gnu-emacs@gnu.org; Tue, 18 Oct 2022 22:44:02 -0400 Original-Received: from debbugs.gnu.org ([209.51.188.43]:56261) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1okz3q-0001If-7P for bug-gnu-emacs@gnu.org; Tue, 18 Oct 2022 22:44:02 -0400 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1okz3q-0008Fc-2O for bug-gnu-emacs@gnu.org; Tue, 18 Oct 2022 22:44:02 -0400 X-Loop: help-debbugs@gnu.org Resent-From: Stefan Monnier Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Wed, 19 Oct 2022 02:44: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.166614741231673 (code B ref 57639); Wed, 19 Oct 2022 02:44:02 +0000 Original-Received: (at 57639) by debbugs.gnu.org; 19 Oct 2022 02:43:32 +0000 Original-Received: from localhost ([127.0.0.1]:55339 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1okz3M-0008En-Ab for submit@debbugs.gnu.org; Tue, 18 Oct 2022 22:43:32 -0400 Original-Received: from mailscanner.iro.umontreal.ca ([132.204.25.50]:47283) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1okz3I-0008EY-Vl for 57639@debbugs.gnu.org; Tue, 18 Oct 2022 22:43:30 -0400 Original-Received: from pmg2.iro.umontreal.ca (localhost.localdomain [127.0.0.1]) by pmg2.iro.umontreal.ca (Proxmox) with ESMTP id 76A9A80814; Tue, 18 Oct 2022 22:43:22 -0400 (EDT) Original-Received: from mail01.iro.umontreal.ca (unknown [172.31.2.1]) by pmg2.iro.umontreal.ca (Proxmox) with ESMTP id E27DC805B2; Tue, 18 Oct 2022 22:43:20 -0400 (EDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=iro.umontreal.ca; s=mail; t=1666147400; bh=olzZLbbgkncIhyGGnbtBUeeXOprf1tzQ/ycIgsVuZ3Y=; h=From:To:Cc:Subject:In-Reply-To:References:Date:From; b=ELZsaxu/RHp+4n7noJFtcPt9LsZPazt+1Z53j4jRdZ8+xZQpiw1s33ELBwbcONqtG PhCHN9SXntPxvSI8hMu/VuL4Vv6t+F1JtjwltQhOOnSIvzhYe61rswzfKYw14UKMZA xOP58MdK3DdHeY4S17gCMdGWQDwERT/0CZHVGsgPs9gH694+FunXfRYuJmX3nso989 U+SOAKormDDyLU7Z8RWqrSfOOkWGFwBXxk7F855fnZv7HZBM8XTG34LQ5SVPSuqzmM PWqlnV78iArM8UcOAp2xK0iaKVJ0VjJeggpPgX1PYslpt0VW6Q6GauSnHTfcjLvf43 s1fKL1W+SsX5Q== Original-Received: from pastel (65-110-220-202.cpe.pppoe.ca [65.110.220.202]) by mail01.iro.umontreal.ca (Postfix) with ESMTPSA id A6479120F42; Tue, 18 Oct 2022 22:43:20 -0400 (EDT) In-Reply-To: <83tu489fm6.fsf@gnu.org> (Eli Zaretskii's message of "Thu, 13 Oct 2022 13:34:25 +0300") 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:245841 Archived-At: >> > I think you'd basically put something like the following into >> > `loaddefs-generate--emacs-batch' -- >> > >> > (let ((lisp-mode-autoload-regexp >> > "^;;;###\\(\\(noexist\\)-\\)?\\(theme-autoload\\)")) Hmm... `lisp-mode-autoload-regexp` is defined as a `defconst`. If we're going to set it to some other value, we should change its definition to a `defvar`, no? Also, this code should come with a comment explaining why we're doing this silly dance (it took me a while to go from that code to here). [ I don't understand the "noexist" thingy, BTW. Is that intended to be a regexp that will never match? Should it use `regexp-unmatchable` then? Or why not just "^;;;###\\(?3:theme-autoload\\)"? ] >> > (loaddefs-generate >> > (expand-file-name "../etc/themes/" lisp-directory) >> > (expand-file-name "theme-loaddefs.el" lisp-directory))) Note that if one of those ;;;###theme-autoload cookies is placed in front of a function definition, it will still result in a broken: (autoload 'FUNCTIONNAME "etc/themes/FILENAME" ...) which fails because "etc/themes/FILENAME" isn't found in `load-path`. >> > Then you have to teach `loaddefs-generate--make-autoload' to generate >> > the correct forms as a result of the `deftheme' -- which should be some >> > `put's. >> >> OK, it looks like this worked. Just to recap, these are the proposed >> changes: > > What, if anything, does this mean for themes that aren't bundled with > Emacs? > > Also, this needs a NEWS entry. I see this got the following entry: ** Themes have special autoload cookies. All build-in themes are scraped for ;;;###theme-autoload cookies that are loaded along with the regular auto-loaded code. but I can't see any good reason why Emacs users should care about that. It seems like a purely internal hack (and given the restrictions on what can be autoloaded this way, we probably shouldn't advertise it too loudly, unless accompanied with appropriate warnings). Stefan