Subject: bug#1243: Verilog mode hanging emacs 22.2

From: "Mitchell, Paul" <[email-masked]>
Date: Mon, 27 Oct 2008 10:38:13 -0400

Stefan,

I ran this against my test case just now and emacs no longer hangs.  I'm
moving back to version 22, and will let you know if I see this again,
but it seems fixed.

Thanks for your help,
Paul

-----Original Message-----
From: Stefan Monnier [mailto:[email-masked]] 
Sent: Monday, October 27, 2008 10:21 AM
To: Mitchell, Paul
Cc: [email-masked]; [email-masked]; Bilik,
Scott; Wilson Snyder
Subject: Re: bug#1243: Verilog mode hanging emacs 22.2

> I ran emacs under gdb, from within the src directory.  I then edited
the
> file that exhibits this problem and did a few incremental searches.
> This caused emacs to hang.  I tried to break out of this from gdb
using
> ctrl-c, which killed emacs so that I could not use xbacktrace.  Then,
> from the gdb prompt I used: "handle SIGINT stop", got back to the
hang,
> and tried ctrl-c again.  I now was able to use xbacktrace, and see
this:

> (gdb) xbacktrace
> "re-search-backward" (0x86f1eeb)
> "verilog-beg-of-defun" (0x87cfd85)
> "byte-code" (0x8234d13)
> "verilog-syntax-ppss" (0x831e8c9)
> "verilog-skip-backward-comment-or-string" (0x8811595)
> "verilog-beg-of-defun" (0x87cfd85)
> "byte-code" (0x8234d13)
> "verilog-syntax-ppss" (0x831e8c9)

I believe the patch below will fix it.  Wilson, WDYT?

        Stefan

--- verilog-mode.el.~1.24.~	2008-09-12 12:39:48.000000000 -0400
+++ verilog-mode.el	2008-10-27 10:18:58.000000000 -0400
@@ -2373,6 +2373,8 @@
 		   ;; Fontify things in translate off regions
 		   '(verilog-match-translate-off
                      (0 'verilog-font-lock-translate-off-face
prepend))))))
+  ;; FIXME: This XEmacs setting is redundant with the setting done
later
+  ;; for Emacs (because XEmacs obeys's Emacs setting as well).
   (put 'verilog-mode 'font-lock-defaults
        '((verilog-font-lock-keywords
 	  verilog-font-lock-keywords-1
@@ -2560,10 +2562,17 @@
 
   ;; Stuff for GNU Emacs
   (set (make-local-variable 'font-lock-defaults)
-       '((verilog-font-lock-keywords verilog-font-lock-keywords-1
+       `((verilog-font-lock-keywords verilog-font-lock-keywords-1
                                      verilog-font-lock-keywords-2
                                      verilog-font-lock-keywords-3)
-         nil nil nil verilog-beg-of-defun))
+         nil nil nil
+         ,(if (functionp 'syntax-ppss)
+              ;; verilog-beg-of-defun uses syntax-ppss, and syntax-ppss
uses
+              ;; font-lock-beginning-of-syntax-function, so
+              ;; font-lock-beginning-of-syntax-function, can't use
+              ;; verilog-beg-of-defun.
+              nil
+            verilog-beg-of-defun)))
   ;;------------------------------------------------------------
   ;; now hook in 'verilog-colorize-include-files
(eldo-mode.el&spice-mode.el)
   ;; all buffer local: