From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: wsnyder@wsnyder.org (Wilson Snyder) Newsgroups: gmane.emacs.devel Subject: Re: Get rid of verilog-no-change-functions Date: Mon, 14 Sep 2015 17:09:22 -0400 Message-ID: <7qfv2gzp19.fsf@emma.svaha.wsnyder.org> NNTP-Posting-Host: plane.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-Trace: ger.gmane.org 1442264985 31789 80.91.229.3 (14 Sep 2015 21:09:45 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Mon, 14 Sep 2015 21:09:45 +0000 (UTC) Cc: , emacs-devel@gnu.org To: Stefan Monnier Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Mon Sep 14 23:09:40 2015 Return-path: Envelope-to: ged-emacs-devel@m.gmane.org Original-Received: from lists.gnu.org ([208.118.235.17]) by plane.gmane.org with esmtp (Exim 4.69) (envelope-from ) id 1Zbb0N-00048c-Ag for ged-emacs-devel@m.gmane.org; Mon, 14 Sep 2015 23:09:39 +0200 Original-Received: from localhost ([::1]:43538 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Zbb0M-0003ud-Te for ged-emacs-devel@m.gmane.org; Mon, 14 Sep 2015 17:09:38 -0400 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:53034) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Zbb0B-0003iP-Rc for emacs-devel@gnu.org; Mon, 14 Sep 2015 17:09:28 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1Zbb08-0000Qa-Jo for emacs-devel@gnu.org; Mon, 14 Sep 2015 17:09:27 -0400 Original-Received: from vpo3.wsnyder.org ([173.230.154.183]:60486 helo=wsnyder.org) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Zbb08-0000Pr-Ex for emacs-devel@gnu.org; Mon, 14 Sep 2015 17:09:24 -0400 X-ssh-sendmail: true User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/23.3 (gnu/linux) X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-Received-From: 173.230.154.183 X-BeenThere: emacs-devel@gnu.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: "Emacs development discussions." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Original-Sender: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Xref: news.gmane.org gmane.emacs.devel:189956 Archived-At: >> + (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. You're right of course, we use defvar everywhere else; not sure why the older code there did that. Fixed all three. >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. The default byte-compile warns. We always want to be as warning free as possible, even on XEmacs. >> @@ -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. The child functions perform hundreds of thousands of minor changes, then call the hooks on everything. Doing it this way makes an update maybe 10 seconds versus (as it once did) many minutes - which was almost unusable. At the end of everything fontification is correct. New patch below - if OK would you like to apply or shall I? diff --git a/verilog-mode.el b/verilog-mode.el index 57063b5..97eedd3 100644 --- a/verilog-mode.el +++ b/verilog-mode.el @@ -230,10 +230,9 @@ STRING should be given if the last search was by `string-match' on STRING." `(customize ,var)) ) - (unless (boundp 'inhibit-point-motion-hooks) - (defvar inhibit-point-motion-hooks nil)) - (unless (boundp 'deactivate-mark) - (defvar deactivate-mark nil)) + (defvar inhibit-modification-hooks) + (defvar inhibit-point-motion-hooks) + (defvar deactivate-mark) ) ;; ;; OK, do this stuff if we are NOT XEmacs: @@ -3230,9 +3229,8 @@ user-visible changes to the buffer must not be within a (buffer-undo-list t) (inhibit-read-only t) (inhibit-point-motion-hooks t) + (inhibit-modification-hooks t) (verilog-no-change-functions t) - before-change-functions - after-change-functions deactivate-mark buffer-file-name ; Prevent primitives checking buffer-file-truename) ; for file modification @@ -3246,9 +3244,8 @@ user-visible changes to the buffer must not be within a "Execute BODY forms, disabling all change hooks in BODY. For insignificant changes, see instead `verilog-save-buffer-state'." `(let* ((inhibit-point-motion-hooks t) - (verilog-no-change-functions t) - before-change-functions - after-change-functions) + (inhibit-modification-hooks t) + (verilog-no-change-functions t)) (progn ,@body))) (defvar verilog-save-font-mod-hooked nil