emacs-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Odd block highlighting [master build]


From: Kaushal Modi
Subject: Re: Odd block highlighting [master build]
Date: Tue, 20 Sep 2016 20:53:20 +0000

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 <address@hidden> wrote:
On Tue, Sep 20, 2016 at 4:06 PM Kaushal Modi <address@hidden> 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


reply via email to

[Prev in Thread] Current Thread [Next in Thread]