unofficial mirror of emacs-devel@gnu.org 
 help / color / mirror / code / Atom feed
From: Ergus <spacibba@aol.com>
To: emacs-devel@gnu.org
Subject: Syntax sugar question
Date: Sun, 11 Apr 2021 05:07:11 +0200	[thread overview]
Message-ID: <20210411030711.cpbbesqkuipt3lzc@Ergus> (raw)
In-Reply-To: 20210411030711.cpbbesqkuipt3lzc.ref@Ergus

Hi:

Following something mentioned before I would like to repeat a question
that IMO is so simple that there may be a reason why it is not
implemented in this way.

Why the minor modes variables are only t or nil?

At the moment when we want to configure certain behavior we need to set
an extra custom or create a secondary mode like:

(setq myvar 'something)
(mymode-name 1)

or

(mymode-name 1)
(mymode-name-auxiliar 1)

and of course in the code we need to check both and add the extra config
in the init file for the user.

Some modes need that myvar will be set before because in the minor-mode
  function there is code like:

```
(if mymode-name 
     (if (eq myvar 'something)
         bla
        foo)
    elsething)
```

So finally the question is:

Does it makes sense to add the possibility in define-minor-mode and
related functions in order to do:

(mymode-name 'something)

So mymode-name will be 'something, myvar will disappear and the above
code could become simpler either using cond and or pcase and a single
nesting level condition?

In principle this won't break backward compatibility and may improve
readability and simplify several conditions.

Does it makes sense?

Best,
Ergus



       reply	other threads:[~2021-04-11  3:07 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <20210411030711.cpbbesqkuipt3lzc.ref@Ergus>
2021-04-11  3:07 ` Ergus [this message]
2021-04-11 12:59   ` Syntax sugar question Stefan Monnier
2021-04-11 19:42   ` Nikolay Kudryavtsev

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=20210411030711.cpbbesqkuipt3lzc@Ergus \
    --to=spacibba@aol.com \
    --cc=emacs-devel@gnu.org \
    /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).