10

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?

Ken Williams
  • 390
  • 2
  • 12

1 Answers1

22

The right way to do it would be

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

or

(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.

Kaushal Modi
  • 25,203
  • 3
  • 74
  • 179