unofficial mirror of bug-gnu-emacs@gnu.org 
 help / color / mirror / code / Atom feed
From: Mauro Aranda <maurooaranda@gmail.com>
To: Philip Kaludercic <philipk@posteo.net>
Cc: Lars Ingebrigtsen <larsi@gnus.org>, Eli Zaretskii <eliz@gnu.org>,
	Protesilaos Stavrou <info@protesilaos.com>,
	57639@debbugs.gnu.org
Subject: bug#57639: [PATCH] Add new command 'toggle-theme'
Date: Thu, 13 Oct 2022 19:53:19 -0300	[thread overview]
Message-ID: <4dd18eb5-6f4c-3d14-c32a-f682c2dcd56d@gmail.com> (raw)
In-Reply-To: <87czavicyf.fsf@posteo.net>

Philip Kaludercic <philipk@posteo.net> writes:

 > Mauro Aranda <maurooaranda@gmail.com> writes:
 >
 >> Hi Philip,
 >>
 >> Philip Kaludercic <philipk@posteo.net> 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.

<Personal experience alert>
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.
<End of alert>

 >>> +     ((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.






  reply	other threads:[~2022-10-13 22:53 UTC|newest]

Thread overview: 102+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-09-07  7:19 bug#57639: [PATCH] Add new command 'toggle-theme' Philip Kaludercic
2022-09-07  8:06 ` Stefan Kangas
2022-09-07  8:33   ` Philip Kaludercic
2022-09-07  8:51     ` Stefan Kangas
2022-09-07 13:03 ` Lars Ingebrigtsen
2022-09-07 13:31   ` Philip Kaludercic
2022-09-08 11:46     ` Lars Ingebrigtsen
2022-09-11  8:26       ` Philip Kaludercic
2022-09-11 11:11         ` Lars Ingebrigtsen
2022-09-11 11:22           ` Lars Ingebrigtsen
2022-09-11 11:42           ` Philip Kaludercic
2022-09-11 11:54             ` Lars Ingebrigtsen
2022-09-11 18:47               ` Philip Kaludercic
2022-09-12 10:10                 ` Lars Ingebrigtsen
2022-09-12 11:06                   ` Philip Kaludercic
2022-09-12 11:12                     ` Lars Ingebrigtsen
2022-09-12 13:11                   ` Po Lu via Bug reports for GNU Emacs, the Swiss army knife of text editors
2022-09-12 14:51                     ` Michael Albinus
2022-09-13 12:09                       ` Po Lu via Bug reports for GNU Emacs, the Swiss army knife of text editors
2022-09-12 15:26                     ` Philip Kaludercic
2022-09-13  2:25                       ` Po Lu via Bug reports for GNU Emacs, the Swiss army knife of text editors
2022-09-13 11:10                     ` Lars Ingebrigtsen
2022-09-14 11:38                 ` Philip Kaludercic
2022-09-14 13:03                   ` Lars Ingebrigtsen
2022-09-14 14:37                     ` Philip Kaludercic
2022-09-14 15:21                       ` Lars Ingebrigtsen
2022-09-17 18:13                         ` Philip Kaludercic
2022-09-17 18:32                           ` Eli Zaretskii
2022-09-17 21:33                             ` Philip Kaludercic
2022-09-18  6:53                               ` Eli Zaretskii
2022-09-18  9:38                                 ` Philip Kaludercic
2022-09-18 10:39                                   ` Lars Ingebrigtsen
2022-09-18 11:39                                     ` Philip Kaludercic
2022-09-19  7:58                                       ` Lars Ingebrigtsen
2022-09-19  8:05                                         ` Philip Kaludercic
2022-09-19  8:15                                           ` Lars Ingebrigtsen
2022-09-19 10:13                                             ` Philip Kaludercic
2022-09-20 21:08                                               ` Philip Kaludercic
2022-09-20 21:11                                                 ` Lars Ingebrigtsen
2022-09-20 21:35                                                   ` Philip Kaludercic
2022-09-21 11:02                                                     ` Lars Ingebrigtsen
2022-09-21 11:30                                                       ` Philip Kaludercic
2022-09-21 11:38                                                         ` Lars Ingebrigtsen
2022-09-21 11:46                                                           ` Philip Kaludercic
2022-09-21 12:06                                                             ` Lars Ingebrigtsen
2022-09-21 12:26                                                               ` Philip Kaludercic
2022-10-09 12:58                                                                 ` Philip Kaludercic
2022-10-09 14:26                                                                   ` Lars Ingebrigtsen
2022-10-09 15:13                                                                     ` Philip Kaludercic
2022-10-09 20:32                                                                       ` Stefan Kangas
2022-10-09 21:02                                                                         ` Philip Kaludercic
2022-10-09 21:43                                                                           ` Philip Kaludercic
2022-10-10  0:56                                                                             ` Stefan Kangas
2022-10-10  1:17                                                                         ` Protesilaos Stavrou
2022-10-10  8:16                                                                           ` Philip Kaludercic
2022-10-10  8:14                                                                       ` Lars Ingebrigtsen
2022-10-10 11:02                                                                         ` Philip Kaludercic
2022-10-11  0:25                                                                           ` Lars Ingebrigtsen
2022-10-11  9:06                                                                             ` Philip Kaludercic
2022-10-11 19:43                                                                               ` Lars Ingebrigtsen
2022-10-11 19:51                                                                                 ` Philip Kaludercic
2022-10-11 20:04                                                                                   ` Lars Ingebrigtsen
2022-10-11 20:09                                                                                     ` Philip Kaludercic
2022-10-11 20:49                                                                                       ` Lars Ingebrigtsen
2022-10-13  8:50                                                                                         ` Philip Kaludercic
2022-10-13  9:10                                                                                           ` Philip Kaludercic
2022-10-13 10:34                                                                                           ` Eli Zaretskii
2022-10-13 10:35                                                                                             ` Philip Kaludercic
2022-10-13 14:03                                                                                               ` Stefan Kangas
2022-10-13 14:07                                                                                                 ` Philip Kaludercic
2022-10-19  2:46                                                                                                   ` Stefan Monnier via Bug reports for GNU Emacs, the Swiss army knife of text editors
2022-10-19  7:16                                                                                                     ` Philip Kaludercic
2022-10-19 12:21                                                                                                       ` Stefan Monnier via Bug reports for GNU Emacs, the Swiss army knife of text editors
     [not found]                                                                                                         ` <87a65qla8d.fsf@posteo.net>
2022-10-20 17:04                                                                                                           ` Stefan Monnier via Bug reports for GNU Emacs, the Swiss army knife of text editors
2022-10-20 17:42                                                                                                             ` Philip Kaludercic
2022-10-20 20:01                                                                                                               ` Stefan Monnier via Bug reports for GNU Emacs, the Swiss army knife of text editors
2022-10-19  2:43                                                                                             ` Stefan Monnier via Bug reports for GNU Emacs, the Swiss army knife of text editors
2022-10-19  7:20                                                                                               ` Philip Kaludercic
2022-10-19 10:59                                                                                               ` Eli Zaretskii
2022-10-19 12:25                                                                                                 ` Stefan Monnier via Bug reports for GNU Emacs, the Swiss army knife of text editors
2022-10-13 19:12                                                                                           ` Lars Ingebrigtsen
2022-10-13 20:21                                                                                             ` Philip Kaludercic
2022-09-21 13:08                                                             ` Protesilaos Stavrou
2022-09-21 13:13                                                               ` Philip Kaludercic
2022-09-21 13:21                                                                 ` Protesilaos Stavrou
2022-09-21 13:05                                                           ` Protesilaos Stavrou
2022-09-18 12:52                                   ` Eli Zaretskii
2022-09-18 12:56                                     ` Philip Kaludercic
2022-09-20  3:40                                       ` bug#57639: Toggling, in general Richard Stallman
2022-09-20  8:07                                         ` Philip Kaludercic
2022-09-21  2:47                                           ` Richard Stallman
2022-09-21  9:22                                             ` Robert Pluim
2022-09-20 12:20                                         ` Visuwesh
2022-10-13 20:46 ` bug#57639: [PATCH] Add new command 'toggle-theme' Mauro Aranda
2022-10-13 22:19   ` Philip Kaludercic
2022-10-13 22:53     ` Mauro Aranda [this message]
2022-10-14  7:28       ` Philip Kaludercic
2022-10-14 11:22         ` Mauro Aranda
2022-10-14 15:21           ` Philip Kaludercic
2022-10-14 18:20           ` Philip Kaludercic
2022-10-15 15:24             ` Philip Kaludercic
2022-10-14  6:11     ` Eli Zaretskii

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://www.gnu.org/software/emacs/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=4dd18eb5-6f4c-3d14-c32a-f682c2dcd56d@gmail.com \
    --to=maurooaranda@gmail.com \
    --cc=57639@debbugs.gnu.org \
    --cc=eliz@gnu.org \
    --cc=info@protesilaos.com \
    --cc=larsi@gnus.org \
    --cc=philipk@posteo.net \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).