wolray / symbol-overlay

Highlight symbols with keymap-enabled overlays
346 stars 42 forks source link

Symbol-overlay conflicts with haskell-mode #75

Open Eason0210 opened 3 years ago

Eason0210 commented 3 years ago

Symbol-overlay-mode will cause Emacs to freeze with haskell-mode enabled,I am not sure it is cause by haskell-mode or symbol-overlay.

Steps to reproduce the issue:

  1. Back up your current configuration .emacs.d file with another name
  2. Create an .emacs file in the current user's HOME directory (for example, my HOME is the C:\Users\Aqua directory), and copy the following code to the .emacs file.
(require 'package)
(add-to-list 'package-archives '( "melpa" . "https://melpa.org/packages/") t)
(package-initialize)

(require 'symbol-overlay)
(global-set-key (kbd "M-i") 'symbol-overlay-put)
(global-set-key (kbd "M-n") 'symbol-overlay-switch-forward)
(global-set-key (kbd "M-p") 'symbol-overlay-switch-backward)
(global-set-key (kbd "<f7>") 'symbol-overlay-mode)
(global-set-key (kbd "<f8>") 'symbol-overlay-remove-all)

(require 'haskell-mode)
(add-hook 'haskell-mode-hook 'interactive-haskell-mode)
  1. Start Emacs, an error will be raised now, because the required packages have not been installed.

  2. Manually refresh the package contents and install haskell-mode and symbol-overlay

    M-x package-refresh-contents
    M-x package-install RET haskell-mode
    M-x package-install RET symbol-overlay
  3. Restart Emacs, now it can start normally.

  4. C-x, C-f Create a test.hs file in any directory, press to turn on symbol-overlay-mode. Enter the following content from the beginning in the empty test.hs file.

    
    triples = [(a,b,c) | c <- [1..10], a <- [1..c], b <- [1..a]]
7. When I input the third `1`, and then input a `space` or `.` It will be stuck (as shown in the figure below, the cursor now is at the position indicated by the red arrow).
![image](https://user-images.githubusercontent.com/47546452/128308554-426776a4-a3a8-4a59-94ef-50a1a8cc364a.png)

8. press `C-g` can go back to normal  , and get error from *Messages* :

Symbol-Overlay mode enabled in current buffer Error during redisplay: (internal--syntax-propertize 44) signaled (quit) Error during redisplay: (internal--syntax-propertize 57) signaled (quit)


9. if at step 7 can't reproduce issue, you can move cursor back to the  the position after the second `1` , and delete `..c` , and input `..c` again.

Tested on:
Emacs 28.0.50 native compile and Emacs 27.2
OS: macOS Big Sur 11.5 and Windows 10
twlz0ne commented 3 years ago

Same here.

My reproduction steps:

  1. Start emacs via emacsq.sh
⋊> emacsq.sh -P haskell-mode,symbol-overlay --eval "
    (progn
      (add-hook 'haskell-mode-hook 'interactive-haskell-mode)
      (add-hook 'haskell-mode-hook 'symbol-overlay-mode)
      (view-echo-area-messages)
      (toggle-debug-on-error)
      (profiler-start 'cpu)
      (switch-to-buffer \"*.hs\")
      (haskell-mode)
      (insert \"triples = [(a,b,c) | c <- [1..10], a <- [1..c], b <- [1\")
      (goto-char (point-max)))" -nw
  1. Wait until 1 is highliged

image

  1. Type ... (Get no response)

image

  1. Press C-g

image

  1. M-x profiler-report
Function                                                CPU samples    %
+ ...                                                           847  54%
- command-execute                                               717  45%
 - call-interactively                                           717  45%
  - funcall-interactively                                       703  44%
   - self-insert-command                                        639  40%
    - symbol-overlay-refresh                                    639  40%
     - looking-at                                               639  40%
      - internal--syntax-propertize                             639  40%
       - syntax-propertize                                      639  40%
        - haskell-syntax-propertize                             616  39%
         - haskell-lexeme-looking-at-token                      510  32%
            haskell-lexeme-looking-at-qidsym                    110   7%
            haskell-lexeme-looking-at-char-literal               38   2%
            haskell-lexeme-looking-at-string-lit...              28   1%
            match-string-no-properties                           10   0%

ksqsf commented 1 year ago

FWIW, I cannot reproduce this bug.

ahihi commented 1 year ago

still seeing this on

ahihi commented 1 year ago

seems to work fine on Emacs 29.1. unfortunately i cant upgrade all of my systems from 28 yet, so i would be very grateful if anyone could figure out why this happens.