Subject: Re: bug#28229: 26.0.50; outline-minor-mode-hook run twice when reverting buffer

From: Eli Zaretskii <[email-masked]>
Date: Fri, 25 Aug 2017 16:08:01 +0300

> From: Kaushal Modi <[email-masked]>
> Date: Fri, 25 Aug 2017 12:14:23 +0000
> 
> I recently discovered an anomaly with my outline mode customization and it boiled down to this unexplained
> behavior.. the outline-minor-mode-hook was getting triggered twice on doing revert-buffer.

Isn't this expected behavior?  revert-buffer calls normal-mode, which
first kills all local variables, which involves turning off
outline-minor-mode by calling

  (outline-minor-mode -1)

And that calls your hook.

The other time is when normal-mode turns outline-minor-mode ON.

The doc string of outline-minor-mode-hook (and any other hook created
by define-minor-mode) clearly says:

  Hook run after entering or leaving ‘outline-minor-mode’.