reddit / emacs

Total hack: make flyspell red squiggles transient

FrankLeeMadear · 2022-03-04 00:03
Sometimes during casual writing I use slang, abbrevs, company names, etc that I don't want added to the dictionary. But I don't want to turn off flyspell completely and the red squiggles annoy and distract the hell out of me. So I wrote a total hack to make them transient. Enjoy. Or don't. Just install and call flyspell-toggle-transient-squiggle (defvar flyspell-transient-squiggle nil) (defun flyspell-toggle-transient-squiggle () (interactive) (setq flyspell-transient-squiggle (not flyspell-transient-squiggle)) (message "Flyspell transient squiggle: %S" flyspell-transient-squiggle)) (defun nuke-flyspell-squiggles (buf) (with-current-buffer buf (flyspell-delete-all-overlays))) (defadvice make-flyspell-overlay (around transient-flyspell-squiggle activate) ad-do-it (when flyspell-transient-squiggle (run-at-time "3 sec" nil 'nuke-flyspell-squiggles (current-buffer))))
nv-elisp · 2022-03-04 01:15
Instead of defining a toggle function, you may as well just define a minor mode. You could also avoid the advice by adding to `flyspell-incorrect-hook`.
FrankLeeMadear · 2022-03-04 07:08
Good points. Yes the hook should do nicely, didn't know about that. Thanks
pailanderCO · 2022-03-04 12:30
What I prefer is to add them as local words: "Accept (Buffer)". That way I don't get the squiggles but don't get added to my global dictionary.