emacs-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Syntax sugar question


From: Ergus
Subject: Syntax sugar question
Date: Sun, 11 Apr 2021 05:07:11 +0200

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 via email to

[Prev in Thread] Current Thread [Next in Thread]