How do I prevent flycheck from triggering a warning for the following code:

(defun file-path-last-segment ()
  "Get last segment of file path for use in snippets."
  (-> default-directory

The following warning appears in my flycheck errors:

the function ‘->’ is not known to be defined.
  • 1
    Not sure I understand the question. That warning just means that the byte-compiler doesn't know whether -> will be a defined function at the place you invoke it. If you too are unsure then just be sure to load (e.g. require) the library that defines it before you invoke the code that invokes it. (It's just a warning.)
    – Drew
    Jan 28, 2019 at 22:22

1 Answer 1


-> is a Lisp macro in `dash.el'.

Macros don't follow the usual rules for function definition which is likely why you're getting this error.

You might be able to do it by explicitly requiring dash in your file, if you haven't already. There's another thread regarding a similar issue around elisp macros that might be relevant Make flycheck's "reference to free variable" work with macros

  • 1
    (require 'dash) prevents the warning. Thank you.
    – gburnett
    Jan 28, 2019 at 20:57

Your Answer

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

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