On Tue, Sep 19, 2017 at 9:00 AM Stefan Monnier <
address@hidden> wrote:
> This was fallout from 9b980e269, aka bug #28412, where now we prompt for
> buffers that have functions in the `write-contents-functions' hook.
Ah, I see I was looking at the wrong version of the code, sorry.
So the question becomes: why does " *Code-Fontify*" have a non-nil
write-contents-functions?
It's because ggtags.el enables the major mode from the actual file in this temp " *Code-Fontify*" buffer by calling (funcall mode) in ggtags-fontify-code.
And in my case, the verilog-mode is setting the write-contents-hooks (old name of write-contents-functions)[1].
Looking at ggtags.el, I also wonder why the buffer survives the call to
ggtags-fontify-code. I would have expected ggtags-fontify-code to look
more like:
(cl-defun ggtags-fontify-code (code &optional (mode major-mode))
(cl-check-type mode function)
(cl-typecase code ;; FIXME: Using `stringp` is more efficient.
((not string) code)
(string
(with-temp-buffer
(insert code)
;; FIXME: `delay-mode-hooks' needs a comment
(delay-mode-hooks (funcall mode))
(font-lock-ensure)
(buffer-string)))))
I will start this discussion on the ggtags.el repo. Thanks.