GNU bug report logs - #54730
28.1; vhdl-update-sensitivity-list not working in Windows

Previous Next

Package: emacs;

Reported by: Cyril Arnould <cyril.arnould <at> outlook.com>

Date: Tue, 5 Apr 2022 16:27:02 UTC

Severity: normal

Found in version 28.1

Done: Eli Zaretskii <eliz <at> gnu.org>

Bug is archived. No further changes may be made.

Full log


View this message in rfc822 format

From: Stefan Monnier <monnier <at> iro.umontreal.ca>
To: Robert Pluim <rpluim <at> gmail.com>
Cc: Reto Zimmermann <reto <at> gnu.org>, Eli Zaretskii <eliz <at> gnu.org>, "54730 <at> debbugs.gnu.org" <54730 <at> debbugs.gnu.org>, Cyril Arnould <cyril.arnould <at> outlook.com>
Subject: bug#54730: AW: bug#54730: 28.1; vhdl-update-sensitivity-list not working in Windows
Date: Tue, 05 Apr 2022 17:21:35 -0400
Robert Pluim [2022-04-05 20:09:28] wrote:

>>>>>> On Tue, 5 Apr 2022 17:53:20 +0000, Cyril Arnould <cyril.arnould <at> outlook.com> said:
>
>     Cyril> Nice, it’s working! Too bad this didn’t make it into the 28.1
>     Cyril> release, I guess I should have
>     Cyril> tested more. So for now the solution is to keep the vhdl-mode.el
>     Cyril> locally until it finds its
>     Cyril> way into a maintenance release?
>
> Yes. Eli might decide to put it in 28.2
>
> An alternative (shorter) fix would be this. Stefan, is there a
> preference for how these types of lexical-binding bugs are fixed?

It's a question of style and local details.
E.g. whether you want to preserve compatibility with Emacs<24 or XEmacs.
Personally I dislike such abuses of `eval`, so I'd replace it with
`funcall` as in the (100% untested) patch below.


        Stefan


diff --git a/lisp/progmodes/vhdl-mode.el b/lisp/progmodes/vhdl-mode.el
index c6693b4de53..7bb07343ae0 100644
--- a/lisp/progmodes/vhdl-mode.el
+++ b/lisp/progmodes/vhdl-mode.el
@@ -8374,6 +8374,52 @@ vhdl-update-sensitivity-list-buffer
      (message "Updating sensitivity lists...done")))
   (when noninteractive (save-buffer)))
 
