emacsflycheck

How to see what the red squiggly error marking indicates


I'm editing a markdown file and see a few red squigglies in my document. I have flycheck working with markdown-lint, and ispell doing some other work to detect typos, repeated words, etc. But I can't immediately figure out why certain words are squiggled.

I've discovered that

So I've got everything working that's really needed. But it's a bit annoying that red squigglies represent different things, so I have to use different commands to get to things that look the same, and so it's impossible to tell which binding to use to jump to the next squiggly. And I'd like to know if there's a way, when point is on a squiggled thing, to know why it is squiggled. (I realize flycheck does a good job of showing reasons in minibuffer, but I don't think flyspell/ispell do).

I fear this is going to get worse as I try to add more tooling like WriteGood mode and possibly others.


Solution

  • I don't think there is a simple built-in way of doing it, but here is a little function that tries to tell what the squiggle at point represents:

    (defun my-whats-that-squiggle ()
      (interactive)
      (let* ((interesting-properties '(flycheck-error flyspell-overlay flymake-overlay))
             (present-properties (cl-remove-if-not
                                  (lambda (p) (get-char-property (point) p))
                                  interesting-properties)))
        (if present-properties
            (message "This squiggle represents: %s"
                     (mapconcat 'symbol-name present-properties ", "))
          (message "No interesting properties present"))))
    

    Invoke it with M-x my-whats-that-squiggle, or bind it to a key with global-set-key.

    You can check what properties are present at point manually with C-u C-x =, and add more properties to interesting-properties as needed. Jumping to the next squiggle, no matter what kind it is, would most likely involve writing a function that calls next-property-change.