symbol-overlay icon indicating copy to clipboard operation
symbol-overlay copied to clipboard

Symbol-overlay conflicts with haskell-mode

Open Eason0210 opened this issue 3 years ago • 4 comments

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
  1. Restart Emacs, now it can start normally.

  2. 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]]

  1. 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

  2. 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)
  1. 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

Eason0210 avatar Aug 05 '21 07:08 Eason0210

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%

  • macOS 10.12.6
  • Emacs 27.1 / 28.0 (rev: 6f776fbc3532a96dc86eb4e6091ed94f4c52aae7)
  • haskell-mode-20210622.2049
  • symbol-overlay-20210422.2110

twlz0ne avatar Aug 06 '21 01:08 twlz0ne

FWIW, I cannot reproduce this bug.

  • macOS 13.0.1 (22A400)
  • Emacs 29.0.60 (rev: 19ef86f775a39eab46231c3eb6fc702e06857a5a)
  • haskell-mode 20221113.1425
  • symbol-overlay 20220304.917

ksqsf avatar Dec 14 '22 04:12 ksqsf

still seeing this on

  • macOS 10.14
  • Emacs 28.2
  • haskell-mode 3e146c1
  • symbol-overlay a783d7b (latest)

ahihi avatar Sep 10 '23 17:09 ahihi

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.

ahihi avatar Sep 12 '23 10:09 ahihi