+(defconst vhdl--signal-regions-functions
+  (list
+   ;; right-hand side of signal/variable assignment
+   ;; (special case: "<=" is relational operator in a condition)
+   (lambda (proc-end)
+     (when (vhdl-re-search-forward "[<:]=" proc-end t)
+       (save-excursion
+	 (vhdl-re-search-forward ";\\|\\<\\(then\\|loop\\|report\\|severity\\|is\\)\\>" proc-end t))))
+   ;; if condition
+   (lambda (proc-end)
+     (when (vhdl-re-search-forward "^\\s-*if\\>" proc-end t)
+       (save-excursion (vhdl-re-search-forward "\\<then\\>" proc-end t))))
+   ;; elsif condition
+   (lambda (proc-end)
+     (when (vhdl-re-search-forward "\\<elsif\\>" proc-end t)
+       (save-excursion (vhdl-re-search-forward "\\<then\\>" proc-end t))))
+   ;; while loop condition
+   (lambda (proc-end)
+     (when (vhdl-re-search-forward "^\\s-*while\\>" proc-end t)
+       (save-excursion (vhdl-re-search-forward "\\<loop\\>" proc-end t))))
+   ;; exit/next condition
+   (lambda (proc-end)
+     (when (vhdl-re-search-forward "\\<\\(exit\\|next\\)\\s-+\\w+\\s-+when\\>" proc-end t)
+       (save-excursion (vhdl-re-search-forward ";" proc-end t))))
+   ;; assert condition
+   (lambda (proc-end)
+     (when (vhdl-re-search-forward "\\<assert\\>" proc-end t)
+       (save-excursion
+	 (vhdl-re-search-forward "\\(\\<report\\>\\|\\<severity\\>\\|;\\)"
+		                 proc-end t))))
+   ;; case expression
+   (lambda (proc-end)
+     (when (vhdl-re-search-forward "^\\s-*case\\>" proc-end t)
+       (save-excursion (vhdl-re-search-forward "\\<is\\>" proc-end t))))
+   ;; parameter list of procedure call, array index
+   (lambda (proc-end)
+     (when (re-search-forward "^\\s-*\\(\\w\\|\\.\\)+[ \t\n\r\f]*(" proc-end t)
+       (forward-char -1)
+       (save-excursion
+	 (forward-sexp)
+	 (while (looking-at "(") (forward-sexp)) (point)))))
+  "Define syntactic regions where signals are read.
+Each function is called with one arg (a limit for the (forward) search) and
+should return either nil or the end position of the region (in which case
+point will be set to its beginning).")
+
 (defun vhdl-update-sensitivity-list ()
   "Update sensitivity list."
     (let ((proc-beg (point))
@@ -8394,35 +8440,7 @@ vhdl-update-sensitivity-list
 	(let
 	    ;; scan for visible signals
 	    ((visible-list (vhdl-get-visible-signals))
-	     ;; define syntactic regions where signals are read
-	     (scan-regions-list
-	      '(;; right-hand side of signal/variable assignment
-		;; (special case: "<=" is relational operator in a condition)
-		((vhdl-re-search-forward "[<:]=" proc-end t)
-		 (vhdl-re-search-forward ";\\|\\<\\(then\\|loop\\|report\\|severity\\|is\\)\\>" proc-end t))
-		;; if condition
-		((vhdl-re-search-forward "^\\s-*if\\>" proc-end t)
-		 (vhdl-re-search-forward "\\<then\\>" proc-end t))
-		;; elsif condition
-		((vhdl-re-search-forward "\\<elsif\\>" proc-end t)
-		 (vhdl-re-search-forward "\\<then\\>" proc-end t))
-		;; while loop condition
-		((vhdl-re-search-forward "^\\s-*while\\>" proc-end t)
-		 (vhdl-re-search-forward "\\<loop\\>" proc-end t))
-		;; exit/next condition
-		((vhdl-re-search-forward "\\<\\(exit\\|next\\)\\s-+\\w+\\s-+when\\>" proc-end t)
-		 (vhdl-re-search-forward ";" proc-end t))
-		;; assert condition
-		((vhdl-re-search-forward "\\<assert\\>" proc-end t)
-		 (vhdl-re-search-forward "\\(\\<report\\>\\|\\<severity\\>\\|;\\)" proc-end t))
-		;; case expression
-		((vhdl-re-search-forward "^\\s-*case\\>" proc-end t)
-		 (vhdl-re-search-forward "\\<is\\>" proc-end t))
-		;; parameter list of procedure call, array index
-		((and (re-search-forward "^\\s-*\\(\\w\\|\\.\\)+[ \t\n\r\f]*(" proc-end t)
-		      (1- (point)))
-		 (progn (backward-char) (forward-sexp)
-			(while (looking-at "(") (forward-sexp)) (point)))))
+	     (scan-regions-list vhdl--signal-regions-functions)
 	     name field read-list sens-list signal-list tmp-list
 	     sens-beg sens-end beg end margin)
 	  ;; scan for signals in old sensitivity list
@@ -8453,9 +8471,7 @@ vhdl-update-sensitivity-list
 	  ;; scan for signals read in process
 	  (while scan-regions-list
 	    (goto-char proc-mid)
-	    (while (and (setq beg (eval (nth 0 (car scan-regions-list))))
-			(setq end (eval (nth 1 (car scan-regions-list)))))
-	      (goto-char beg)
+	    (while (setq end (funcall (car scan-regions-list) proc-end))
 	      (unless (or (vhdl-in-literal)
 			  (and seq-region-list
 			       (let ((tmp-list seq-region-list))





This bug report was last modified 3 years and 42 days ago.

Previous Next


GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997,2003 nCipher Corporation Ltd, 1994-97 Ian Jackson.