Revise documentation for def-project-mode!

This commit is contained in:
Henrik Lissner 2017-06-16 14:34:28 +02:00
parent 8f9bd835a5
commit 414363fe38
No known key found for this signature in database
GPG key ID: 5F6C0EA160557395

View file

@ -99,23 +99,24 @@ unless the path begins with ./ or ../, in which case it's relative to
(add-hook 'after-change-major-mode-hook #'doom|autoload-project-mode) (add-hook 'after-change-major-mode-hook #'doom|autoload-project-mode)
(defmacro def-project-mode! (name &rest plist) (defmacro def-project-mode! (name &rest plist)
"Define a project minor-mode named NAME, and declare where and how it is "Define a project minor-mode named NAME and declare where and how it is
activated. Project modes allow for project-specific settings, keymaps, hooks & activated. Project modes allow you to configure 'sub-modes' for major-modes that
custom configuration without having to litter the project with .dir-locals.el are specific to a specific folder, certain project structure, framework or
files. arbitrary context you define. These project modes can have their own settings,
keymaps, hooks, snippets, etc.
This creates NAME-hook and NAME-map as well. This creates NAME-hook and NAME-map as well.
A project can be enabled through .dir-locals.el however, if `doom-project' is set A project can be enabled through .dir-locals.el too, if `doom-project' is set to
to the name of the project mode(s) to enable. the name (symbol) of the project mode(s) to enable.
PLIST should contain any or all of these properties, which each are checked to PLIST may contain any of these properties, which are all checked to see if NAME
see if NAME should be activated. should be activated. If they are *all* true, NAME is activated.
:modes MODES -- if buffers are derived from MODES (one or a list of symbols). :modes MODES -- if buffers are derived from MODES (one or a list of symbols).
:files FILES -- if project contains FILES; takes a solitary string or a form :files FILES -- if project contains FILES; takes a string or a form comprised
comprised of (and ...) and/or (or ...) forms. Each path is relative to the of nested (and ...) and/or (or ...) forms. Each path is relative to the
project root, however, if prefixed with a '.' or '..', it is relative to the project root, however, if prefixed with a '.' or '..', it is relative to the
current buffer. current buffer.
@ -124,7 +125,9 @@ see if NAME should be activated.
:when PREDICATE -- if PREDICATE returns true (can be a form or the symbol of a :when PREDICATE -- if PREDICATE returns true (can be a form or the symbol of a
function) function)
:init FORM -- FORM will be run the first time this project mode is enabled." :init FORM -- FORM to run the first time this project mode is enabled.
Relevant: `doom-project-hook'."
(declare (indent 1)) (declare (indent 1))
(let ((modes (plist-get plist :modes)) (let ((modes (plist-get plist :modes))
(files (plist-get plist :files)) (files (plist-get plist :files))