jwiegley / use-package

A use-package declaration for simplifying your .emacs
https://jwiegley.github.io/use-package
GNU General Public License v3.0
4.4k stars 260 forks source link

Docs missing an example of adding multiple regexp for the same mode #996

Closed jasonhemann closed 1 year ago

jasonhemann commented 2 years ago

Right now the docs for the :mode keyword show how to add a single regexp to the auto-word-alist but don't show how to add multiple regexps.

  1. I could imagine wanting to add with a single :mode keyword arg several different regexps that all should be added to a single mode.
  2. I could imagine wanting a shorthand, say, if the package name is the name of the mode, I should still get to succinctly list the regular expressions.
  3. I think I could imagine a given package defining two modes, so that two different regular expressions would match two different modes, and you'd want to/need to specify which mode goes with which regexp.

At least at present, I can't find any of those examples listed in the :mode documentation.

doolio commented 1 year ago

Does the following not work for you?

(use-package foo
  :mode ("\\.bar\\'"
         "\\.baz\\'"))

This simple example associates files with extensions .bar or .baz with foo-mode provided by the foo package.

jasonhemann commented 1 year ago

Ah. I have no doubt that would work. Adding an example like that to the documentation would close this issue for me

skangas commented 1 year ago

This has been fixed in the new use-package manual, now merged into Emacs itself: https://git.savannah.gnu.org/cgit/emacs.git/commit/?id=141fe8b827399057e2f854cd5e6b0c148c5fe12b

I'm therefore closing this issue.