bug-gnu-emacs
[Top][All Lists]
Advanced

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

bug#32643: 26; minor-mode variables


From: Andreas Röhler
Subject: bug#32643: 26; minor-mode variables
Date: Sat, 8 Sep 2018 19:53:49 +0200
User-agent: Mozilla/5.0 (X11; Linux i686; rv:52.0) Gecko/20100101 Thunderbird/52.9.1

On 08.09.2018 15:58, Drew Adams wrote:
   > Why should it not have a variable
   > Why should `auto-fill-mode' be an exception?

Because it isn't straightforward to do that.

It may be possible with some work.
Would you like to write the change?

Noam's message points out the use of :variable in defining this minor mode. I 
don't understand `define-minor-mode' and its :variable
enough to propose a simple fix. Maybe someone else does?

In this case, the PLACE value of `:variable PLACE' is this generalized
variable:

(auto-fill-function
   . (lambda (v) (setq auto-fill-function
        (if v normal-auto-fill-function))))

Is there a way, for example, to defvaralias `auto-fill-mode' to
`auto-fill-function' (or vice versa), so that that :variable value
would somehow have the effect of automatically keeping
`auto-fill-mode' updated to the same value? Or some other
wayt to easily accomplish the same thing?

If there is no straightforward way to get `auto-fill-mode' to
remain synced with `auto-fill-function', and if it's necessary
to have two separate variables, then OK, for this particular
variable.

As I said earlier, it's good that the doc string, at least, makes
clear that non-nil `auto-fill-function' means the mode is on.

The bug report is more general, asking generally about minor
modes that have no mode variable, and what reasons/criteria
there might be for such cases. This one apparently has a
reason - it is not just a "historical accident". Dunno whether
there are others that could just have their variables defined
with no complications.




AFAIU setting such a variable would be helpful in all cases. It would provide a consistent way to check if the mode is on.







reply via email to

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