docs/faq: general revision

This commit is contained in:
Henrik Lissner 2019-10-19 22:18:03 -04:00
parent 5fa746e27c
commit b45a9c5e03
No known key found for this signature in database
GPG key ID: 5F6C0EA160557395

View file

@ -566,16 +566,19 @@ The ~package!~ macro has a ~:disable~ property:
(package! irony :disable t) (package! irony :disable t)
#+END_SRC #+END_SRC
Remember to run ~doom refresh~ afterwards to ensure that the package is
uninstalled and disabled.
You'll find more information in the "[[file:getting_started.org::*Disabling%20packages][Disabling packages]]" section of the [[file:getting_started.org][Getting You'll find more information in the "[[file:getting_started.org::*Disabling%20packages][Disabling packages]]" section of the [[file:getting_started.org][Getting
Started]] guide. Started]] guide.
** How do I reconfigure a package included in Doom? ** How do I reconfigure a package included in Doom?
~def-package!~ and ~after!~ (wrappers around ~use-package~ and ~use-package!~ and ~after!~ (wrappers around ~use-package~ and
~with-eval-after-load~, respectively) are your bread and butter for configuring ~eval-after-load~, respectively) are your bread and butter for configuring
packages in Doom. packages in Doom.
#+BEGIN_SRC elisp #+BEGIN_SRC elisp
(def-package! doom-themes (use-package! doom-themes
:defer t :defer t
:init :init
(unless doom-theme (unless doom-theme
@ -600,7 +603,6 @@ available. They are:
#+BEGIN_SRC emacs-lisp #+BEGIN_SRC emacs-lisp
;;; in ~/.doom.d/config.el ;;; in ~/.doom.d/config.el
(setq doom-theme 'doom-tomorrow-night) (setq doom-theme 'doom-tomorrow-night)
;; or ;; or
(load-theme 'doom-tomorrow-night t) (load-theme 'doom-tomorrow-night t)
@ -609,9 +611,9 @@ available. They are:
At the moment, the only difference between the two is that ~doom-theme~ is At the moment, the only difference between the two is that ~doom-theme~ is
loaded when Emacs has finished initializing at startup and ~load-theme~ loads loaded when Emacs has finished initializing at startup and ~load-theme~ loads
the theme immediately. Which you choose depends on your needs, but I recommend the theme immediately. Which you choose depends on your needs, but I recommend
~doom-theme~ because, if I ever discover a better way to load themes, I can setting ~doom-theme~ because, if I later discover a better way to load themes, I
easily change how Doom uses ~doom-theme~, but I can't control how you use the can easily change how Doom uses ~doom-theme~, but I can't control how you use
~load-theme~ function. the ~load-theme~ function.
*** Installing a third party theme *** Installing a third party theme
To install a theme from a third party plugin, say, [[https://github.com/bbatsov/solarized-emacs][solarized]], you need only To install a theme from a third party plugin, say, [[https://github.com/bbatsov/solarized-emacs][solarized]], you need only
@ -659,11 +661,6 @@ wrapper around ~define-key~, ~global-set-key~, ~local-set-key~ and
(global-set-key (kbd "C-x y") #'do-something) (global-set-key (kbd "C-x y") #'do-something)
(map! "C-x y" #'do-something) (map! "C-x y" #'do-something)
;; bind multiple keys
(map! "C-x x" #'do-something
"C-x y" #'do-something-else
"C-x z" #'do-another-thing)
;; bind a key on a keymap ;; bind a key on a keymap
(define-key emacs-lisp-mode (kbd "C-c p") #'do-something) (define-key emacs-lisp-mode (kbd "C-c p") #'do-something)
(map! :map emacs-lisp-mode "C-c p" #'do-something) (map! :map emacs-lisp-mode "C-c p" #'do-something)
@ -671,6 +668,11 @@ wrapper around ~define-key~, ~global-set-key~, ~local-set-key~ and
;; unbind a key defined elsewhere ;; unbind a key defined elsewhere
(define-key lua-mode-map (kbd "SPC m b") nil) (define-key lua-mode-map (kbd "SPC m b") nil)
(map! :map lua-mode-map "SPC m b" nil) (map! :map lua-mode-map "SPC m b" nil)
;; bind multiple keys
(map! "C-x x" #'do-something
"C-x y" #'do-something-else
"C-x z" #'do-another-thing)
#+END_SRC #+END_SRC
Evil users can also define keys in particular evil states: Evil users can also define keys in particular evil states:
@ -702,7 +704,8 @@ Evil users can also define keys in particular evil states:
#+END_SRC #+END_SRC
~map!~ supports other properties, like ~:after~, ~:when~, ~:prefix~ and ~:desc~. ~map!~ supports other properties, like ~:after~, ~:when~, ~:prefix~ and ~:desc~.
Look at ~map!~'s documentation for more information. Look at ~map!~'s documentation for more information (=SPC h f map!= for evil
users, =C-h f map!= otherwise).
You'll find a more comprehensive example of ~map!~'s usage in You'll find a more comprehensive example of ~map!~'s usage in
[[file:/mnt/projects/conf/doom-emacs-docs/modules/config/default/+evil-bindings.el][config/default/+evil-bindings.el]]. [[file:/mnt/projects/conf/doom-emacs-docs/modules/config/default/+evil-bindings.el][config/default/+evil-bindings.el]].
@ -757,6 +760,7 @@ These variables control what key to use for leader and localleader keys:
e.g. e.g.
#+BEGIN_SRC emacs-lisp #+BEGIN_SRC emacs-lisp
;; in ~/.doom.d/config.el
(setq doom-leader-key "," (setq doom-leader-key ","
doom-localleader-key "\\") doom-localleader-key "\\")
#+END_SRC #+END_SRC
@ -775,7 +779,7 @@ You'll find more precise documentation on the variable through =SPC h v
display-line-numbers-type= or =C-h v display-line-numbers-type=. display-line-numbers-type= or =C-h v display-line-numbers-type=.
#+begin_quote #+begin_quote
The ~'visual~ option is unavailable to Emacs 25 users. The ~'visual~ option is unavailable in Emacs 25.
#+end_quote #+end_quote
There is also ~M-x doom/toggle-line-numbers~ (bound to =SPC t l= by default) for There is also ~M-x doom/toggle-line-numbers~ (bound to =SPC t l= by default) for
@ -799,22 +803,24 @@ Short answer: You can, but you shouldn't.
Long answer: Restarting Emacs is always your safest bet, but Doom provides a few Long answer: Restarting Emacs is always your safest bet, but Doom provides a few
tools for experienced Emacs users to skirt around it (most of the time): tools for experienced Emacs users to skirt around it (most of the time):
- Generally, you can evaluate your changes on-the-fly with ~+eval/region~ (bound - Evaluate your changes on-the-fly with ~+eval/region~ (bound to the =gr=
to the =gr= operator for evil users) or ~eval-last-sexp~ (bound to =C-x C-e=). operator for evil users) or ~eval-last-sexp~ (bound to =C-x C-e=). Changes
Changes take effect immediately. take effect immediately.
- On-the-fly evaluation won't work for all changes. For instance, changing your - On-the-fly evaluation won't work for all changes. For instance, changing your
~doom!~ block (i.e. the list of modules for Doom to enable) will almost always ~doom!~ block (i.e. the list of modules for Doom to enable) will always
require a restart (and ~bin/doom refresh~). require a restart (and ~bin/doom refresh~).
Doom /does/ provide ~M-x doom/reload~ for your convenience, which will run Doom provides ~M-x doom/reload~ for your convenience, which will run ~doom
~doom refresh~, restart the Doom initialization process, and re-evaluate your refresh~, restart the Doom initialization process, and re-evaluate your
personal config, but this won't clear pre-existing state. That won't usually personal config, but this won't clear pre-existing state. That may or may not
be a problem, but Doom cannot anticipate any complications arising from your be a problem, this hasn't be thoroughly tested, and Doom cannot anticipate
private config. If you intend to use ~doom/reload~, try to design your config complications arising from your private config.
to be idempotent.
If you intend to use ~doom/reload~, try to design your config to be
idempotent.
- Many ~bin/doom~ commands are available as elisp commands with the ~doom//*~ - Many ~bin/doom~ commands are available as elisp commands with the ~doom//*~
prefix. e.g. ~doom//refresh~, ~doom//update~, etc. Feel free to use them, but prefix. e.g. ~doom//refresh~, ~doom//update~, etc. Feel free to use them, but
consider them highly experimental and subject to change. consider them highly experimental and subject to change without notice.
- You can quickly restart Emacs and restore the last session with - You can quickly restart Emacs and restore the last session with
~doom/restart-and-restore~ (bound to =SPC q r=). ~doom/restart-and-restore~ (bound to =SPC q r=).
@ -833,7 +839,17 @@ divulging, your secrets to others).
You can run ~bin/doom help~ to see what it's capable of, but here are the You can run ~bin/doom help~ to see what it's capable of, but here are the
highlights: highlights:
+ ~doom doctor~ :: Diagnose common issues in your environment and list missing
external dependencies for your enabled modules.
+ ~doom install~ :: Install any missing packages.
+ ~doom update~ :: Update all packages that Doom's (enabled) modules use. + ~doom update~ :: Update all packages that Doom's (enabled) modules use.
+ ~doom refresh~ :: Ensures that all missing packages are installed, orphaned
packages are removed, and metadata properly generated.
+ ~doom env~ :: Regenerates your envvar file, which contains a snapshot of your
shell environment for Doom Emacs to load on startup. You need to run this for
changes to your shell environment to take effect.
+ ~doom purge~ :: Purge orphaned packages (i.e. ones that aren't needed anymore)
and regraft your repos.
+ ~doom upgrade~ :: Upgrade Doom to the latest version (then update your + ~doom upgrade~ :: Upgrade Doom to the latest version (then update your
packages). This is equivalent to: packages). This is equivalent to:
@ -842,19 +858,6 @@ highlights:
doom refresh doom refresh
doom update doom update
#+END_SRC #+END_SRC
+ ~doom doctor~ :: Diagnose common issues in your environment and list missing
external dependencies for your enabled modules.
+ ~doom install~ :: Install any missing packages.
+ ~doom purge~ :: Purge orphaned packages (i.e. ones that aren't needed anymore)
and regraft your repos.
+ ~doom autoloads~ :: Regenerates autoloads files, which tell Emacs where to
find lazy-loaded functions and packages. Necessary if you change autoload
files in modules.
+ ~doom refresh~ :: Equivalent to ~doom autoloads && doom autoremove && doom
install~.
+ ~doom env~ :: Regenerates your envvar file, which contains a snapshot of your
shell environment for Doom Emacs to load on startup. You need to run this for
changes to your shell environment to take effect.
** When to run ~doom refresh~ ** When to run ~doom refresh~
As a rule of thumb you should run ~doom refresh~ whenever you: As a rule of thumb you should run ~doom refresh~ whenever you:
@ -1008,10 +1011,10 @@ of common issues and may give you some clues as to what is wrong.
** I see a blank scratch buffer at startup ** I see a blank scratch buffer at startup
This commonly means that Emacs can't find your private doom config (in This commonly means that Emacs can't find your private doom config (in
=~/.doom.d= or =~/.config/doom=). Make sure *one of these two* folders exist, =~/.doom.d= or =~/.config/doom=). Make sure *only one of these two* folders
and that it has an init.el file with a ~doom!~ block. Running ~doom install~ exist, and that it has an init.el file with a ~doom!~ block. Running ~doom
will populate your private doom directory with the bare minimum you need to get install~ will populate your private doom directory with the bare minimum you
going. need to get going.
If nothing else works, try running ~bin/doom doctor~. It can detect a variety of If nothing else works, try running ~bin/doom doctor~. It can detect a variety of
common issues and may give you some clues as to what is wrong. common issues and may give you some clues as to what is wrong.
@ -1044,7 +1047,7 @@ The most common culprit for these types of errors are:
newer (or older) version of Emacs, you'll need to either reinstall or newer (or older) version of Emacs, you'll need to either reinstall or
recompile your installed plugins. This can be done by: recompile your installed plugins. This can be done by:
+ Running ~doom rebuild -f~, + Running ~doom build~,
+ Or deleting =~/.emacs.d/.local/straight= then running ~doom install~ (this + Or deleting =~/.emacs.d/.local/straight= then running ~doom install~ (this
will take a while). will take a while).