0

Is there a way to disable the way flyspell converts misspelled words into clickable links, as well as the background colour (pink, at least for my colour theme) it uses?

I find it confusing and unnecessary.

See here:

enter image description here

2
  • How about trying (setq flyspell-mouse-map nil). I have not tried it, but am trying to think of a way that does not involve modifying the placement of overlays in some of the internal functions of flyspell-mode. If that doesn't work, you may wish to consider modifying make-flyspell-overlay to remove the placement of faces (mouse-face) and keymaps (keymap) -- e.g., comment out: (overlay-put overlay 'mouse-face mouse-face) and (overlay-put overlay 'keymap flyspell-mouse-map) I have not tried that either.
    – lawlist
    Commented Nov 15, 2017 at 23:58
  • I tried with (setq flyspell-mouse-map nil), but it the misspelled words are still clickable links. Commented Nov 17, 2017 at 7:38

1 Answer 1

1

Following code installs an advice, which removes the overlay properties which flyspell uses on incorrect words for mouse operations.

(defun make-flyspell-overlay-return-mouse-stuff (overlay)
  (overlay-put overlay 'help-echo nil)
  (overlay-put overlay 'keymap nil)
  (overlay-put overlay 'mouse-face nil))
(advice-add 'make-flyspell-overlay :filter-return #'make-flyspell-overlay-return-mouse-stuff)

To make above code working automatic from your init.el, it needs to be evaled after flyspell has been loaded. Below are two variants, one for users of use-package and one for users without use-package. Replace ... with the above given code.

without use-package:

(with-eval-after-load "flyspell"
  ...
  )

with use-package:

(use-package flyspell
  :config
  ...
  )
7
  • As I see now, this is something similar to that what lawlist proposed as solution in a comment.
    – jue
    Commented Feb 22, 2020 at 19:11
  • This works. Buy I have to manually run the code everytime I start Emacs. I placed it in my .emacs config, but I still have to run it again. Do you know why?
    – NVaughan
    Commented Feb 22, 2020 at 23:53
  • @NVaughan yes, it needs to be run after flyspell has been loaded. I will update my answer.
    – jue
    Commented Feb 22, 2020 at 23:58
  • Thanks. I'm using the latter option, but it doesn't work...
    – NVaughan
    Commented Feb 23, 2020 at 0:11
  • My relevant config is here: gitlab.com/nivaca/dotemacs/-/raw/master/mylisp/myflyspell.el
    – NVaughan
    Commented Feb 23, 2020 at 0:20

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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