1

Whenever I enable flyspell-mode on any file, I immediately get the below error:

Error in post-command-hook (flyspell-post-command-hook): (wrong-type-argument keymapp nil)

And after that flyspell stops working. Has anyone else encountered this issue? I was able to reproduce the error on emacs -Q. If I enable toggle-debug-on-error, I'm not getting any backtraces.

emacs version:

Emacs version: GNU Emacs 28.0.50 (build 1, x86_64-pc-linux-gnu, GTK+ Version 3.24.22, cairo version 1.17.3)
 of 2020-08-18, built using commit fc9b68636b1aec69295726d2b3be2b520911f40b.

./configure options:
  --with-modules --with-rsvg --with-dbus --with-imagemagick --without-pop --with-xft --with-xml2 --with-libotf --with-mailutils --without-toolkit-scroll-bars --without-xaw3d -with-nativecomp 'CFLAGS=-O3 -mtune=native -march=native -fomit-frame-pointer'

Features:
  XPM JPEG TIFF GIF PNG RSVG CAIRO IMAGEMAGICK SOUND GPM DBUS GSETTINGS GLIB NOTIFY INOTIFY ACL GNUTLS LIBXML2 FREETYPE HARFBUZZ LIBOTF ZLIB GTK3 X11 XDBE XIM MODULES NATIVE_COMP THREADS LIBSYSTEMD JSON PDUMPER LCMS2

Here is my emacs config: https://github.com/CSRaghunandan/.emacs.d/blob/master/setup-files/setup-spell.el.

I tried with both hunspell and aspell and both are giving the same error.

If I enable flyspell-lazy-mode and enabe toggle-debug-on-error, I get the below error backtrace:

Debugger entered--Lisp error: (wrong-type-argument keymapp nil)
  make-flyspell-overlay(1313 1317 flyspell-duplicate highlight)
  flyspell-highlight-incorrect-region(1313 1317 doublon)
  flyspell-word()
  flyspell-check-region-doublons(1289 1350)
  flyspell-large-region(1289 1350)
  flyspell-region(1289 1350)
  apply(flyspell-region (1289 1350))
  flyspell-lazy-check-pending()
  apply(flyspell-lazy-check-pending nil)
  timer-event-handler([t 0 1 0 t flyspell-lazy-check-pending nil idle 0])
1

So, I found out what the mistake was after an hour of debugging.

I had the line (setq flyspell-mouse-map nil) to disable the mouse map for flyspell and this was causing flyspell to stop working on emacs.

After removing the above line, flyspell is working fine without any issues.

| improve this answer | |
  • 1
    That's a keymap -- nil isn't a valid value. Try (setq flyspell-mouse-map (make-sparse-keymap)) – phils Aug 21 at 12:50

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.