emacs-devel
[Top][All Lists]
Advanced

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

A criticism of `make-minor-mode'


From: Alan Mackenzie
Subject: A criticism of `make-minor-mode'
Date: Sun, 4 Sep 2011 16:06:24 +0000
User-agent: Mutt/1.5.21 (2010-09-15)

Hi, Emacs.

There's a bug which has been bugging me quite some time, namely
gpm-mouse-mode's argument is the other way round.  i.e., if you evaluate

    (gpm-mouse-mode 1)

, the mode is turned off and the message area says it's enabled.  If you
evaluate

    (gpm-mouse-mode 0)

, the mode is turned on and the message area says it's disabled.

This should be pretty simple to fix, shouldn't it?  It's code is in
t-mouse.el.  Actually no, it isn't - because it uses the macro
`define-minor-mode'.  So the code to toggle the mode is fragmented, some
of it being in t-mouse.el, the rest of it in easy-mmode.el.  So there's
contextless executable code in gpm-mouse-mode, which means I've got to
look up a doc string to see what it all means.

So, that sinking feeling sets in.  Can I be bothered to fix this bug?
No - at least, not at the moment.  I can't even be bothered to submit a
bug report at the moment - for a start, nobody else is interested enough
to fix it.  If it were a straight defun, then yes it would be simple.
In fact if it had been a straight defun, the author wouldn't have been
confused enough to write the bug in the first place.

make-minor-mode is a fearsome thing, with two required args, 3 optional
ones and a whole host of optional "colon args" after that.  The effort
in simply writing explicit code for a minor mode must be less than
getting your head round such a complicated macro.

Can we not somehow eschew this sort of complexity?

-- 
Alan Mackenzie (Nuremberg, Germany).



reply via email to

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