all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
* A criticism of `make-minor-mode'
@ 2011-09-04 16:06 Alan Mackenzie
  2011-09-06 13:37 ` Stefan Monnier
  2011-09-07  7:55 ` Glenn Morris
  0 siblings, 2 replies; 4+ messages in thread
From: Alan Mackenzie @ 2011-09-04 16:06 UTC (permalink / raw)
  To: emacs-devel

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).



^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: A criticism of `make-minor-mode'
  2011-09-04 16:06 A criticism of `make-minor-mode' Alan Mackenzie
@ 2011-09-06 13:37 ` Stefan Monnier
  2011-09-06 18:22   ` Stefan Monnier
  2011-09-07  7:55 ` Glenn Morris
  1 sibling, 1 reply; 4+ messages in thread
From: Stefan Monnier @ 2011-09-06 13:37 UTC (permalink / raw)
  To: Alan Mackenzie; +Cc: emacs-devel

> 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

In which sense is it "turned off"?  Is gpm-mouse-mode nil or are the
mouse events not caught by Emacs?

>     (gpm-mouse-mode 0)
> , the mode is turned on and the message area says it's disabled.

Can you reproduce it from "emacs -Q"?

> Can we not somehow eschew this sort of complexity?

Only at the cost of other complexity: the fact that every minor mode
would then behave is slightly different ways and that changing the
behavior of all minor modes would be pretty much impossible.
That's what we used to have and I didn't like it.

I suspect your problem has to do with the ":init-value t" (just because
I know this part is basically wrong tho it works OK in the "main" use case).


        Stefan



^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: A criticism of `make-minor-mode'
  2011-09-06 13:37 ` Stefan Monnier
@ 2011-09-06 18:22   ` Stefan Monnier
  0 siblings, 0 replies; 4+ messages in thread
From: Stefan Monnier @ 2011-09-06 18:22 UTC (permalink / raw)
  To: Alan Mackenzie; +Cc: emacs-devel

>> (gpm-mouse-mode 1)
>> , the mode is turned off and the message area says it's enabled.  If you
>> evaluate

BTW, this sounds very odd, because the message should only be output in
interactive use, not when calling (gpm-mouse-mode 1).


        Stefan



^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: A criticism of `make-minor-mode'
  2011-09-04 16:06 A criticism of `make-minor-mode' Alan Mackenzie
  2011-09-06 13:37 ` Stefan Monnier
@ 2011-09-07  7:55 ` Glenn Morris
  1 sibling, 0 replies; 4+ messages in thread
From: Glenn Morris @ 2011-09-07  7:55 UTC (permalink / raw)
  To: Alan Mackenzie; +Cc: emacs-devel

Alan Mackenzie wrote:

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

Uhm, this seems like a self-fulfilling prophecy.

> Can we not somehow eschew this sort of complexity?

Don't you maintain cc-mode? ;)



^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2011-09-07  7:55 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2011-09-04 16:06 A criticism of `make-minor-mode' Alan Mackenzie
2011-09-06 13:37 ` Stefan Monnier
2011-09-06 18:22   ` Stefan Monnier
2011-09-07  7:55 ` Glenn Morris

Code repositories for project(s) associated with this external index

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

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.