Subject: bug#23460: 25.1.50; Strange behavior in local variables like start-comment

From: Kaushal Modi <[email-masked]>
Date: Thu, 05 May 2016 22:20:27 +0000

> I'll keep you posted.
OK, I was able to get a minimum working example sooner than I thought :)

Please save the below as test.el (or some file name; else revert-buffer
will not work), open it in emacs -Q and evaluate it.

===== test.el =====
(progn
  (defun my/print-comment-start-value ()
    (interactive)
    (message (format "`comment-start' = `%s'" comment-start)))

  (defun my/repeat-revert-buffer-noconfirm (count)
    (interactive "p")
    (dotimes (i count)
      (revert-buffer nil :noconfirm)))

  (add-hook 'outline-minor-mode-hook #'my/print-comment-start-value)
;  (remove-hook 'outline-minor-mode-hook #'my/print-comment-start-value)

  (global-set-key (kbd "<f5>") #'my/repeat-revert-buffer-noconfirm))

;; Local Variables:
;; eval: (outline-minor-mode 1)
;; End:
=====

In emacs 25.0.93 (emacs-25 build), after opening test.el, evaluating it and
hitting F5, I get below (which is good, expected):

‘comment-start’ = ‘;’ [2 times]

But in emacs 25.1.50 (master build), after opening test.el, evaluating it
and hitting F5, I get:

‘comment-start’ = ‘;’
‘comment-start’ = ‘nil’ [2 times]
‘comment-start’ = ‘;’

So it looks like the outline-minor-mode-hook is called twice more in the
master branch and also intermittently, the comment-start loses its buffer
local value.

Hope this mini test helps debug this.

> --

-- 
Kaushal Modi