I'm trying out use-package - the docs say the argument to the :mode keyword "can be a cons cell, a list, or just a string." However, I'm not sure how to make a cons cell or list work. Here's an example:

(use-package markdown-mode
  :mode (list "\\.markdown\\'" "\\.md\\'"))

With that in my init-file, I get this error:

Wrong type argument: listp, list

Is that saying a list doesn't pass the listp test?

1 Answer 1


The right way to do it would be

(use-package markdown-mode
  :mode ("\\.markdown\\'" "\\.md\\'"))


(use-package markdown-mode
  :mode (("\\.markdown\\'" . markdown-mode)
         ("\\.md\\'"       . markdown-mode)))

In general, to see what any macro is expanding to, take the cursor to the closing parenthesis of that macro and do M-x pp-macroexpand-last-sexp.

  • 2
    And realize that macros do not evaluate their arguments (by default).
    – Drew
    Oct 22, 2015 at 15:54

Your Answer

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

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