[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: Get rid of verilog-no-change-functions
From: |
Stefan Monnier |
Subject: |
Re: Get rid of verilog-no-change-functions |
Date: |
Sat, 12 Sep 2015 16:21:23 -0400 |
User-agent: |
Gnus/5.13 (Gnus v5.13) Emacs/25.0.50 (gnu/linux) |
> 3. This code was originally developed on Emacs 21 so it's
> odd that inhibit-modification-hooks wasn't sufficient.
inhibit-modification-hooks was new in Emacs-21 and not widely known, so
I'm really not surprised. Even nowadays it's still common to see people
let-binding after-change-functions instead of inhibit-modification-hooks.
> But the the verilog-mode.el code also works on ancient XEmacs.
> This is annoying for our code, but we still get bug reports
> occasionally so are reluctant to abandon it. At a minimum
> inhibit-modification-hooks needs to be defined to prevent XEmacs
> compile warnings.
AFAIK my patch should work just as well at least for the
verilog-save-buffer-state part since XEmacs doesn't run
after-change-functions for text-property modifications.
For verilog-save-no-change-functions, I don't understand what is the
intention behind preventing after-change-functions (it intuitively seems
wrong, so I'm obviously missing something).
> + (unless (boundp 'inhibit-modification-hooks)
> + (defvar inhibit-modification-hooks nil))
No, no, no, no!
Just use
(defvar inhibit-modification-hooks)
if you want to silence the byte-compiler.
But AFAIK as long you don't switch to "lexical-binding:t", no
byte-compiler will complain if you let-bind an unknown variable without
using it, so even that (defvar inhibit-modification-hooks) is
not indispensable.
> @@ -3231,6 +3233,7 @@ user-visible changes to the buffer must not be within a
> (inhibit-read-only t)
> (inhibit-point-motion-hooks t)
> + (inhibit-modification-hooks t) ; Emacs 21+
> (verilog-no-change-functions t)
> before-change-functions
> after-change-functions
> deactivate-mark
Here it's important to remove before-change-functions and
after-change-functions.
> @@ -3247,6 +3250,7 @@ user-visible changes to the buffer must not be within a
> For insignificant changes, see instead `verilog-save-buffer-state'."
> `(let* ((inhibit-point-motion-hooks t)
> + (inhibit-modification-hooks t)
> (verilog-no-change-functions t)
> before-change-functions
> after-change-functions)
> (progn ,@body)))
As mentioned, here I'd have to understand why we need to prevent
*-change-functions from running. After all, this is used in places
where we make very significant changes to the buffer and where font-lock
(for instance) would want to know about it.
Stefan