diff options
| author | Eric S. Raymond | 2019-05-25 13:22:44 -0400 |
|---|---|---|
| committer | Eric S. Raymond | 2019-05-25 13:23:46 -0400 |
| commit | d68ed152ffe4369b3fe082cf39d631cc5360143b (patch) | |
| tree | f0123dfb8c9e93842b4d2185437fff0d35467092 /doc | |
| parent | cd7a0bd00802b9331229dfe4a70ea9690d2d70fc (diff) | |
| download | emacs-d68ed152ffe4369b3fe082cf39d631cc5360143b.tar.gz emacs-d68ed152ffe4369b3fe082cf39d631cc5360143b.zip | |
Implement and document XDG-style startup files under ~/.config.
* lisp/startup.el (command-line): Allow XDG-style as well as old
style init paths.
* doc/startup.texi: Document the above change.
Diffstat (limited to 'doc')
| -rw-r--r-- | doc/emacs/custom.texi | 46 |
1 files changed, 30 insertions, 16 deletions
diff --git a/doc/emacs/custom.texi b/doc/emacs/custom.texi index bdd6decb6b5..982cea1f213 100644 --- a/doc/emacs/custom.texi +++ b/doc/emacs/custom.texi | |||
| @@ -380,7 +380,7 @@ lines of code to your initialization file, to set the variable | |||
| 380 | file. For example: | 380 | file. For example: |
| 381 | 381 | ||
| 382 | @example | 382 | @example |
| 383 | (setq custom-file "~/.emacs-custom.el") | 383 | (setq custom-file "~/.config/emacs-custom.el") |
| 384 | (load custom-file) | 384 | (load custom-file) |
| 385 | @end example | 385 | @end example |
| 386 | 386 | ||
| @@ -390,14 +390,14 @@ Emacs versions, like this: | |||
| 390 | @example | 390 | @example |
| 391 | (cond ((< emacs-major-version 22) | 391 | (cond ((< emacs-major-version 22) |
| 392 | ;; @r{Emacs 21 customization.} | 392 | ;; @r{Emacs 21 customization.} |
| 393 | (setq custom-file "~/.custom-21.el")) | 393 | (setq custom-file "~/.config/custom-21.el")) |
| 394 | ((and (= emacs-major-version 22) | 394 | ((and (= emacs-major-version 22) |
| 395 | (< emacs-minor-version 3)) | 395 | (< emacs-minor-version 3)) |
| 396 | ;; @r{Emacs 22 customization, before version 22.3.} | 396 | ;; @r{Emacs 22 customization, before version 22.3.} |
| 397 | (setq custom-file "~/.custom-22.el")) | 397 | (setq custom-file "~/.config/custom-22.el")) |
| 398 | (t | 398 | (t |
| 399 | ;; @r{Emacs version 22.3 or later.} | 399 | ;; @r{Emacs version 22.3 or later.} |
| 400 | (setq custom-file "~/.emacs-custom.el"))) | 400 | (setq custom-file "~/.config/emacs-custom.el"))) |
| 401 | 401 | ||
| 402 | (load custom-file) | 402 | (load custom-file) |
| 403 | @end example | 403 | @end example |
| @@ -2215,16 +2215,28 @@ as a function from Lisp programs. | |||
| 2215 | @cindex init file | 2215 | @cindex init file |
| 2216 | @cindex .emacs file | 2216 | @cindex .emacs file |
| 2217 | @cindex ~/.emacs file | 2217 | @cindex ~/.emacs file |
| 2218 | @cindex ~/.config/emacs file | ||
| 2218 | @cindex Emacs initialization file | 2219 | @cindex Emacs initialization file |
| 2219 | @cindex startup (init file) | 2220 | @cindex startup (init file) |
| 2220 | 2221 | ||
| 2221 | When Emacs is started, it normally tries to load a Lisp program from | 2222 | When Emacs is started, it normally tries to load a Lisp program from |
| 2222 | an @dfn{initialization file}, or @dfn{init file} for short. This | 2223 | an @dfn{initialization file}, or @dfn{init file} for short. This |
| 2223 | file, if it exists, specifies how to initialize Emacs for you. Emacs | 2224 | file, if it exists, specifies how to initialize Emacs for you. Emacs |
| 2224 | looks for your init file using the filenames @file{~/.emacs}, | 2225 | looks for your init file using the filenames |
| 2225 | @file{~/.emacs.el}, or @file{~/.emacs.d/init.el}; you can choose to | 2226 | @file{~/.config/emacs},. @file{~/.emacs}, @file{~/.config/emacs.el}, |
| 2226 | use any one of these three names (@pxref{Find Init}). Here, @file{~/} | 2227 | @file{~/.emacs.el}, @file{~/.config/emacs.d/init.el} or |
| 2227 | stands for your home directory. | 2228 | @file{~/.emacs.d/init.el}; you can choose to use any one of these |
| 2229 | names (@pxref{Find Init}). Here, @file{~/} stands for your home | ||
| 2230 | directory. | ||
| 2231 | |||
| 2232 | While the @file{~/.emacs} and @file{~/.emacs.d/init.el} locations | ||
| 2233 | are backward-compatible to older Emacs versions, and the rest of this | ||
| 2234 | chapter will use them to name your initialization file, it is better practice | ||
| 2235 | to group all of your dotfiles under @file{.config} so that if you have | ||
| 2236 | to troubleshoot a problem that might be due to a bad init file, or | ||
| 2237 | archive a collection of them, it can be done by renaming or | ||
| 2238 | copying that directory. Note that the @file{.config} versions | ||
| 2239 | don't have a leading dot on the basename part of the file. | ||
| 2228 | 2240 | ||
| 2229 | You can use the command line switch @samp{-q} to prevent loading | 2241 | You can use the command line switch @samp{-q} to prevent loading |
| 2230 | your init file, and @samp{-u} (or @samp{--user}) to specify a | 2242 | your init file, and @samp{-u} (or @samp{--user}) to specify a |
| @@ -2630,14 +2642,16 @@ library. @xref{Hooks}. | |||
| 2630 | @node Find Init | 2642 | @node Find Init |
| 2631 | @subsection How Emacs Finds Your Init File | 2643 | @subsection How Emacs Finds Your Init File |
| 2632 | 2644 | ||
| 2633 | Normally Emacs uses your home directory to find @file{~/.emacs}; | 2645 | Normally Emacs uses your home directory to find |
| 2634 | that's what @samp{~} means in a file name. @xref{General Variables, HOME}. | 2646 | @file{~/.config/emacs} or @file{~/.emacs}; that's what @samp{~} means |
| 2635 | If neither @file{~/.emacs} nor @file{~/.emacs.el} is found, Emacs looks for | 2647 | in a file name. @xref{General Variables, HOME}. If none of |
| 2636 | @file{~/.emacs.d/init.el} (which, like @file{~/.emacs.el}, can be | 2648 | @file{~/.config/emacs}, @file{~/.emacs}, @file{~/.config/emacs.el} nor |
| 2637 | byte-compiled). | 2649 | @file{~/.emacs.el} is found, Emacs looks for |
| 2650 | @file{~/.config/emacs.d/init.el} or @file{~/.emacs.d/init.el} (these, | ||
| 2651 | like @file{~/.emacs.el}, can be byte-compiled). | ||
| 2638 | 2652 | ||
| 2639 | However, if you run Emacs from a shell started by @code{su}, Emacs | 2653 | However, if you run Emacs from a shell started by @code{su}, Emacs |
| 2640 | tries to find your own @file{.emacs}, not that of the user you are | 2654 | tries to find your own initialization files, not that of the user you are |
| 2641 | currently pretending to be. The idea is that you should get your own | 2655 | currently pretending to be. The idea is that you should get your own |
| 2642 | editor customizations even if you are running as the super user. | 2656 | editor customizations even if you are running as the super user. |
| 2643 | 2657 | ||
| @@ -2688,10 +2702,10 @@ Type @kbd{C-q}, followed by the key you want to bind, to insert @var{char}. | |||
| 2688 | @cindex early init file | 2702 | @cindex early init file |
| 2689 | 2703 | ||
| 2690 | Most customizations for Emacs should be put in the normal init file, | 2704 | Most customizations for Emacs should be put in the normal init file, |
| 2691 | @file{.emacs} or @file{~/.emacs.d/init.el}. However, it is sometimes desirable | 2705 | @file{.config/emacs} or @file{~/.config/emacs.d/init.el}. However, it is sometimes desirable |
| 2692 | to have customizations that take effect during Emacs startup earlier than the | 2706 | to have customizations that take effect during Emacs startup earlier than the |
| 2693 | normal init file is processed. Such customizations can be put in the early | 2707 | normal init file is processed. Such customizations can be put in the early |
| 2694 | init file, @file{~/.emacs.d/early-init.el}. This file is loaded before the | 2708 | init file, @file{~/.config/emacs.d/early-init.el} or @file{~/.emacs.d/early-init.el}. This file is loaded before the |
| 2695 | package system and GUI is initialized, so in it you can customize variables | 2709 | package system and GUI is initialized, so in it you can customize variables |
| 2696 | that affect frame appearance as well as the package initialization process, | 2710 | that affect frame appearance as well as the package initialization process, |
| 2697 | such as @code{package-enable-at-startup}, @code{package-load-list}, and | 2711 | such as @code{package-enable-at-startup}, @code{package-load-list}, and |