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: Fri, 14 Oct 2022 07:28:51 +0000 Message-ID: <874jw6j230.fsf@posteo.net> References: <12653550-6233-db76-c8a4-70bd80173a9b@gmail.com> <87czavicyf.fsf@posteo.net> <4dd18eb5-6f4c-3d14-c32a-f682c2dcd56d@gmail.com> Mime-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="37739"; mail-complaints-to="usenet@ciao.gmane.io" Cc: Lars Ingebrigtsen , Eli Zaretskii , Protesilaos Stavrou , 57639@debbugs.gnu.org To: Mauro Aranda Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Fri Oct 14 09:30:20 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 1ojF9A-0009gC-F3 for geb-bug-gnu-emacs@m.gmane-mx.org; Fri, 14 Oct 2022 09:30:20 +0200 Original-Received: from localhost ([::1]:38214 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1ojF98-00067u-6q for geb-bug-gnu-emacs@m.gmane-mx.org; Fri, 14 Oct 2022 03:30:18 -0400 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]:48974) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1ojF8s-00066z-ND for bug-gnu-emacs@gnu.org; Fri, 14 Oct 2022 03:30:02 -0400 Original-Received: from debbugs.gnu.org ([209.51.188.43]:36589) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1ojF8s-0005pn-EM for bug-gnu-emacs@gnu.org; Fri, 14 Oct 2022 03:30:02 -0400 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1ojF8s-0007Kt-96 for bug-gnu-emacs@gnu.org; Fri, 14 Oct 2022 03:30: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: Fri, 14 Oct 2022 07:30: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.166573254228090 (code B ref 57639); Fri, 14 Oct 2022 07:30:02 +0000 Original-Received: (at 57639) by debbugs.gnu.org; 14 Oct 2022 07:29:02 +0000 Original-Received: from localhost ([127.0.0.1]:35667 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1ojF7t-0007Io-Oh for submit@debbugs.gnu.org; Fri, 14 Oct 2022 03:29:02 -0400 Original-Received: from mout02.posteo.de ([185.67.36.66]:35309) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1ojF7q-0007IL-N6 for 57639@debbugs.gnu.org; Fri, 14 Oct 2022 03:29:00 -0400 Original-Received: from submission (posteo.de [185.67.36.169]) by mout02.posteo.de (Postfix) with ESMTPS id CCB9A240101 for <57639@debbugs.gnu.org>; Fri, 14 Oct 2022 09:28:52 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=posteo.net; s=2017; t=1665732532; bh=JIj6IoaqRNviZeBedO64Li08DASfZjL9lVKwrxL6Qp0=; h=From:To:Cc:Subject:Autocrypt:Date:From; b=N4D22EmN9CRd3v3V0C2bHyBfeWMHcaryD7Mgw1O/RjWhNtdttxpwn0Esil1E66VrS MiLuApVUt310mbx5fjqWAvBpgY3kSrUscl7idODtSRn1HabnyrEGfk/F5Z5HzUzY6B K0kqUYC0h14kNACP/7orjuiMDEsyJRTgGiUVsfeC8mtrh7zMQHeMfBwiPsGAzaNHXv MnBHNe3sMsRF49xGNzz8vFNFMlwkXqGY8vDOEV4samFsc2FzeYzT2EfzVFsdZ5+4pa PbEsFJwLlfj1lAoSeEyWKX2sHD2sSCjGKaMdtHRehlSHZCJsBVv95hQBaaA9QmKgm/ dHV7zdr6ArBAg== Original-Received: from customer (localhost [127.0.0.1]) by submission (posteo.de) with ESMTPSA id 4MpdKv4JKQz9rxF; Fri, 14 Oct 2022 09:28:51 +0200 (CEST) In-Reply-To: <4dd18eb5-6f4c-3d14-c32a-f682c2dcd56d@gmail.com> (Mauro Aranda's message of "Thu, 13 Oct 2022 19:53:19 -0300") 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:245377 Archived-At: Mauro Aranda writes: > Philip Kaludercic writes: > >> Mauro Aranda writes: >> >>> Hi Philip, >>> >>> Philip Kaludercic writes: >>> >>>> +Themes*} buffer.=C2=A0 The remaining arguments @var{properties} are u= sed >>>> +pass a property list with theme attributes. >>> >>> I think this added sentence is not clear. >>> >>> Also, no documentation for these special properties for toggling themes? >> >> Currently no. > > I hope there will be. I had to check the thread again, and the most that was said on the topic was in <87leqo978k.fsf@gnus.org>. So the idea would be to mention :family, :kind and :background-mode and state that anything else is undefined/shouldn't be used in case we decide to add another property in the future? We should also specify what valid values are. :family is just a symbol, :background-mode is either 'light or 'dark, but what about :kind? >>>> +(defun theme-choose-variant (&optional no-confirm no-enable) >>>> +=C2=A0 "Prompt to switch from the current theme to one of its a varia= nts. >>> >>> I'd say: "Command to switch..." >> >> Do you think it is necessary to point out that it is a command? > > OK, maybe not.=C2=A0 But why start with "Prompt to"? It is likely that it > will not prompt.=C2=A0 Why not get rid of it? Good point, so why not just Switch from the current theme to one of its a variants. >>>> +=C2=A0 (let ((active-color-schemes >>>> +=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 (seq-filter >>>> +=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 (lambda (theme) >>>> +=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 ;;= FIXME: As most themes currently do not have a `:kind' >>>> +=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 ;;= tag, it is assumed that a theme is a color scheme by >>>> +=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 ;;= default.=C2=A0 This should be reconsidered in the future. >>>> +=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 (m= emq (plist-get (get theme 'theme-properties) :kind) >>>> +=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2= =A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 '(color-scheme nil))) >>> >>> I think that theme writers who care about this functionality will add >>> :kind and :family to the themes, and those who don't won't bother with >>> that.=C2=A0 So I don't really see the point in supporting (:kind nil). >> >> :kind nil will probably not occur in practice, it is just that >> `plist-get' will return nil if no :kind is specified. > > I know that.=C2=A0 I didn't say a theme will pass :kind nil, I was referr= ing > to the FIXME.=C2=A0 But let me try to be clearer: I don't see the point in > special handling the absense of :kind. On reflection, I agree and will remove this. >>>> +=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 custom-enabled= -themes))) >>>> +=C2=A0=C2=A0=C2=A0 (cond >>>> +=C2=A0=C2=A0=C2=A0=C2=A0 ((length=3D active-color-schemes 0) >>>> +=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 (user-error "No theme is active, canno= t toggle")) >>> >>> This message will be confusing when there are themes whose :kind is not >>> color-scheme... >> >> How come?=C2=A0 Or do you think that we should explicitly clarify that >> `theme-choose-variant' is just for color-schemes? > > If you're filtering by :kind, and if there are themes that in the future > specify another :kind value, then you'll be saying that there's no theme > active but that won't be correct. > > > I use themes for setting variables too, as a > way to manage my config and change it quickly by {en|dis}abling them. > If I use a theme that supports this kind of toggling (like the modus > themes), I'll have to specify a :kind to my personal themes so that I > can toggle with toggle-theme. > > So, there is already a chance that another :kind values will show up, > and the message might become confusing. > > >>>> +=C2=A0=C2=A0=C2=A0=C2=A0 ((length> active-color-schemes 1) >>>> +=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 (user-error "More than one theme activ= e, cannot unambiguously >>>=C2=A0=C2=A0 toggle"))) >>>> +=C2=A0=C2=A0=C2=A0 (let* ((theme (car active-color-schemes)) >>>> +=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 (family = (plist-get (get theme 'theme-properties) :family))) >>>> +=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 (unless family >>>> +=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 (error "Theme `%s' does no= t have any known variants" theme)) >>> >>> This will pretty much always error with themes that don't really care >>> about toggling (see above).=C2=A0 Could you tell more about what is the >>> benefit of supporting (:kind nil)? >> >> I guess you are right in saying that nobody will set :family without >> setting :kind... But that won't change anything here, because what you >> describe is intended (a theme that has no variants, cannot be toggled.) > > See above.=C2=A0 I meant to discuss the FIXME and special handling the > absense of :kind.=C2=A0 I'd say it's not needed at all.=C2=A0 But of cour= se, > erroring out here is OK.