From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Stefan Monnier Newsgroups: gmane.emacs.devel Subject: Get rid of verilog-no-change-functions Date: Sat, 12 Sep 2015 00:22:01 -0400 Message-ID: NNTP-Posting-Host: plane.gmane.org Mime-Version: 1.0 Content-Type: text/plain X-Trace: ger.gmane.org 1442031748 19929 80.91.229.3 (12 Sep 2015 04:22:28 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Sat, 12 Sep 2015 04:22:28 +0000 (UTC) Cc: emacs-devel@gnu.org To: Wilson Snyder Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Sat Sep 12 06:22:20 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 1ZacKR-0004K3-6R for ged-emacs-devel@m.gmane.org; Sat, 12 Sep 2015 06:22:19 +0200 Original-Received: from localhost ([::1]:59454 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ZacKQ-0007Qy-8z for ged-emacs-devel@m.gmane.org; Sat, 12 Sep 2015 00:22:18 -0400 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:39544) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ZacKF-0007Qa-29 for emacs-devel@gnu.org; Sat, 12 Sep 2015 00:22:07 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1ZacKB-0006TQ-Ni for emacs-devel@gnu.org; Sat, 12 Sep 2015 00:22:07 -0400 Original-Received: from ironport2-out.teksavvy.com ([206.248.154.181]:17657) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ZacKB-0006SV-K3 for emacs-devel@gnu.org; Sat, 12 Sep 2015 00:22:03 -0400 X-IronPort-Anti-Spam-Filtered: true X-IronPort-Anti-Spam-Result: A0BrEwA731xV/zi6xEVcgxABhAGFVbs3CYFLgzOCTQQCgT45FAEBAQEBAQGBCkEFhDkjKSYmGA0kiD/PIyyQP4Q0BYtEk1OGaY0/gUUjggocgW4igngBAQE X-IPAS-Result: A0BrEwA731xV/zi6xEVcgxABhAGFVbs3CYFLgzOCTQQCgT45FAEBAQEBAQGBCkEFhDkjKSYmGA0kiD/PIyyQP4Q0BYtEk1OGaY0/gUUjggocgW4igngBAQE X-IronPort-AV: E=Sophos;i="5.13,465,1427774400"; d="scan'208";a="164613852" Original-Received: from 69-196-186-56.dsl.teksavvy.com (HELO fmsmemgm.homelinux.net) ([69.196.186.56]) by ironport2-out.teksavvy.com with ESMTP/TLS/DHE-RSA-AES256-SHA; 12 Sep 2015 00:22:02 -0400 Original-Received: by fmsmemgm.homelinux.net (Postfix, from userid 20848) id C396AAE12C; Sat, 12 Sep 2015 00:22:01 -0400 (EDT) User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/25.0.50 (gnu/linux) X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 206.248.154.181 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:189851 Archived-At: I believe the patch below replaces a workaround with an actual fix. It's indeed unsafe to call syntax-ppss when before-change-functions is let-bound, but the patch avoids the problem by not let-binding before-change-functions, relying on the cleaner inhibit-modification-hooks, which was introduced way back in Emacs-21 for similar reasons. Any objection to my applying this to Emacs's version of verilog-mode.el? Stefan diff --git a/lisp/progmodes/verilog-mode.el b/lisp/progmodes/verilog-mode.el index 5fcdba6..0f90d60 100644 --- a/lisp/progmodes/verilog-mode.el +++ b/lisp/progmodes/verilog-mode.el @@ -408,10 +408,6 @@ This function may be removed when Emacs 21 is no longer supported." ;; And GNU Emacs 22 has obsoleted last-command-char last-command-event))) -(defvar verilog-no-change-functions nil - "True if `after-change-functions' is disabled. -Use of `syntax-ppss' may break, as ppss's cache may get corrupted.") - (defvar verilog-in-hooks nil "True when within a `verilog-run-hooks' block.") @@ -422,14 +418,13 @@ Set `verilog-in-hooks' during this time, to assist AUTO caches." (run-hooks ,@hooks))) (defun verilog-syntax-ppss (&optional pos) - (when verilog-no-change-functions - (if verilog-in-hooks - (verilog-scan-cache-flush) - ;; else don't let the AUTO code itself get away with flushing the cache, - ;; as that'll make things very slow - (backtrace) - (error "%s: Internal problem; use of syntax-ppss when cache may be corrupt" - (verilog-point-text)))) + (if verilog-in-hooks + (verilog-scan-cache-flush) + ;; else don't let the AUTO code itself get away with flushing the cache, + ;; as that'll make things very slow + (backtrace) + (error "%s: Internal problem; use of syntax-ppss when cache may be corrupt" + (verilog-point-text))) (if (fboundp 'syntax-ppss) (syntax-ppss pos) (parse-partial-sexp (point-min) (or pos (point))))) @@ -3230,9 +3225,7 @@ user-visible changes to the buffer must not be within a (buffer-undo-list t) (inhibit-read-only t) (inhibit-point-motion-hooks t) - (verilog-no-change-functions t) - before-change-functions - after-change-functions + (inhibit-modification-hooks t) deactivate-mark buffer-file-name ; Prevent primitives checking buffer-file-truename) ; for file modification @@ -3246,9 +3239,7 @@ 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)) (progn ,@body))) (defvar verilog-save-font-mod-hooked nil