From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!.POSTED!not-for-mail From: Kaushal Modi Newsgroups: gmane.emacs.devel Subject: Re: Odd block highlighting [master build] Date: Tue, 20 Sep 2016 20:53:20 +0000 Message-ID: References: NNTP-Posting-Host: blaine.gmane.org Mime-Version: 1.0 Content-Type: multipart/alternative; boundary=001a113f15960c8956053cf69fbf X-Trace: blaine.gmane.org 1474405996 24897 195.159.176.226 (20 Sep 2016 21:13:16 GMT) X-Complaints-To: usenet@blaine.gmane.org NNTP-Posting-Date: Tue, 20 Sep 2016 21:13:16 +0000 (UTC) Cc: John Mastro , Emacs developers To: wsnyder@wsnyder.org, Noam Postavsky Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Tue Sep 20 23:13:10 2016 Return-path: Envelope-to: ged-emacs-devel@m.gmane.org Original-Received: from lists.gnu.org ([208.118.235.17]) by blaine.gmane.org with esmtp (Exim 4.84_2) (envelope-from ) id 1bmSLg-0005ED-Cx for ged-emacs-devel@m.gmane.org; Tue, 20 Sep 2016 23:13:04 +0200 Original-Received: from localhost ([::1]:38128 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1bmSLe-00010S-Lg for ged-emacs-devel@m.gmane.org; Tue, 20 Sep 2016 17:13:02 -0400 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:44767) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1bmS2n-0002T3-P6 for emacs-devel@gnu.org; Tue, 20 Sep 2016 16:53:35 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1bmS2m-00038R-9l for emacs-devel@gnu.org; Tue, 20 Sep 2016 16:53:33 -0400 Original-Received: from mail-yw0-x22d.google.com ([2607:f8b0:4002:c05::22d]:36072) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1bmS2m-000389-3P for emacs-devel@gnu.org; Tue, 20 Sep 2016 16:53:32 -0400 Original-Received: by mail-yw0-x22d.google.com with SMTP id t67so21295717ywg.3 for ; Tue, 20 Sep 2016 13:53:31 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=yGKd0FTVneDpDdioj/MYL673XMmUxkzOfqwGC5aOCZc=; b=LjEjwh+FZahRd649XcXbLicOtQT0pwhLoAD20xBj69vx9KZ96yjNM2A4uMP92Vrx1/ zYpbs2sOrNFgEPIo+9kPvrxjdoBSO1dzglO7wLxng6zfc/aEqsm7uJkZ4dwVea6RaOI+ vm59D7KQNPeEgvUDJM+TKmCBvSstHpPpgjbkkYdirzTA+Fzl4r4OmWQUsaThbx8pkRUP MwYccoIT6CCkA+1+358UoApWTl15EnNeT8KqxuwdZRlDbgPZlGGjoJr94avgppnX17Aq QnXCeG/G//F6VAfQ0syG1LdBAh4kyqLvRPVLCdlQtaOCe0qNbXO7Q6fAg3fb7d1w+DLB 7jsw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=yGKd0FTVneDpDdioj/MYL673XMmUxkzOfqwGC5aOCZc=; b=QxhTY9497VmgDKRLVS0H7Z7SqLud6yoym/G675ioPxfWYKhZQWqgL6Y4xbNsmLSmJ4 WpE8+zva5rw1KlldvaA2bwTWQmq4muVIH8DOUwNl3j+j50xcFtRJ64H1j/vPD5LEvovo sf04LYWFc5YOatdBFPyHMejz0UEXar0aLNsqhtidTAWr2K/Q8SzxRF9mUiv1NcGnCxPg brlLkm9Q60dg1YXnWb1s6UUozLWjQC/9H1Yif8GW6W5zny8UbS+ASVOw1ZJI/nAbRonZ 3fol9a/QE86UJ0S+RWI9bM6FjR6YcPonEKGhcyuwomQ88u/B2JUWc6wTg9U28SlkyroT 41Kw== X-Gm-Message-State: AE9vXwOr2xfmc3Xd1D596R90OkP53H8qCLDyB47+kNJE9S2uCMUE5cX69CwTJ/Jmgzq4lr/vJB9S/Fuq+xMJUg== X-Received: by 10.129.75.88 with SMTP id y85mr21851073ywa.345.1474404811564; Tue, 20 Sep 2016 13:53:31 -0700 (PDT) In-Reply-To: X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-Received-From: 2607:f8b0:4002:c05::22d X-BeenThere: emacs-devel@gnu.org X-Mailman-Version: 2.1.21 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" Xref: news.gmane.org gmane.emacs.devel:207642 Archived-At: --001a113f15960c8956053cf69fbf Content-Type: text/plain; charset=UTF-8 Hi Wilson, I am copying you on this thread too to help debug this. It looks like the verilog-highlight-region is causing this: These highlight overlays are added via a couple of hooks: (add-hook 'font-lock-mode-hook 'verilog-highlight-buffer t t) (add-hook 'font-lock-after-fontify-buffer-hook 'verilog-highlight-buffer t t) ; not in Emacs (add-hook 'after-change-functions 'verilog-highlight-region t t) @Noam: A wild guess.. would this commit http://git.savannah.gnu.org/cgit/emacs.git/commit/?id=66f95e0dabf750e9d2eff59b2bb6e593618cd48a be related in any way to what we are seeing here? (defun verilog-highlight-region (beg end _old-len) "Colorize included files and modules in the (changed?) region. Clicking on the middle-mouse button loads them in a buffer (as in dired)." (when (or verilog-highlight-includes verilog-highlight-modules) (save-excursion (save-match-data ; A query-replace may call this function - do not disturb (verilog-save-buffer-state (verilog-save-scan-cache (let (end-point) (goto-char end) (setq end-point (point-at-eol)) (goto-char beg) (beginning-of-line) ; scan entire line ;; delete overlays existing on this line (let ((overlays (overlays-in (point) end-point))) (while overlays (if (and (overlay-get (car overlays) 'detachable) (or (overlay-get (car overlays) 'verilog-include-file) (overlay-get (car overlays) 'verilog-inst-module))) (delete-overlay (car overlays))) (setq overlays (cdr overlays)))) ;; ;; make new include overlays (when verilog-highlight-includes (while (search-forward-regexp verilog-include-file-regexp end-point t) (goto-char (match-beginning 1)) (let ((ov (make-overlay (match-beginning 1) (match-end 1)))) (overlay-put ov 'start-closed 't) (overlay-put ov 'end-closed 't) (overlay-put ov 'evaporate 't) (overlay-put ov 'verilog-include-file 't) (overlay-put ov 'mouse-face 'highlight) (overlay-put ov 'local-map verilog-mode-mouse-map)))) ;; ;; make new module overlays (goto-char beg) ;; This scanner is syntax-fragile, so don't get bent (when verilog-highlight-modules (condition-case nil (while (verilog-re-search-forward-quick "\\(/\\*AUTOINST\\*/\\|\\.\\*\\)" end-point t) (save-excursion (goto-char (match-beginning 0)) (unless (verilog-inside-comment-or-string-p) (verilog-read-inst-module-matcher) ; sets match 0 (let* ((ov (make-overlay (match-beginning 0) (match-end 0)))) (overlay-put ov 'start-closed 't) (overlay-put ov 'end-closed 't) (overlay-put ov 'evaporate 't) (overlay-put ov 'verilog-inst-module 't) (overlay-put ov 'mouse-face 'highlight) (overlay-put ov 'local-map verilog-mode-mouse-map))))) (error nil))) ;; ;; Future highlights: ;; variables - make an Occur buffer of where referenced ;; pins - make an Occur buffer of the sig in the declaration module ))))))) Here is the verilog-mode development area: https://github.com/veripool/verilog-mode Stable version of the same is in the core: http://git.savannah.gnu.org/cgit/emacs.git/tree/lisp/progmodes/verilog-mode.el On Tue, Sep 20, 2016 at 4:10 PM Kaushal Modi wrote: > On Tue, Sep 20, 2016 at 4:06 PM Kaushal Modi > wrote: > >> >> I do not understand overlays very well, but it looks like verilog-mode or >> some minor mode created 5 overlays over the same region, and they did not >> get removed even when those modes were disabled. >> > > Some more info.. with each revert-buffer call, that overlay is replicating > over the same region.. I reverted the buffer 4-5 times and now in the C-u > C-x = generated Help buffer, I see.. > > From 1466 to 1482 > end-closed t > evaporate t > local-map [Show] > mouse-face highlight > start-closed t > verilog-include-file t > From 1466 to 1482 > end-closed t > evaporate t > local-map [Show] > mouse-face highlight > start-closed t > verilog-include-file t > ... > > (and so on 27 times!) > -- Kaushal Modi --001a113f15960c8956053cf69fbf Content-Type: text/html; charset=UTF-8 Content-Transfer-Encoding: quoted-printable
Hi Wilson,

