From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Mauro Aranda Newsgroups: gmane.emacs.bugs Subject: bug#57639: [PATCH] Add new command 'toggle-theme' Date: Thu, 13 Oct 2022 19:53:19 -0300 Message-ID: <4dd18eb5-6f4c-3d14-c32a-f682c2dcd56d@gmail.com> References: <12653550-6233-db76-c8a4-70bd80173a9b@gmail.com> <87czavicyf.fsf@posteo.net> Mime-Version: 1.0 Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 8bit Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="31804"; mail-complaints-to="usenet@ciao.gmane.io" User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:102.0) Gecko/20100101 Thunderbird/102.2.2 Cc: Lars Ingebrigtsen , Eli Zaretskii , Protesilaos Stavrou , 57639@debbugs.gnu.org To: Philip Kaludercic Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Fri Oct 14 00:54:31 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 1oj75z-000832-5A for geb-bug-gnu-emacs@m.gmane-mx.org; Fri, 14 Oct 2022 00:54:31 +0200 Original-Received: from localhost ([::1]:37990 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1oj75y-0003Z4-94 for geb-bug-gnu-emacs@m.gmane-mx.org; Thu, 13 Oct 2022 18:54:30 -0400 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]:48818) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1oj75X-00033r-0a for bug-gnu-emacs@gnu.org; Thu, 13 Oct 2022 18:54:03 -0400 Original-Received: from debbugs.gnu.org ([209.51.188.43]:36153) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1oj75W-0006vf-PC for bug-gnu-emacs@gnu.org; Thu, 13 Oct 2022 18:54:02 -0400 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1oj75W-0000RM-BX for bug-gnu-emacs@gnu.org; Thu, 13 Oct 2022 18:54:02 -0400 X-Loop: help-debbugs@gnu.org Resent-From: Mauro Aranda Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Thu, 13 Oct 2022 22:54: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.16657016131631 (code B ref 57639); Thu, 13 Oct 2022 22:54:02 +0000 Original-Received: (at 57639) by debbugs.gnu.org; 13 Oct 2022 22:53:33 +0000 Original-Received: from localhost ([127.0.0.1]:35231 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1oj752-0000QF-Vm for submit@debbugs.gnu.org; Thu, 13 Oct 2022 18:53:33 -0400 Original-Received: from mail-oi1-f182.google.com ([209.85.167.182]:37412) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1oj74y-0000Px-Fv for 57639@debbugs.gnu.org; Thu, 13 Oct 2022 18:53:31 -0400 Original-Received: by mail-oi1-f182.google.com with SMTP id j188so3347388oih.4 for <57639@debbugs.gnu.org>; Thu, 13 Oct 2022 15:53:28 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=content-transfer-encoding:in-reply-to:from:references:cc:to :content-language:subject:user-agent:mime-version:date:message-id :from:to:cc:subject:date:message-id:reply-to; bh=YpjHSnPH6HDKnecDekYcCIg/FmTKxZGrk9kE0+kENPU=; b=Eb1EbPEplYbCS/4RyMtrwJitbmjTEFiXo7FwqqqXATyKX3UL2QxZS8SVj7vpPklSrD D4glqQrtK+xr778rdXkFDAi0oeDb+8BbTNEU4r1lhxRgCgjgYovxfrD6GyKubxUB0NQK Ih414ZKBOq7aRWnGMiOaWBpSq8TZRPANcxYglzxUxhVgI+Ccyq1YjAAlbwucuVV0PJ1g F1T5o8cZFU17pWmKBmlaNqPpKKlcOJ6ma2YnDgX/tkhajsi/NLXTzKrq6T62EoTAkyb9 VI3pfuX439HlPjTJmtDAkiv71wIURuUP3IAS7FWAWZP/tcRy5jiumPdgtzdZ0+rGEs3f aMyg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=content-transfer-encoding:in-reply-to:from:references:cc:to :content-language:subject:user-agent:mime-version:date:message-id :x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=YpjHSnPH6HDKnecDekYcCIg/FmTKxZGrk9kE0+kENPU=; b=n4tW7T6b4axmUREQ/f/0uG6aWmHrJjNlFCIxmhjGzNuvSGwCTq5oJnjgrpc0OT2yLK ROqc9qmjA/kL5DU69hy/2O7hvTLQ878yF3+UelqugCjkUH/jW2g9skAXqILMPSA3OMxb ryk78DXksnPB3wNGDbTMALT++10w2KmP3AkFLC3xHSZyxkaqDRzSzW0SjTU4wyHE6dzK msaHbU5To36CGIiizQ0WFp55Cue7kOfM44NUGf8R10PZswCGJ9WT2RpCUKXfea3OlBDO 66PkaTiihRJg5gyxLGqBEAnMcfz0uPXfmzhfmsaOZbTxYfs9r5AuA+/lYBcnWczpSYSr 1fnQ== X-Gm-Message-State: ACrzQf25rLrc/aY5mV9/Wzq4pzFzIxYG9wEYBlx5f7daKM9pNUdpFen7 uEasNheC24nsN0sRg3Nks2Q= X-Google-Smtp-Source: AMsMyM6rJY4mIraig0EdHX784A61k02ffdgKSAmteu3qKSx63HD/lws5nmuwgqoCAS+JHWaQT/Qwpg== X-Received: by 2002:aca:1106:0:b0:355:1196:8f73 with SMTP id 6-20020aca1106000000b0035511968f73mr1067509oir.236.1665701602644; Thu, 13 Oct 2022 15:53:22 -0700 (PDT) Original-Received: from [192.168.0.234] ([181.228.28.240]) by smtp.gmail.com with ESMTPSA id bd18-20020a056808221200b00354e8bc0236sm419067oib.34.2022.10.13.15.53.20 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Thu, 13 Oct 2022 15:53:22 -0700 (PDT) Content-Language: en-US In-Reply-To: <87czavicyf.fsf@posteo.net> 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:245360 Archived-At: Philip Kaludercic writes: > Mauro Aranda writes: > >> Hi Philip, >> >> Philip Kaludercic writes: >> >>> +Themes*} buffer.  The remaining arguments @var{properties} are used >>> +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. >>> +(defun theme-choose-variant (&optional no-confirm no-enable) >>> +  "Prompt to switch from the current theme to one of its a variants. >> >> I'd say: "Command to switch..." > > Do you think it is necessary to point out that it is a command? OK, maybe not.  But why start with "Prompt to"? It is likely that it will not prompt.  Why not get rid of it? >>> +  (let ((active-color-schemes >>> +         (seq-filter >>> +          (lambda (theme) >>> +            ;; FIXME: As most themes currently do not have a `:kind' >>> +            ;; tag, it is assumed that a theme is a color scheme by >>> +            ;; default.  This should be reconsidered in the future. >>> +            (memq (plist-get (get theme 'theme-properties) :kind) >>> +                  '(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.  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.  I didn't say a theme will pass :kind nil, I was referring to the FIXME.  But let me try to be clearer: I don't see the point in special handling the absense of :kind. >>> +          custom-enabled-themes))) >>> +    (cond >>> +     ((length= active-color-schemes 0) >>> +      (user-error "No theme is active, cannot toggle")) >> >> This message will be confusing when there are themes whose :kind is not >> color-scheme... > > How come?  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. >>> +     ((length> active-color-schemes 1) >>> +      (user-error "More than one theme active, cannot unambiguously >>   toggle"))) >>> +    (let* ((theme (car active-color-schemes)) >>> +           (family (plist-get (get theme 'theme-properties) :family))) >>> +      (unless family >>> +        (error "Theme `%s' does not have any known variants" theme)) >> >> This will pretty much always error with themes that don't really care >> about toggling (see above).  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.  I meant to discuss the FIXME and special handling the absense of :kind.  I'd say it's not needed at all.  But of course, erroring out here is OK.