emacs-devel
[Top][All Lists]
Advanced

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

Re: [Emacs-diffs] emacs-26 ee512e9: Ignore buffers whose name begins wit


From: Kaushal Modi
Subject: Re: [Emacs-diffs] emacs-26 ee512e9: Ignore buffers whose name begins with a space in save-some-buffers
Date: Tue, 19 Sep 2017 13:25:03 +0000

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.

[1]: https://github.com/veripool/verilog-mode/blob/ecdaea3386bee9d38520914e458d4860da644773/verilog-mode.el#L3969 
--

Kaushal Modi


reply via email to

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