PythonNut / quark-emacs

:rocket: An incredible wonderland of code
MIT License
137 stars 6 forks source link

Add "go to closest flycheck error" function and bind #51

Closed PythonNut closed 7 years ago

PythonNut commented 7 years ago
(defun goto-closest-flycheck-error ()
  (interactive)
  (let ((next (flycheck-next-error-pos 1 nil))
        (prev (flycheck-next-error-pos -1 nil)))
    (cond
     ((and next prev)
      (goto-char (if  (< (abs (- (point) prev))
                         (abs (- (point) next)))
                     prev
                   next)))
     (next (goto-char next))
     (prev (goto-char prev))
     (t (user-error "No Flycheck errors")))))
PythonNut commented 7 years ago

For now, I'm binding this to C-!