(or emacs irrelevant)

Compilation-style check-declare-file

As a follow-up to my older post on Elisp linting options, I've made check-declare-file and check-declare-directory give out warnings similar to those that e.g. byte-compile-file gives:

  • each warning now has a location in a file-line-column format
  • you can click on the link to jump to the warning location
  • first-error / next-error / previous-error work as well
  • the warning line blinks momentarily with each jump

Here's how it looks like:

check-declare

You can already use this feature if you're on Emacs trunk, otherwise you'll have to wait for 25.1 to come out.

There's also a new custom variable that you can set to get a more strict check:

(setq check-declare-ext-errors t)

Unless you set it, the standard behavior is to issue a "skipping external file" message when checking a statement like the one above. The reason is that the external package might not be loaded or something. As long as I'm checking, I prefer to check everything, so there's no reason not to have check-declare-ext-errors always true.

A trick to actually load slime-repl

Here's the Makefile target for check-declare:

check-declare:
    $(CASKEMACS) -batch $(LOAD) -l check-declare.elt

And here are the contents of check-declare.elt:

(setq check-declare-ext-errors t)
(setq files '("lispy.el"
              "lispy-inline.el"
              "le-clojure.el"
              "le-scheme.el"
              "le-lisp.el"))
(add-to-list 'load-path
             (concat (file-name-directory
                      (locate-library "slime"))
                     "contrib/"))
(require 'slime-repl)
(apply #'check-declare-files files)

As you see, I first find where slime.el is located using locate-library, and then add the contrib sub-directory to the load-path. After this, it's finally possible to (require 'slime-repl).