I am copying you on this thr= ead too to help debug this.

It looks like the veri= log-highlight-region is causing this:

These highlight overlays are added via a couple of= hooks:

=C2=A0 =C2=A0 (add-hook 'font-loc= k-mode-hook 'verilog-highlight-buffer t t)
=C2=A0 =C2=A0 (add= -hook 'font-lock-after-fontify-buffer-hook 'verilog-highlight-buffe= r t t) ; not in Emacs
=C2=A0 =C2=A0 (add-hook 'after-change-f= unctions 'verilog-highlight-region t t)

= @Noam: A wild guess.. would this commit=C2=A0http://git.savannah.gnu.org/cgit/emacs.git/commit/?id=3D66f95e0dabf750e= 9d2eff59b2bb6e593618cd48a=C2=A0be related in any way to what we are see= ing here?

(defun verilog-highlight-region (be= g end _old-len)
=C2=A0 "Colorize included files and modules = in the (changed?) region.
Clicking on the middle-mouse button loa= ds them in a buffer (as in dired)."
=C2=A0 (when (or verilog= -highlight-includes
=C2=A0 =C2=A0verilog-highlight-modules)
=C2= =A0 =C2=A0 (save-excursion
=C2=A0 =C2=A0 =C2=A0 (save-match-data = =C2=A0; A query-replace may call this function - do not disturb
<= span class=3D"Apple-tab-span" style=3D"white-space:pre"> (verilog-sa= ve-buffer-state
(verilog-save-scan-cache
=C2=A0(let (end-point)
=C2=A0 = =C2=A0(goto-char end)
=C2=A0 =C2=A0(setq end-point (point-at-eol))
=C2=A0= =C2=A0(goto-char beg)
=C2=A0 =C2=A0(beginning-of-line) =C2=A0; scan entir= e line
= =C2=A0 =C2=A0;; delete overlays existing on this line
=C2=A0 =C2= =A0(let ((overlays (overlays-in (point) end-point)))
=C2=A0 =C2=A0 =C2=A0= (while overlays
(if (and
=C2=A0 =C2=A0 (overlay-get (car overlays) '= detachable)
=C2=A0 =C2=A0 (or (overlay-get (car overlays) 'verilog-in= clude-file)
(overlay-get (car overlays) 'verilog-inst-module)))
= =C2=A0 =C2=A0(delete-overlay (car overlays)))
(setq overlays (cdr overlays= ))))
=C2=A0 =C2=A0;;
=C2=A0 =C2=A0;; make new include overlays
= =C2=A0 = =C2=A0(when verilog-highlight-includes
=C2=A0 =C2=A0 =C2=A0(while (search-= forward-regexp verilog-include-file-regexp end-point t)
(goto-char (match-= beginning 1))
(let ((ov (make-overlay (match-beginning 1) (match-end 1))))=
=C2=A0(overlay-put ov 'start-closed 't)
=C2=A0(overlay-put ov = 'end-closed 't)
=C2=A0(overlay-put ov 'evaporate 't)
= =C2=A0(overlay-put ov 'verilog-include-file 't)
=C2=A0(overlay-pu= t ov 'mouse-face 'highlight)
=C2=A0(overlay-put ov 'local-map= verilog-mode-mouse-map))))
=C2=A0 =C2=A0;;
=C2=A0 =C2=A0;; make new mod= ule overlays
=C2=A0 =C2=A0(goto-char beg)
=C2=A0 =C2=A0;; This scanner is= syntax-fragile, so don't get bent
=C2=A0 =C2=A0(when verilog-highligh= t-modules
=C2=A0 =C2=A0 =C2=A0(condition-case nil
=C2=A0(while (verilog-= re-search-forward-quick "\\(/\\*AUTOINST\\*/\\|\\.\\*\\)" end-poi= nt t)
= =C2=A0 =C2=A0(save-excursion
=C2=A0 =C2=A0 =C2=A0(goto-char (matc= h-beginning 0))
=C2=A0 =C2=A0 =C2=A0(unless (verilog-inside-comment-or-st= ring-p)
=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 = =C2=A0 =C2=A0 =C2=A0 =C2=A0 (verilog-read-inst-module-matcher) =C2=A0; sets= match 0
(let* ((ov (make-overlay (match-beginning 0) (match-end 0))))
= =C2=A0(overlay-put ov 'start-closed 't)
=C2=A0(overlay-put ov &= #39;end-closed 't)
=C2=A0(overlay-put ov 'evaporate 't)
= =C2=A0(overlay-put ov 'verilog-inst-module 't)
=C2=A0(overlay-pu= t ov 'mouse-face 'highlight)
=C2=A0(overlay-put ov 'local-ma= p verilog-mode-mouse-map)))))
(error nil)))
=C2=A0 =C2=A0;;
=C2=A0 =C2= =A0;; Future highlights:
=C2=A0 =C2=A0;; =C2=A0variables - make an Occur b= uffer of where referenced
=C2=A0 =C2=A0;; =C2=A0pins - make an Occur buffe= r of the sig in the declaration module
=C2=A0 =C2=A0)))))))

=
Here is the verilog-mode development area:=C2=A0https://github.com/veripool/verilog-mo= de


On Tue, Sep 20, 2016 at 4:10 PM Kaushal Modi <kaushal.modi@gmail.com> wrote:
On Tue, Sep 20, 2016 at 4:06 PM Kaushal Modi <kaushal.modi@gmai= l.com> wrote:

I do not understand overlays ver= y well, but it looks like verilog-mode or some minor mode created 5 overlay= s over the same region, and they did not get removed even when those modes = were disabled.

Some more info.. with each re= vert-buffer call, that overlay is replicating over the same region.. I reve= rted the buffer 4-5 times and now in the C-u C-x =3D generated Help buffer,= I see..

=C2=A0From 1466 to 1482
=C2=A0 = end-closed =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 t
=C2=A0 evaporate = =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0t
=C2=A0 local-map =C2= =A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0[Show]
=C2=A0 mouse-face = =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 highlight
=C2=A0 start-closed = =C2=A0 =C2=A0 =C2=A0 =C2=A0 t
=C2=A0 verilog-include-file t
=
=C2=A0From 1466 to 1482
=C2=A0 end-closed =C2=A0 =C2=A0 =C2= =A0 =C2=A0 =C2=A0 t
=C2=A0 evaporate =C2=A0 =C2=A0 =C2=A0 =C2=A0 = =C2=A0 =C2=A0t
=C2=A0 local-map =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2= =A0 =C2=A0[Show]
=C2=A0 mouse-face =C2=A0 =C2=A0 =C2=A0 =C2=A0 = =C2=A0 highlight
=C2=A0 start-closed =C2=A0 =C2=A0 =C2=A0 =C2=A0 = t
=C2=A0 verilog-include-file t=C2=A0
...
(and so on 27 times!)
--

Kaush= al Modi

--001a113f15960c8956053cf69fbf--