From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!.POSTED!not-for-mail From: Stefan Monnier Newsgroups: gmane.emacs.devel Subject: Re: Why is custom--inhibit-theme-enable not t by default? Date: Wed, 13 Jun 2018 23:26:53 -0400 Message-ID: References: <10b7bd657091b074d8da1bf1ae35b1f4.squirrel@dancol.org> <83h8m8owp2.fsf@gnu.org> <48a7bd1277a18dd0a68d06cd8b022062.squirrel@dancol.org>> <83vaao3qrn.fsf@gnu.org>> <874li63iit.fsf@tcd.ie> NNTP-Posting-Host: blaine.gmane.org Mime-Version: 1.0 Content-Type: text/plain X-Trace: blaine.gmane.org 1528946749 22349 195.159.176.226 (14 Jun 2018 03:25:49 GMT) X-Complaints-To: usenet@blaine.gmane.org NNTP-Posting-Date: Thu, 14 Jun 2018 03:25:49 +0000 (UTC) User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/27.0.50 (gnu/linux) To: emacs-devel@gnu.org Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Thu Jun 14 05:25:45 2018 Return-path: Envelope-to: ged-emacs-devel@m.gmane.org Original-Received: from lists.gnu.org ([208.118.235.17]) by blaine.gmane.org with esmtp (Exim 4.84_2) (envelope-from ) id 1fTItL-0005dj-A8 for ged-emacs-devel@m.gmane.org; Thu, 14 Jun 2018 05:25:43 +0200 Original-Received: from localhost ([::1]:37964 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1fTIvS-0001vN-FY for ged-emacs-devel@m.gmane.org; Wed, 13 Jun 2018 23:27:54 -0400 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:43967) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1fTIun-0001uo-7U for emacs-devel@gnu.org; Wed, 13 Jun 2018 23:27:14 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1fTIui-0000Ef-2b for emacs-devel@gnu.org; Wed, 13 Jun 2018 23:27:13 -0400 Original-Received: from [195.159.176.226] (port=44506 helo=blaine.gmane.org) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1fTIuh-0000EX-Rm for emacs-devel@gnu.org; Wed, 13 Jun 2018 23:27:08 -0400 Original-Received: from list by blaine.gmane.org with local (Exim 4.84_2) (envelope-from ) id 1fTIsT-0004Wh-Md for emacs-devel@gnu.org; Thu, 14 Jun 2018 05:24:49 +0200 X-Injected-Via-Gmane: http://gmane.org/ Original-Lines: 30 Original-X-Complaints-To: usenet@blaine.gmane.org Cancel-Lock: sha1:f+NNKQnxmEVK9MepPaF60I0RAUk= X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] [fuzzy] X-Received-From: 195.159.176.226 X-BeenThere: emacs-devel@gnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: "Emacs development discussions." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Original-Sender: "Emacs-devel" Xref: news.gmane.org gmane.emacs.devel:226313 Archived-At: > > > Doesn't the command disable-theme undo the application of a custom > > > theme? > > > No. Summary: There is no function that takes a snapshot > > of the Emacs state (even, e.g., as a custom theme) before > > applying any custom theme - which snapshot can then be used > > to restore that pre-theme state. > > Perhaps we should redesign the way themes work > so that a theme is represented by data that says what it does, > and we could turn it on and off. I don't think we need to redesign them, really: we simply need to say that loading the file won't enable the theme any more. Also loading such a file should not have any "visible" side effect (same rule as for Elisp packages). If a theme needs to run arbitrary code, it simply needs to define its own global minor mode `my-foo-mode` and then within its custom settings, it needs to set `my-foo-mode` to t. Themes which follow these rules should work just fine in current Emacsen, so we can simply introduce this new rule, just like we did (a long time ago) when we decided that loading an Elisp file should be harmless. AFAICT the themes bundled with Emacs already obey the rule. Stefan