elp-revive / auto-highlight-symbol

Automatic highlighting current symbol minor mode.
GNU General Public License v3.0
52 stars 13 forks source link

Error running timer ‘ahs-idle-function’: (wrong-type-argument number-or-marker-p nil) #10

Open duianto opened 3 years ago

duianto commented 3 years ago

An error appears when enabling auto-highlight-symbol-mode in a new buffer:

Error running timer ‘ahs-idle-function’: (wrong-type-argument number-or-marker-p nil)

Reproduction steps

Observed

Error running timer ‘ahs-idle-function’: (wrong-type-argument number-or-marker-p nil)

Expected

The symbol at the cursor should be highlighted

Notes

Moving the cursor to another line, either up or down, highlights the symbol under the cursor.

In the issue: https://github.com/jcs-elpa/auto-highlight-symbol/issues/8#issuecomment-876272634 It was suggested to require the package first.

Make sure you require auto-higlight-symbol before calling these functions. These functions aren't autoload.

It didn't help to add:

(require 'auto-highlight-symbol)

to the init.el

It wasn't caused by the most recent update either, because it also happened with the previous version: auto-highlight-symbol-20210705.1351

The symbol is highlighted directly, without the timer error message, if the test buffer, is switched to: M-x emacs-lisp-mode RET before enabling: M-x auto-highlight-symbol-mode RET

The default major mode when creating a new buffer is: fundamental-mode

System info

auto-highlight-symbol-20210708.1057 GNU Emacs 27.2 (build 1, x86_64-w64-mingw32) of 2021-03-26 Windows 21H1

jcs090218 commented 3 years ago

Can you set debug-on-error to t and post the backtrace here? Thanks!

duianto commented 3 years ago
Debugger entered--Lisp error: (wrong-type-argument number-or-marker-p nil)
  jit-lock--run-functions(1 8)
  jit-lock-fontify-now(1 8)
  ahs-fontify()
  ahs-highlight("abc" 5 8)
  ahs--do-hl()
  #f(compiled-function (win) #<bytecode 0x210731d>)(#<window 3 on test>)
  walk-windows(#f(compiled-function (win) #<bytecode 0x210731d>))
  ahs-idle-function()
  apply(ahs-idle-function nil)
  timer-event-handler([t 24807 19581 827983 nil ahs-idle-function nil nil 0])
jcs090218 commented 3 years ago

I can't reproduce this and the backtrace does not make sense...

I have temporarily disabled with ignore-errors, 03cfc2f120734172afd77d8482cd6d95e97d5064. Let me know if this would help? 😕

duianto commented 3 years ago

The latest version does not show the error running timer message.

Since you weren't able to reproduce the issue.

I also tested it in Manjaro (the test above was in Windows 21H1).

There is no error there either with the latest version of ahs.

But in both Manjaro and Win 21H1: When those ignore-errors commands are removed, then the error running timer message returns.