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

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

Re: minor-mode hook not run


From: Stefan Monnier
Subject: Re: minor-mode hook not run
Date: Tue, 20 Mar 2018 16:31:53 -0400
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/27.0.50 (gnu/linux)

> (define-minor-mode foo
                     ^^^
This should likely be `foo-mode`.

>   "Do something" nil " FOO"}

Is the above } intended?

>   :keymap foo-map

[ I strongly recommend not to use :keymap argument and just name your
  minor mode map `<MINORMODE>-map`.  ]

>   (cond
>    ((eq major-mode 'abc)

It's usually better to test (derived-mode-p 'abc).

>     (add-hook 'foo-mode-hook 'foo-load-abc nil t)

Adding elements to one's own hook here definitely deserve a "bug ugly
hack" comment explaining why you'd want to do it that way.

In any case, the minor mode `foo` will run `foo-hook` but not
`foo-mode-hook` (which would be run by the `foo-mode` minor mode).


        Stefan




reply via email to

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