From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Stefan Monnier via "Bug reports for GNU Emacs, the Swiss army knife of text editors" Newsgroups: gmane.emacs.bugs 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 Message-ID: References: <83zgkzcwfq.fsf@gnu.org> <83y20jcugz.fsf@gnu.org> <87tub75rmv.fsf@gmail.com> Reply-To: Stefan Monnier Mime-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="4592"; mail-complaints-to="usenet@ciao.gmane.io" User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/29.0.50 (gnu/linux) Cc: Reto Zimmermann , Eli Zaretskii , "54730@debbugs.gnu.org" <54730@debbugs.gnu.org>, Cyril Arnould To: Robert Pluim Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Tue Apr 05 23:22:11 2022 Return-path: Envelope-to: geb-bug-gnu-emacs@m.gmane-mx.org Original-Received: from lists.gnu.org ([209.51.188.17]) by ciao.gmane.io with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1nbqcs-0000wU-Gl for geb-bug-gnu-emacs@m.gmane-mx.org; Tue, 05 Apr 2022 23:22:10 +0200 Original-Received: from localhost ([::1]:41274 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1nbqcr-0000La-4A for geb-bug-gnu-emacs@m.gmane-mx.org; Tue, 05 Apr 2022 17:22:09 -0400 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]:45238) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1nbqck-0000LR-Hu for bug-gnu-emacs@gnu.org; Tue, 05 Apr 2022 17:22:02 -0400 Original-Received: from debbugs.gnu.org ([209.51.188.43]:34198) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1nbqck-0001Cb-9c for bug-gnu-emacs@gnu.org; Tue, 05 Apr 2022 17:22:02 -0400 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1nbqck-0004p3-5q for bug-gnu-emacs@gnu.org; Tue, 05 Apr 2022 17:22:02 -0400 X-Loop: help-debbugs@gnu.org Resent-From: Stefan Monnier Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Tue, 05 Apr 2022 21:22:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 54730 X-GNU-PR-Package: emacs Original-Received: via spool by 54730-submit@debbugs.gnu.org id=B54730.164919370818511 (code B ref 54730); Tue, 05 Apr 2022 21:22:02 +0000 Original-Received: (at 54730) by debbugs.gnu.org; 5 Apr 2022 21:21:48 +0000 Original-Received: from localhost ([127.0.0.1]:56328 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1nbqcV-0004oU-O1 for submit@debbugs.gnu.org; Tue, 05 Apr 2022 17:21:48 -0400 Original-Received: from mailscanner.iro.umontreal.ca ([132.204.25.50]:46493) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1nbqcT-0004oB-35 for 54730@debbugs.gnu.org; Tue, 05 Apr 2022 17:21:45 -0400 Original-Received: from pmg1.iro.umontreal.ca (localhost.localdomain [127.0.0.1]) by pmg1.iro.umontreal.ca (Proxmox) with ESMTP id 65D381001E0; Tue, 5 Apr 2022 17:21:39 -0400 (EDT) Original-Received: from mail01.iro.umontreal.ca (unknown [172.31.2.1]) by pmg1.iro.umontreal.ca (Proxmox) with ESMTP id 2E84B10009E; Tue, 5 Apr 2022 17:21:37 -0400 (EDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=iro.umontreal.ca; s=mail; t=1649193697; bh=52ZllDe/HThfR0nyCMlOw2TqniKH08MvMbqG4wBYssM=; h=From:To:Cc:Subject:References:Date:In-Reply-To:From; b=haLV8ZkiGG9JW6EMwXoa1aBvj9UJUJDIEakXbH3nxEk/qsWPx2JEg70/YM99gHWT+ Glyhmej4JURSCCrMP47MuPs6d+F9G1PEnAsC64iGTwnxzTRdx1mQpfL8OCKfgeDiQO fsmbyJoEaS2k4lGAlAYxTyZL0djC0k7z1FBuPfJXhOsrJhtYrpZ0by6YsTjuSVS14Y Da2VUYL2TLa8FgDqFSXCW5EXLkOOlxyNiq+KTeteAT3OavEY73r5kiIyW8yx6h3KLA awh9tNRQdgXN7DtvuJUQVZOLlYfhvjEwazhH/l5JXIoiH/Td/MnohBYOkl9X/j92PG ZqVoed9H/Jm5w== Original-Received: from alfajor (unknown [45.72.221.51]) by mail01.iro.umontreal.ca (Postfix) with ESMTPSA id B35D71204DE; Tue, 5 Apr 2022 17:21:36 -0400 (EDT) In-Reply-To: <87tub75rmv.fsf@gmail.com> (Robert Pluim's message of "Tue, 05 Apr 2022 20:09:28 +0200") X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list X-BeenThere: bug-gnu-emacs@gnu.org List-Id: "Bug reports for GNU Emacs, the Swiss army knife of text editors" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Original-Sender: "bug-gnu-emacs" Xref: news.gmane.io gmane.emacs.bugs:229463 Archived-At: Robert Pluim [2022-04-05 20:09:28] wrote: >>>>>> On Tue, 5 Apr 2022 17:53:20 +0000, Cyril Arnould said: > > Cyril> Nice, it=E2=80=99s working! Too bad this didn=E2=80=99t make i= t 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))) =20 +(defconst vhdl--signal-regions-functions + (list + ;; right-hand side of signal/variable assignment + ;; (special case: "<=3D" is relational operator in a condition) + (lambda (proc-end) + (when (vhdl-re-search-forward "[<:]=3D" 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 "\\" proc-end t)))) + ;; elsif condition + (lambda (proc-end) + (when (vhdl-re-search-forward "\\" proc-end t) + (save-excursion (vhdl-re-search-forward "\\" 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 "\\" 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 "\\" proc-end t) + (save-excursion + (vhdl-re-search-forward "\\(\\\\|\\\\|;\\)" + proc-end t)))) + ;; case expression + (lambda (proc-end) + (when (vhdl-re-search-forward "^\\s-*case\\>" proc-end t) + (save-excursion (vhdl-re-search-forward "\\" proc-end t)))) + ;; parameter list of procedure call, array index + (lambda (proc-end) + (when (re-search-forward "^\\s-*\\(\\w\\|\\.\\)+[ \t\n\r\f]*(" proc-e= nd 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: "<=3D" is relational operator in a condition) - ((vhdl-re-search-forward "[<:]=3D" 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 "\\" proc-end t)) - ;; elsif condition - ((vhdl-re-search-forward "\\" proc-end t) - (vhdl-re-search-forward "\\" proc-end t)) - ;; while loop condition - ((vhdl-re-search-forward "^\\s-*while\\>" proc-end t) - (vhdl-re-search-forward "\\" proc-end t)) - ;; exit/next condition - ((vhdl-re-search-forward "\\<\\(exit\\|next\\)\\s-+\\w+\\s-+when\\>" pro= c-end t) - (vhdl-re-search-forward ";" proc-end t)) - ;; assert condition - ((vhdl-re-search-forward "\\" proc-end t) - (vhdl-re-search-forward "\\(\\\\|\\\\|;\\)" proc-= end t)) - ;; case expression - ((vhdl-re-search-forward "^\\s-*case\\>" proc-end t) - (vhdl-re-search-forward "\\" 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))