2015-01-27 03:51:47 +00:00
|
|
|
;;; core-dotspacemacs.el --- Spacemacs Core File
|
2015-01-14 04:12:56 +00:00
|
|
|
;;
|
2021-03-22 20:11:29 +00:00
|
|
|
;; Copyright (c) 2012-2021 Sylvain Benner & Contributors
|
2015-01-14 04:12:56 +00:00
|
|
|
;;
|
|
|
|
;; Author: Sylvain Benner <sylvain.benner@gmail.com>
|
|
|
|
;; URL: https://github.com/syl20bnr/spacemacs
|
|
|
|
;;
|
|
|
|
;; This file is not part of GNU Emacs.
|
|
|
|
;;
|
2021-03-24 03:31:44 +00:00
|
|
|
;; This program is free software; you can redistribute it and/or modify
|
|
|
|
;; it under the terms of the GNU General Public License as published by
|
|
|
|
;; the Free Software Foundation, either version 3 of the License, or
|
|
|
|
;; (at your option) any later version.
|
|
|
|
;;
|
|
|
|
;; This program is distributed in the hope that it will be useful,
|
|
|
|
;; but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
|
|
;; GNU General Public License for more details.
|
|
|
|
;;
|
|
|
|
;; You should have received a copy of the GNU General Public License
|
|
|
|
;; along with this program. If not, see <http://www.gnu.org/licenses/>.
|
|
|
|
|
2021-02-11 17:41:39 +00:00
|
|
|
|
|
|
|
(require 'core-customization)
|
|
|
|
|
2014-12-25 20:24:26 +00:00
|
|
|
(defconst dotspacemacs-template-directory
|
|
|
|
(expand-file-name (concat spacemacs-core-directory "templates/"))
|
|
|
|
"Templates directory.")
|
|
|
|
|
2015-09-01 01:52:47 +00:00
|
|
|
(defconst dotspacemacs-test-results-buffer "*dotfile-test-results*"
|
|
|
|
"Name of the buffer to display dotfile test results.")
|
|
|
|
|
2018-06-16 19:21:58 +00:00
|
|
|
(defvar dotspacemacs--user-config-elapsed-time 0
|
|
|
|
"Time spent in `dotspacemacs/user-config' function.
|
|
|
|
Useful for users in order to given them a hint of potential bottleneck in
|
|
|
|
their configuration.")
|
|
|
|
|
2016-07-25 11:36:25 +00:00
|
|
|
(let* ((env (getenv "SPACEMACSDIR"))
|
|
|
|
(env-dir (when env (expand-file-name (concat env "/"))))
|
|
|
|
(env-init (and env-dir (expand-file-name "init.el" env-dir)))
|
|
|
|
(no-env-dir-default (expand-file-name
|
|
|
|
(concat user-home-directory
|
|
|
|
".spacemacs.d/")))
|
|
|
|
(default-init (expand-file-name ".spacemacs" user-home-directory)))
|
|
|
|
(defconst dotspacemacs-directory
|
2015-05-29 17:08:48 +00:00
|
|
|
(cond
|
2019-08-06 10:28:01 +00:00
|
|
|
((and env (file-exists-p env-dir)) env-dir)
|
|
|
|
((file-exists-p no-env-dir-default) no-env-dir-default)
|
|
|
|
(t nil))
|
2016-07-25 11:36:25 +00:00
|
|
|
"Optional spacemacs directory, which defaults to
|
2015-05-29 17:08:48 +00:00
|
|
|
~/.spacemacs.d. This setting can be overridden using the
|
|
|
|
SPACEMACSDIR environment variable. If neither of these
|
|
|
|
directories exist, this variable will be nil.")
|
|
|
|
|
2016-07-25 11:36:25 +00:00
|
|
|
(defvar dotspacemacs-filepath
|
|
|
|
(let ((spacemacs-dir-init (when dotspacemacs-directory
|
2019-08-06 10:28:01 +00:00
|
|
|
(concat dotspacemacs-directory
|
|
|
|
"init.el"))))
|
2016-07-25 11:36:25 +00:00
|
|
|
(cond
|
2016-07-25 16:35:25 +00:00
|
|
|
(env-init)
|
2016-07-25 11:36:25 +00:00
|
|
|
((file-exists-p default-init) default-init)
|
2019-08-06 10:28:01 +00:00
|
|
|
((and dotspacemacs-directory (file-exists-p spacemacs-dir-init))
|
|
|
|
spacemacs-dir-init)
|
2016-07-25 11:36:25 +00:00
|
|
|
(t default-init)))
|
2016-07-25 16:35:25 +00:00
|
|
|
"Filepath to the installed dotfile. If SPACEMACSDIR is given
|
|
|
|
then SPACEMACSDIR/init.el is used. Otherwise, if ~/.spacemacs
|
|
|
|
exists, then this is used. If ~/.spacemacs does not exist, then
|
|
|
|
check for init.el in dotspacemacs-directory and use this if it
|
|
|
|
exists. Otherwise, fallback to ~/.spacemacs"))
|
2015-03-31 02:18:32 +00:00
|
|
|
|
2021-02-11 17:41:39 +00:00
|
|
|
(spacemacs|defc dotspacemacs-distribution 'spacemacs
|
2015-09-08 01:16:15 +00:00
|
|
|
"Base distribution to use. This is a layer contained in the directory
|
2016-06-09 02:16:40 +00:00
|
|
|
`+distributions'. For now available distributions are `spacemacs-base'
|
2021-02-11 17:41:39 +00:00
|
|
|
or `spacemacs'."
|
|
|
|
'(choice (const spacemacs-base) (const spacemacs))
|
|
|
|
'spacemacs-dotspacemacs-layers)
|
2015-09-08 01:16:15 +00:00
|
|
|
|
2021-02-11 17:41:39 +00:00
|
|
|
(spacemacs|defc dotspacemacs-enable-emacs-pdumper nil
|
2018-05-20 08:35:30 +00:00
|
|
|
"If non-nil then enable support for the portable dumper. You'll need
|
|
|
|
to compile Emacs 27 from source following the instructions in file
|
2021-02-11 17:41:39 +00:00
|
|
|
EXPERIMENTAL.org at the root of the git repository."
|
|
|
|
'boolean
|
|
|
|
'spacemacs-dotspacemacs-init)
|
2018-05-20 08:35:30 +00:00
|
|
|
|
2021-02-11 17:41:39 +00:00
|
|
|
(spacemacs|defc dotspacemacs-emacs-pdumper-executable-file "emacs"
|
|
|
|
"File path pointing to emacs 27 or later executable."
|
|
|
|
'string
|
|
|
|
'spacemacs-dotspacemacs-init)
|
2018-05-06 04:02:44 +00:00
|
|
|
|
2021-02-11 17:41:39 +00:00
|
|
|
(spacemacs|defc dotspacemacs-emacs-dumper-dump-file
|
2020-05-17 17:41:08 +00:00
|
|
|
(format "spacemacs-%s.pdmp" emacs-version)
|
2018-05-08 04:58:12 +00:00
|
|
|
"Name of the Spacemacs dump file. This is the file will be created by the
|
|
|
|
portable dumper in the cache directory under dumps sub-directory.
|
|
|
|
To load it when starting Emacs add the parameter `--dump-file'
|
2018-05-06 04:02:44 +00:00
|
|
|
when invoking Emacs 27.1 executable on the command line, for instance:
|
2021-02-11 17:41:39 +00:00
|
|
|
./emacs --dump-file=$HOME/.emacs.d/.cache/dumps/spacemacs-27.1.pdmp"
|
|
|
|
'string
|
|
|
|
'spacemacs-dotspacemacs-init)
|
2018-05-06 04:02:44 +00:00
|
|
|
|
2021-02-11 17:41:39 +00:00
|
|
|
(spacemacs|defc dotspacemacs-gc-cons '(100000000 0.1)
|
2018-01-29 04:22:38 +00:00
|
|
|
"Set `gc-cons-threshold' and `gc-cons-percentage' when startup finishes.
|
|
|
|
This is an advanced option and should not be changed unless you suspect
|
2021-02-11 17:41:39 +00:00
|
|
|
performance issues due to garbage collection operations."
|
|
|
|
'(list integer float)
|
|
|
|
'spacemacs-dotspacemacs-init)
|
2018-01-29 04:22:38 +00:00
|
|
|
|
2021-02-11 17:41:39 +00:00
|
|
|
(spacemacs|defc dotspacemacs-read-process-output-max (* 1024 1024)
|
2020-05-15 20:07:17 +00:00
|
|
|
"Set `read-process-output-max' when startup finishes.
|
|
|
|
This defines how much data is read from a foreign process.
|
|
|
|
Setting this >= 1 MB should increase performance for lsp servers
|
2021-02-11 17:41:39 +00:00
|
|
|
in emacs 27."
|
|
|
|
'integer
|
|
|
|
'spacemacs-dotspacemacs-init)
|
2020-05-15 20:07:17 +00:00
|
|
|
|
2021-02-11 17:41:39 +00:00
|
|
|
(spacemacs|defc dotspacemacs-elpa-https t
|
2015-11-18 18:49:41 +00:00
|
|
|
"If non nil ELPA repositories are contacted via HTTPS whenever it's
|
|
|
|
possible. Set it to nil if you have no way to use HTTPS in your
|
2021-02-11 17:41:39 +00:00
|
|
|
environment, otherwise it is strongly recommended to let it set to t."
|
|
|
|
'boolean
|
|
|
|
'spacemacs-dotspacemacs-init)
|
2015-11-18 18:49:41 +00:00
|
|
|
|
2021-02-11 17:41:39 +00:00
|
|
|
(spacemacs|defc dotspacemacs-elpa-timeout 5
|
|
|
|
"Maximum allowed time in seconds to contact an ELPA repository."
|
|
|
|
'integer
|
|
|
|
'spacemacs-dotspacemacs-init)
|
2015-12-06 07:22:49 +00:00
|
|
|
|
2021-02-11 17:41:39 +00:00
|
|
|
(spacemacs|defc dotspacemacs-use-spacelpa nil
|
2017-11-12 14:33:58 +00:00
|
|
|
"If non-nil then Spacelpa repository is the primary source to install
|
2018-02-04 15:22:57 +00:00
|
|
|
a locked version of packages. If nil then Spacemacs will install the latest
|
2020-09-18 20:05:56 +00:00
|
|
|
version of packages from MELPA. Spacelpa is currently in experimental
|
2021-02-11 17:41:39 +00:00
|
|
|
state and should only be used for testing."
|
|
|
|
'boolean
|
|
|
|
'spacemacs-dotspacemacs-init)
|
2017-11-12 14:33:58 +00:00
|
|
|
|
2021-02-11 17:41:39 +00:00
|
|
|
(spacemacs|defc dotspacemacs-verify-spacelpa-archives nil
|
|
|
|
"If non-nil then verify the signature for downloaded Spacelpa archives."
|
|
|
|
'boolean
|
|
|
|
'spacemacs-dotspacemacs-init)
|
2017-10-30 04:57:48 +00:00
|
|
|
|
2021-02-11 17:41:39 +00:00
|
|
|
(spacemacs|defc dotspacemacs-elpa-subdirectory 'emacs-version
|
2016-08-13 12:21:01 +00:00
|
|
|
"If non-nil, a form that evaluates to a package directory. For
|
|
|
|
example, to use different package directories for different Emacs
|
2021-02-11 17:41:39 +00:00
|
|
|
versions, set this to `emacs-version'."
|
|
|
|
'sexp
|
|
|
|
'spacemacs-dotspacemacs-init)
|
2015-10-14 08:52:45 +00:00
|
|
|
|
2021-02-11 17:41:39 +00:00
|
|
|
(spacemacs|defc dotspacemacs-configuration-layer-path '()
|
2014-11-22 02:19:50 +00:00
|
|
|
"List of additional paths where to look for configuration layers.
|
2021-02-11 17:41:39 +00:00
|
|
|
Paths must have a trailing slash (ie. `~/.mycontribs/')"
|
|
|
|
'(repeat string)
|
|
|
|
'spacemacs-dotspacemacs-layers)
|
2014-11-22 02:19:50 +00:00
|
|
|
|
2021-02-11 17:41:39 +00:00
|
|
|
(spacemacs|defc dotspacemacs-install-packages 'used-only
|
2016-08-20 00:31:57 +00:00
|
|
|
"Defines the behaviour of Spacemacs when installing packages.
|
|
|
|
Possible values are `used-only', `used-but-keep-unused' and `all'. `used-only'
|
2016-10-25 19:30:23 +00:00
|
|
|
installs only explicitly used packages and deletes any unused packages as well
|
2016-08-20 00:31:57 +00:00
|
|
|
as their unused dependencies. `used-but-keep-unused' installs only the used
|
2016-10-25 19:30:23 +00:00
|
|
|
packages but won't delete unused ones. `all' installs *all*
|
2021-02-11 17:41:39 +00:00
|
|
|
packages supported by Spacemacs and never uninstalls them."
|
|
|
|
'(choice (const used-only) (const used-but-keep-unused) (const all))
|
|
|
|
'spacemacs-dotspacemacs-layers)
|
2016-05-31 02:58:59 +00:00
|
|
|
|
2021-02-11 17:41:39 +00:00
|
|
|
(spacemacs|defc dotspacemacs-enable-lazy-installation 'unused
|
2016-08-20 00:31:57 +00:00
|
|
|
"Lazy installation of layers (i.e. layers are installed only when a file
|
2016-03-27 19:55:24 +00:00
|
|
|
with a supported type is opened). Possible values are `all', `unused' and `nil'.
|
|
|
|
`unused' will lazy install only unused layers (i.e. layers not listed in
|
|
|
|
variable `dotspacemacs-configuration-layers'), `all' will lazy install any layer
|
|
|
|
that support lazy installation even the layers listed in
|
|
|
|
`dotspacemacs-configuration-layers'. `nil' disable the lazy installation feature
|
|
|
|
and you have to explicitly list a layer in the variable
|
2021-02-11 17:41:39 +00:00
|
|
|
`dotspacemacs-configuration-layers' to install it."
|
|
|
|
'(choice (const all) (const unused) (const nil))
|
|
|
|
'spacemacs-dotspacemacs-layers)
|
2016-01-31 05:05:27 +00:00
|
|
|
|
2021-02-11 17:41:39 +00:00
|
|
|
(spacemacs|defc dotspacemacs-ask-for-lazy-installation t
|
2016-03-27 19:56:15 +00:00
|
|
|
"If non-nil then Spacemacs will ask for confirmation before installing
|
2021-02-11 17:41:39 +00:00
|
|
|
a layer lazily."
|
|
|
|
'boolean
|
|
|
|
'spacemacs-dotspacemacs-layers)
|
2016-03-27 19:56:15 +00:00
|
|
|
|
2021-02-11 17:41:39 +00:00
|
|
|
(spacemacs|defc dotspacemacs-additional-packages '()
|
2015-04-21 04:33:23 +00:00
|
|
|
"List of additional packages that will be installed wihout being
|
|
|
|
wrapped in a layer. If you need some configuration for these
|
|
|
|
packages then consider to create a layer, you can also put the
|
2021-02-11 17:41:39 +00:00
|
|
|
configuration in `dotspacemacs/user-config'."
|
2021-03-20 22:49:57 +00:00
|
|
|
'(repeat (choice symbol (cons symbol sexp)))
|
2021-02-11 17:41:39 +00:00
|
|
|
'spacemacs-dotspacemacs-layers)
|
2015-04-21 04:33:23 +00:00
|
|
|
|
2017-02-02 03:59:03 +00:00
|
|
|
(defvar dotspacemacs--additional-theme-packages '()
|
2018-08-01 18:51:57 +00:00
|
|
|
"Same as `dotspacemacs-additional-packages' but reserved for themes declared
|
2017-02-02 03:59:03 +00:00
|
|
|
in `dotspacemacs-themes'.")
|
2017-01-26 04:30:25 +00:00
|
|
|
|
2021-02-11 17:41:39 +00:00
|
|
|
(spacemacs|defc dotspacemacs-editing-style 'vim
|
2016-03-18 00:38:04 +00:00
|
|
|
"One of `vim', `emacs' or `hybrid'.
|
|
|
|
`hybrid' is like `vim' except that `insert state' is replaced by the
|
|
|
|
`hybrid state' with `emacs' key bindings. The value can also be a list
|
|
|
|
with `:variables' keyword (similar to layers). Check the editing styles
|
2021-02-11 17:41:39 +00:00
|
|
|
section of the documentation for details on available variables."
|
2021-03-21 00:56:34 +00:00
|
|
|
'(choice (const vim) (cons symbol sexp)
|
|
|
|
(const emacs) (cons symbol sexp)
|
|
|
|
(const hybrid) (cons symbol sexp))
|
2021-02-11 17:41:39 +00:00
|
|
|
'spacemacs-dotspacemacs-init)
|
2015-03-19 04:29:42 +00:00
|
|
|
|
2021-02-11 17:41:39 +00:00
|
|
|
(spacemacs|defc dotspacemacs-startup-banner 'official
|
2019-08-06 10:28:01 +00:00
|
|
|
"Specify the startup banner. Default value is `official', it displays
|
2015-03-13 03:55:38 +00:00
|
|
|
the official spacemacs logo. An integer value is the index of text
|
|
|
|
banner, `random' chooses a random text banner in `core/banners'
|
|
|
|
directory. A string value must be a path to a .PNG file.
|
2021-02-11 17:41:39 +00:00
|
|
|
If the value is nil then no banner is displayed."
|
|
|
|
'(choice (const official) (const random) (const nil) string integer)
|
|
|
|
'spacemacs-dotspacemacs-init)
|
|
|
|
|
|
|
|
(spacemacs|defc dotspacemacs-startup-buffer-show-version t
|
|
|
|
"If true, show Spacemacs and Emacs version at the top right of the
|
|
|
|
Spacemacs buffer."
|
|
|
|
'boolean
|
|
|
|
'spacemacs-dotspacemacs-init)
|
|
|
|
|
|
|
|
(spacemacs|defc dotspacemacs-scratch-mode 'text-mode
|
|
|
|
"Default major mode of the scratch buffer."
|
|
|
|
'symbol
|
|
|
|
'spacemacs-dotspacemacs-init)
|
|
|
|
|
|
|
|
(spacemacs|defc dotspacemacs-initial-scratch-message 'nil
|
|
|
|
"Initial message in the scratch buffer."
|
|
|
|
'(choice (const nil) string)
|
|
|
|
'spacemacs-dotspacemacs-init)
|
|
|
|
|
|
|
|
(spacemacs|defc dotspacemacs-check-for-update nil
|
2015-12-11 06:47:34 +00:00
|
|
|
"If non nil then spacemacs will check for updates at startup
|
2016-08-04 00:37:00 +00:00
|
|
|
when the current branch is not `develop'. Note that checking for
|
|
|
|
new versions works via git commands, thus it calls GitHub services
|
2021-02-11 17:41:39 +00:00
|
|
|
whenever you start Emacs."
|
|
|
|
'boolean
|
|
|
|
'spacemacs-dotspacemacs-init)
|
2015-11-22 15:49:20 +00:00
|
|
|
|
2021-02-11 17:41:39 +00:00
|
|
|
(spacemacs|defc dotspacemacs-configuration-layers '(emacs-lisp)
|
|
|
|
"List of configuration layers to load."
|
|
|
|
'(repeat (choice symbol (cons symbol sexp)))
|
|
|
|
'spacemacs-dotspacemacs-layers)
|
2014-11-22 02:19:50 +00:00
|
|
|
|
2016-10-10 13:11:55 +00:00
|
|
|
(defvar dotspacemacs--configuration-layers-saved nil
|
|
|
|
"Saved value of `dotspacemacs-configuration-layers' after sync.")
|
|
|
|
|
2021-02-11 17:41:39 +00:00
|
|
|
(spacemacs|defc dotspacemacs-themes '(spacemacs-dark
|
|
|
|
spacemacs-light)
|
2015-01-24 03:02:08 +00:00
|
|
|
"List of themes, the first of the list is loaded when spacemacs starts.
|
2016-04-05 10:52:54 +00:00
|
|
|
Press `SPC T n' to cycle to the next theme in the list (works great
|
2021-02-11 17:41:39 +00:00
|
|
|
with 2 themes variants, one dark and one light"
|
2021-03-20 22:49:57 +00:00
|
|
|
'(repeat (choice symbol (cons symbol sexp)))
|
2021-02-11 17:41:39 +00:00
|
|
|
'spacemacs-dotspacemacs-init)
|
2014-11-28 04:14:51 +00:00
|
|
|
|
2021-02-11 17:41:39 +00:00
|
|
|
(spacemacs|defc dotspacemacs-mode-line-theme '(spacemacs
|
|
|
|
:separator wave
|
|
|
|
:separator-scale 1.5)
|
2018-01-12 04:53:44 +00:00
|
|
|
"Set the theme for the Spaceline. Supported themes are `spacemacs',
|
2018-09-04 18:52:30 +00:00
|
|
|
`all-the-icons', `custom', `doom',`vim-powerline' and `vanilla'. The first three
|
|
|
|
are spaceline themes. `doom' is the doom-emacs mode-line. `vanilla' is default
|
|
|
|
Emacs mode-line. `custom' is a user defined themes, refer to the
|
|
|
|
DOCUMENTATION.org for more info on how to create your own spaceline theme. Value
|
|
|
|
can be a symbol or a list with additional properties like '(all-the-icons
|
2021-02-11 17:41:39 +00:00
|
|
|
:separator-scale 1.5)."
|
|
|
|
'(choice (const spacemacs)
|
|
|
|
(const all-the-icons)
|
|
|
|
(const custom)
|
|
|
|
(const doom)
|
|
|
|
(const vim-powerline)
|
|
|
|
(const vanilla)
|
|
|
|
|
|
|
|
(cons (choice (const spacemacs)
|
|
|
|
(const all-the-icons)
|
|
|
|
(const custom)
|
|
|
|
(const doom)
|
|
|
|
(const vim-powerline)
|
|
|
|
(const vanilla))
|
|
|
|
sexp))
|
|
|
|
'spacemacs-dotspacemacs-init)
|
|
|
|
|
|
|
|
(spacemacs|defc dotspacemacs-frame-title-format "%I@%S"
|
2015-07-10 13:57:18 +00:00
|
|
|
"Default format string for a frame title bar, using the
|
2021-03-20 00:10:01 +00:00
|
|
|
original format spec, and additional customizations.
|
|
|
|
|
|
|
|
If nil then Spacemacs uses default `frame-title-format' instead of
|
|
|
|
calculating the frame title by `spacemacs/title-prepare' all the time.
|
|
|
|
This can help to avoid performance issues."
|
2021-03-19 02:50:49 +00:00
|
|
|
'(choice (const nil) string)
|
2021-02-11 17:41:39 +00:00
|
|
|
'spacemacs-dotspacemacs-init)
|
2015-07-10 13:57:18 +00:00
|
|
|
|
2021-02-11 17:41:39 +00:00
|
|
|
(spacemacs|defc dotspacemacs-icon-title-format nil
|
2017-04-28 22:44:27 +00:00
|
|
|
"Default format string for a icon title bar, using the
|
2021-02-11 17:41:39 +00:00
|
|
|
original format spec, and additional customizations."
|
|
|
|
'(choice (const nil) string)
|
|
|
|
'spacemacs-dotspacemacs-init)
|
|
|
|
|
|
|
|
(spacemacs|defc dotspacemacs-colorize-cursor-according-to-state t
|
|
|
|
"If non nil the cursor color matches the state color in GUI Emacs."
|
|
|
|
'boolean
|
|
|
|
'spacemacs-dotspacemacs-init)
|
|
|
|
|
|
|
|
(spacemacs|defc dotspacemacs-leader-key "SPC"
|
|
|
|
"The leader key."
|
|
|
|
'string
|
|
|
|
'spacemacs-dotspacemacs-init)
|
|
|
|
|
|
|
|
(spacemacs|defc dotspacemacs-emacs-leader-key "M-m"
|
|
|
|
"The leader key accessible in `emacs state' and `insert state'"
|
|
|
|
'string
|
|
|
|
'spacemacs-dotspacemacs-init)
|
|
|
|
|
|
|
|
(spacemacs|defc dotspacemacs-major-mode-leader-key ","
|
2014-12-19 05:35:14 +00:00
|
|
|
"Major mode leader key is a shortcut key which is the equivalent of
|
2021-02-11 17:41:39 +00:00
|
|
|
pressing `<leader> m`. Set it to `nil` to disable it."
|
2021-03-19 02:50:49 +00:00
|
|
|
'(choice (const nil) string)
|
2021-02-11 17:41:39 +00:00
|
|
|
'spacemacs-dotspacemacs-init)
|
|
|
|
|
|
|
|
(spacemacs|defc dotspacemacs-major-mode-emacs-leader-key
|
|
|
|
(if window-system "<M-return>" "C-M-m")
|
|
|
|
"Major mode leader key accessible in `emacs state' and `insert state'"
|
|
|
|
'string
|
|
|
|
'spacemacs-dotspacemacs-init)
|
|
|
|
|
|
|
|
(spacemacs|defc dotspacemacs-ex-command-key ":"
|
|
|
|
"The key used for Vim Ex commands."
|
|
|
|
'string
|
|
|
|
'spacemacs-dotspacemacs-init)
|
|
|
|
|
|
|
|
(spacemacs|defc dotspacemacs-command-key "SPC"
|
|
|
|
"The key used for Emacs commands (M-x) (after pressing on the leader key)."
|
|
|
|
'string
|
|
|
|
'spacemacs-dotspacemacs-init)
|
2016-01-09 07:23:04 +00:00
|
|
|
(defvaralias 'dotspacemacs-emacs-command-key 'dotspacemacs-command-key
|
|
|
|
"New official name for `dotspacemacs-command-key'")
|
2016-01-09 06:53:24 +00:00
|
|
|
|
2021-02-11 17:41:39 +00:00
|
|
|
(spacemacs|defc dotspacemacs-distinguish-gui-tab nil
|
|
|
|
"If non nil, distinguish C-i and tab in the GUI version of Emacs."
|
|
|
|
'boolean
|
|
|
|
'spacemacs-dotspacemacs-init)
|
2015-12-02 00:25:37 +00:00
|
|
|
|
|
|
|
;; (defvar dotspacemacs-distinguish-gui-ret nil
|
|
|
|
;; "If non nil, distinguish C-m and return in the GUI version of
|
|
|
|
;; emacs.")
|
|
|
|
|
2021-02-11 17:41:39 +00:00
|
|
|
(spacemacs|defc dotspacemacs-default-font '("Source Code Pro"
|
|
|
|
:size 10.0
|
|
|
|
:weight normal
|
|
|
|
:width normal)
|
2018-01-17 03:59:29 +00:00
|
|
|
"Default font, or prioritized list of fonts. This setting has no effect when
|
2021-02-11 17:41:39 +00:00
|
|
|
running Emacs in terminal."
|
|
|
|
'(choice (cons string sexp)
|
|
|
|
(repeat (cons string sexp)))
|
|
|
|
'spacemacs-dotspacemacs-init)
|
|
|
|
|
|
|
|
(spacemacs|defc dotspacemacs-folding-method 'evil
|
|
|
|
"Code folding method. Possible values are `evil', `origami' and `vimish'."
|
|
|
|
'(choice (cosnt evil) (const origami) (const vimish))
|
|
|
|
'spacemacs-dotspacemacs-init)
|
|
|
|
|
|
|
|
(spacemacs|defc dotspacemacs-default-layout-name "Default"
|
|
|
|
"Name of the default layout."
|
|
|
|
'string
|
|
|
|
'spacemacs-dotspacemacs-init)
|
|
|
|
|
|
|
|
(spacemacs|defc dotspacemacs-display-default-layout nil
|
|
|
|
"If non nil the default layout name is displayed in the mode-line."
|
|
|
|
'boolean
|
|
|
|
'spacemacs-dotspacemacs-init)
|
|
|
|
|
|
|
|
(spacemacs|defc dotspacemacs-auto-resume-layouts nil
|
2015-11-11 05:58:09 +00:00
|
|
|
"If non nil then the last auto saved layouts are resume automatically upon
|
2021-02-11 17:41:39 +00:00
|
|
|
start."
|
|
|
|
'boolean
|
|
|
|
'spacemacs-dotspacemacs-init)
|
2015-11-09 04:51:29 +00:00
|
|
|
|
2021-02-11 17:41:39 +00:00
|
|
|
(spacemacs|defc dotspacemacs-auto-generate-layout-names nil
|
2016-10-08 12:02:10 +00:00
|
|
|
"If non-nil, auto-generate layout name when creating new layouts.
|
2021-02-11 17:41:39 +00:00
|
|
|
Only has effect when using the \"jump to layout by number\" commands."
|
|
|
|
'boolean
|
|
|
|
'spacemacs-dotspacemacs-init)
|
2016-10-08 12:02:10 +00:00
|
|
|
|
2021-02-11 17:41:39 +00:00
|
|
|
(spacemacs|defc dotspacemacs-max-rollback-slots 5
|
|
|
|
"Maximum number of rollback slots to keep in the cache."
|
|
|
|
'integer
|
|
|
|
'spacemacs-dotspacemacs-init)
|
2015-11-11 05:14:46 +00:00
|
|
|
|
2021-02-11 17:41:39 +00:00
|
|
|
(spacemacs|defc dotspacemacs-large-file-size 1
|
2016-03-11 01:49:13 +00:00
|
|
|
"Size (in MB) above which spacemacs will prompt to open the large file
|
|
|
|
literally to avoid performance issues. Opening a file literally means that
|
2021-02-11 17:41:39 +00:00
|
|
|
no major mode or minor modes are active."
|
|
|
|
'integer
|
|
|
|
'spacemacs-dotspacemacs-init)
|
2015-10-30 16:20:02 +00:00
|
|
|
|
2021-02-11 17:41:39 +00:00
|
|
|
(spacemacs|defc dotspacemacs-auto-save-file-location 'cache
|
2015-06-19 03:54:07 +00:00
|
|
|
"Location where to auto-save files. Possible values are `original' to
|
|
|
|
auto-save the file in-place, `cache' to auto-save the file to another
|
2021-02-11 17:41:39 +00:00
|
|
|
file stored in the cache directory and `nil' to disable auto-saving."
|
|
|
|
'(choice (const cache) (const original) (const nil))
|
|
|
|
'spacemacs-dotspacemacs-init)
|
2015-05-04 12:12:39 +00:00
|
|
|
|
2021-02-11 17:41:39 +00:00
|
|
|
(spacemacs|defc dotspacemacs-enable-paste-transient-state nil
|
2018-07-05 15:57:52 +00:00
|
|
|
"If non-nil, the paste transient-state is enabled. While enabled, after you
|
|
|
|
paste something, pressing `C-j' and `C-k' several times cycles through the
|
2021-02-11 17:41:39 +00:00
|
|
|
elements in the `kill-ring'."
|
|
|
|
'boolean
|
|
|
|
'spacemacs-dotspacemacs-init)
|
2016-10-03 02:18:41 +00:00
|
|
|
(defvaralias
|
|
|
|
'dotspacemacs-enable-paste-micro-state
|
|
|
|
'dotspacemacs-enable-paste-transient-state
|
|
|
|
"Old name of `dotspacemacs-enable-paste-transient-state'.")
|
2015-03-10 00:57:58 +00:00
|
|
|
|
2021-02-11 17:41:39 +00:00
|
|
|
(spacemacs|defc dotspacemacs-which-key-delay 0.4
|
2015-08-28 16:41:52 +00:00
|
|
|
"Delay in seconds starting from the last keystroke after which
|
|
|
|
the which-key buffer will be shown if you have not completed a
|
|
|
|
key sequence. Setting this variable is equivalent to setting
|
2021-02-11 17:41:39 +00:00
|
|
|
`which-key-idle-delay'."
|
2021-03-29 08:00:28 +00:00
|
|
|
'number
|
2021-02-11 17:41:39 +00:00
|
|
|
'spacemacs-dotspacemacs-init)
|
2015-08-28 16:41:52 +00:00
|
|
|
|
2021-02-11 17:41:39 +00:00
|
|
|
(spacemacs|defc dotspacemacs-which-key-position 'bottom
|
2015-08-28 16:41:52 +00:00
|
|
|
"Location of the which-key popup buffer. Possible choices are bottom,
|
|
|
|
right, and right-then-bottom. The last one will display on the
|
2021-02-11 17:41:39 +00:00
|
|
|
right if possible and fallback to bottom if not."
|
|
|
|
'(choice (const right) (const bottom) (const right-then-bottom))
|
|
|
|
'spacemacs-dotspacemacs-init)
|
2015-07-25 16:56:06 +00:00
|
|
|
|
2021-02-11 17:41:39 +00:00
|
|
|
(spacemacs|defc dotspacemacs-switch-to-buffer-prefers-purpose nil
|
2016-10-18 16:32:33 +00:00
|
|
|
"Control where `switch-to-buffer' displays the buffer.
|
|
|
|
If nil, `switch-to-buffer' displays the buffer in the current
|
|
|
|
window even if another same-purpose window is available. If non
|
|
|
|
nil, `switch-to-buffer' displays the buffer in a same-purpose
|
|
|
|
window even if the buffer can be displayed in the current
|
2021-02-11 17:41:39 +00:00
|
|
|
window."
|
|
|
|
'boolean
|
|
|
|
'spacemacs-dotspacemacs-init)
|
2016-10-18 16:32:33 +00:00
|
|
|
|
2021-02-11 17:41:39 +00:00
|
|
|
(spacemacs|defc dotspacemacs-loading-progress-bar t
|
2015-02-16 02:25:12 +00:00
|
|
|
"If non nil a progress bar is displayed when spacemacs is loading. This
|
|
|
|
may increase the boot time on some systems and emacs builds, set it to nil
|
2021-02-11 17:41:39 +00:00
|
|
|
to boost the loading time."
|
|
|
|
'boolean
|
|
|
|
'spacemacs-dotspacemacs-init)
|
2015-02-16 02:25:12 +00:00
|
|
|
|
2021-02-11 17:41:39 +00:00
|
|
|
(spacemacs|defc dotspacemacs-fullscreen-at-startup nil
|
|
|
|
"If non nil the frame is fullscreen when Emacs starts up (Emacs 24.4+ only)."
|
|
|
|
'boolean
|
|
|
|
'spacemacs-dotspacemacs-init)
|
2015-01-13 04:27:07 +00:00
|
|
|
|
2021-02-11 17:41:39 +00:00
|
|
|
(spacemacs|defc dotspacemacs-fullscreen-use-non-native nil
|
2015-01-12 17:22:17 +00:00
|
|
|
"If non nil `spacemacs/toggle-fullscreen' will not use native fullscreen. Use
|
2021-02-11 17:41:39 +00:00
|
|
|
to disable fullscreen animations on macOS."
|
|
|
|
'boolean
|
|
|
|
'spacemacs-dotspacemacs-init)
|
2015-01-12 17:22:17 +00:00
|
|
|
|
2021-02-11 17:41:39 +00:00
|
|
|
(spacemacs|defc dotspacemacs-maximized-at-startup nil
|
2014-12-16 02:13:01 +00:00
|
|
|
"If non nil the frame is maximized when Emacs starts up (Emacs 24.4+ only).
|
2021-02-11 17:41:39 +00:00
|
|
|
Takes effect only if `dotspacemacs-fullscreen-at-startup' is nil."
|
|
|
|
'boolean
|
|
|
|
'spacemacs-dotspacemacs-init)
|
2014-11-22 02:19:50 +00:00
|
|
|
|
2021-02-11 17:41:39 +00:00
|
|
|
(spacemacs|defc dotspacemacs-undecorated-at-startup nil
|
|
|
|
"If non nil the frame is undecorated when Emacs starts up."
|
|
|
|
'boolean
|
|
|
|
'spacemacs-dotspacemacs-init)
|
2019-05-24 15:13:49 +00:00
|
|
|
|
2021-02-11 17:41:39 +00:00
|
|
|
(spacemacs|defc dotspacemacs-active-transparency 90
|
2014-12-27 18:15:18 +00:00
|
|
|
"A value from the range (0..100), in increasing opacity, which describes the
|
|
|
|
transparency level of a frame when it's active or selected. Transparency
|
2021-02-11 17:41:39 +00:00
|
|
|
can be toggled through `toggle-transparency'."
|
|
|
|
'integer
|
|
|
|
'spacemacs-dotspacemacs-init)
|
2014-12-27 18:15:18 +00:00
|
|
|
|
2021-02-11 17:41:39 +00:00
|
|
|
(spacemacs|defc dotspacemacs-inactive-transparency 90
|
2014-12-27 18:15:18 +00:00
|
|
|
"A value from the range (0..100), in increasing opacity, which describes the
|
|
|
|
transparency level of a frame when it's inactive or deselected. Transparency
|
2021-02-11 17:41:39 +00:00
|
|
|
can be toggled through `toggle-transparency'."
|
|
|
|
'integer
|
|
|
|
'spacemacs-dotspacemacs-init)
|
2014-12-27 18:15:18 +00:00
|
|
|
|
2021-02-11 17:41:39 +00:00
|
|
|
(spacemacs|defc dotspacemacs-show-transient-state-title t
|
|
|
|
"If non nil show the titles of transient states."
|
|
|
|
'boolean
|
|
|
|
'spacemacs-dotspacemacs-init)
|
2016-01-28 21:38:14 +00:00
|
|
|
|
2021-02-11 17:41:39 +00:00
|
|
|
(spacemacs|defc dotspacemacs-show-transient-state-color-guide t
|
|
|
|
"If non nil show the color guide hint for transient state keys."
|
|
|
|
'boolean
|
|
|
|
'spacemacs-dotspacemacs-init)
|
2016-01-28 13:27:41 +00:00
|
|
|
|
2021-02-11 17:41:39 +00:00
|
|
|
(spacemacs|defc dotspacemacs-mode-line-unicode-symbols t
|
2018-06-11 16:45:28 +00:00
|
|
|
"If non nil unicode symbols are displayed in the mode-line (eg. for lighters).
|
|
|
|
If you use Emacs as a daemon and wants unicode characters only in GUI set
|
2021-02-11 17:41:39 +00:00
|
|
|
the value to quoted `display-graphic-p'. (default t)"
|
2021-03-29 08:36:07 +00:00
|
|
|
'(choice boolean (const display-graphic-p))
|
2021-02-11 17:41:39 +00:00
|
|
|
'spacemacs-dotspacemacs-init)
|
2014-12-23 21:39:57 +00:00
|
|
|
|
2021-02-11 17:41:39 +00:00
|
|
|
(spacemacs|defc dotspacemacs-smooth-scrolling t
|
2016-01-27 14:15:34 +00:00
|
|
|
"If non nil smooth scrolling (native-scrolling) is enabled.
|
|
|
|
Smooth scrolling overrides the default behavior of Emacs which
|
|
|
|
recenters point when it reaches the top or bottom of the
|
2021-02-11 17:41:39 +00:00
|
|
|
screen."
|
|
|
|
'boolean
|
|
|
|
'spacemacs-dotspacemacs-init)
|
2014-11-22 02:19:50 +00:00
|
|
|
|
2021-03-26 14:16:24 +00:00
|
|
|
(spacemacs|defc dotspacemacs-scroll-bar-while-scrolling t
|
|
|
|
"Show the scroll bar while scrolling. The auto hide time can be configured by
|
|
|
|
setting this variable to a number."
|
|
|
|
'(choice boolean number)
|
|
|
|
'spacemacs-dotspacemacs-init)
|
|
|
|
|
2021-02-11 17:41:39 +00:00
|
|
|
(spacemacs|defc dotspacemacs-line-numbers nil
|
2016-11-04 18:33:40 +00:00
|
|
|
"Control line numbers activation.
|
|
|
|
If set to `t' or `relative' line numbers are turned on in all `prog-mode' and
|
|
|
|
`text-mode' derivatives. If set to `relative', line numbers are relative.
|
|
|
|
This variable can also be set to a property list for finer control:
|
|
|
|
'(:relative nil
|
|
|
|
:disabled-for-modes dired-mode
|
|
|
|
doc-view-mode
|
|
|
|
markdown-mode
|
|
|
|
org-mode
|
|
|
|
pdf-view-mode
|
|
|
|
text-mode
|
|
|
|
:size-limit-kb 1000)
|
|
|
|
The property `:enabled-for-modes' takes priority over `:disabled-for-modes' and
|
2021-02-11 17:41:39 +00:00
|
|
|
restricts line-number to the specified list of major-mode."
|
|
|
|
'(choice boolean
|
|
|
|
(const relative)
|
|
|
|
(const visual)
|
|
|
|
(const prog-mode)
|
|
|
|
(repeat sexp))
|
|
|
|
'spacemacs-dotspacemacs-init)
|
|
|
|
|
|
|
|
(spacemacs|defc dotspacemacs-enable-server nil
|
|
|
|
"If non-nil, start an Emacs server if one is not already running."
|
|
|
|
'boolean
|
|
|
|
'spacemacs-dotspacemacs-init)
|
|
|
|
|
|
|
|
(spacemacs|defc dotspacemacs-persistent-server nil
|
|
|
|
"If non nil advises quit functions to keep server open when quitting."
|
|
|
|
'boolean
|
|
|
|
'spacemacs-dotspacemacs-init)
|
|
|
|
|
|
|
|
(spacemacs|defc dotspacemacs-server-socket-dir nil
|
2018-03-04 13:34:05 +00:00
|
|
|
"Set the emacs server socket location.
|
|
|
|
If nil, uses whatever the Emacs default is,
|
|
|
|
otherwise a directory path like \"~/.emacs.d/server\".
|
2021-02-11 17:41:39 +00:00
|
|
|
Has no effect if `dotspacemacs-enable-server' is nil."
|
|
|
|
'(choice (const nil) string)
|
|
|
|
'spacemacs-dotspacemacs-init)
|
2018-03-04 13:34:05 +00:00
|
|
|
|
2021-02-11 17:41:39 +00:00
|
|
|
(spacemacs|defc dotspacemacs-smartparens-strict-mode nil
|
2021-03-15 20:51:18 +00:00
|
|
|
"If non-nil and `dotspacemacs-activate-smartparens-mode' is also non-nil,
|
2021-02-11 17:41:39 +00:00
|
|
|
smartparens-strict-mode will be enabled in programming modes."
|
|
|
|
'boolean
|
|
|
|
'spacemacs-dotspacemacs-init)
|
2021-03-15 20:51:18 +00:00
|
|
|
|
2021-02-11 17:41:39 +00:00
|
|
|
(spacemacs|defc dotspacemacs-activate-smartparens-mode t
|
|
|
|
"If non-nil smartparens-mode will be enabled in programming modes."
|
|
|
|
'boolean
|
|
|
|
'spacemacs-dotspacemacs-init)
|
2014-12-12 05:08:30 +00:00
|
|
|
|
2021-02-11 17:41:39 +00:00
|
|
|
(spacemacs|defc dotspacemacs-smart-closing-parenthesis nil
|
2016-02-12 14:13:39 +00:00
|
|
|
"If non-nil pressing the closing parenthesis `)' key in insert mode passes
|
2019-07-30 13:29:30 +00:00
|
|
|
over any automatically added closing parenthesis, bracket, quote, etc...
|
2021-02-11 17:41:39 +00:00
|
|
|
This can be temporary disabled by pressing `C-q' before `)'. (default nil)"
|
|
|
|
'boolean
|
|
|
|
'spacemacs-dotspacemacs-init)
|
2016-02-12 14:13:39 +00:00
|
|
|
|
2021-02-11 17:41:39 +00:00
|
|
|
(spacemacs|defc dotspacemacs-zone-out-when-idle nil
|
2019-08-06 10:28:01 +00:00
|
|
|
"Either nil or a number of seconds.
|
2021-02-11 17:41:39 +00:00
|
|
|
If non-nil zone out after the specified number of seconds."
|
|
|
|
'(choice (const nil) integer)
|
|
|
|
'spacemacs-dotspacemacs-init)
|
2017-03-29 15:08:53 +00:00
|
|
|
|
2021-02-11 17:41:39 +00:00
|
|
|
(spacemacs|defc dotspacemacs-highlight-delimiters 'all
|
2019-08-06 10:28:01 +00:00
|
|
|
"Select a scope to highlight delimiters.
|
|
|
|
Possible values are `any', `current', `all' or `nil'.
|
2021-02-11 17:41:39 +00:00
|
|
|
Default is `all' (highlight any scope and emphasize the current one."
|
|
|
|
'(choice (const all) (const any) (const current) (const nil))
|
|
|
|
'spacemacs-dotspacemacs-init)
|
2015-04-16 11:15:50 +00:00
|
|
|
|
2021-02-11 17:41:39 +00:00
|
|
|
(spacemacs|defc dotspacemacs-show-trailing-whitespace t
|
|
|
|
"Show trailing whitespace. Default is `t'."
|
|
|
|
'boolean
|
|
|
|
'spacemacs-dotspacemacs-init)
|
2021-01-19 11:34:14 +00:00
|
|
|
|
2021-02-11 17:41:39 +00:00
|
|
|
(spacemacs|defc dotspacemacs-whitespace-cleanup nil
|
2019-08-06 10:28:01 +00:00
|
|
|
"Delete whitespace while saving buffer.
|
|
|
|
|
|
|
|
Possible values are:
|
|
|
|
`all' to aggressively delete empty lines and long sequences of whitespace,
|
|
|
|
`trailing' to delete only the whitespace at end of lines,
|
|
|
|
`changed' to delete only whitespace for changed lines or
|
2021-02-11 17:41:39 +00:00
|
|
|
`nil' to disable cleanup."
|
|
|
|
'(choice (const nil) (const all) (const trailing) (const changed))
|
|
|
|
'spacemacs-dotspacemacs-init)
|
2015-10-16 16:56:57 +00:00
|
|
|
|
2021-02-11 17:41:39 +00:00
|
|
|
(spacemacs|defc dotspacemacs-search-tools '("rg" "ag" "pt" "ack" "grep")
|
2015-04-15 02:23:57 +00:00
|
|
|
"List of search tool executable names. Spacemacs uses the first installed
|
2021-02-11 17:41:39 +00:00
|
|
|
tool of the list. Supported tools are `rg', `ag', `pt', `ack' and `grep'."
|
|
|
|
'(set (const "rg") (const "ag") (const "pt") (const "ack") (const "grep"))
|
|
|
|
'spacemacs-dotspacemacs-init)
|
2015-04-15 02:23:57 +00:00
|
|
|
|
2021-02-11 17:41:39 +00:00
|
|
|
(spacemacs|defc dotspacemacs-startup-lists '((recents . 5)
|
|
|
|
(projects . 7))
|
2016-06-08 06:42:35 +00:00
|
|
|
"Association list of items to show in the startup buffer of the form
|
|
|
|
`(list-type . list-size)`. If nil it is disabled.
|
2019-08-06 10:28:01 +00:00
|
|
|
|
2016-06-08 06:42:35 +00:00
|
|
|
Possible values for list-type are:
|
2021-01-04 18:33:49 +00:00
|
|
|
`recents' `recents-by-project' `bookmarks' `projects' `agenda' `todos'.
|
2016-09-02 20:42:37 +00:00
|
|
|
List sizes may be nil, in which case
|
2021-01-04 18:33:49 +00:00
|
|
|
`spacemacs--buffer-startup-lists-length' takes effect.
|
|
|
|
In the `recents-by-project' case, the list size should be a `cons' cell whose
|
|
|
|
`car' is the maximum number of projects to show, and whose `cdr' is the maximum
|
2021-02-11 17:41:39 +00:00
|
|
|
number of recent files to show in each project."
|
|
|
|
'(choice (alist :key-type (choice (const recents)
|
|
|
|
(const recents-by-project)
|
|
|
|
(const bookmarks)
|
|
|
|
(const projects)
|
|
|
|
(const agenda)
|
|
|
|
(const todos))
|
|
|
|
:value-type (choice integer
|
|
|
|
(const nil)
|
|
|
|
;; for `recents-by-project':
|
|
|
|
(cons integer integer)))
|
|
|
|
(const nil))
|
|
|
|
'spacemacs-dotspacemacs-init)
|
|
|
|
|
|
|
|
(spacemacs|defc dotspacemacs-startup-buffer-responsive t
|
|
|
|
"True if the home buffer should respond to resize events."
|
|
|
|
'boolean
|
|
|
|
'spacemacs-dotspacemacs-init)
|
|
|
|
|
2021-03-25 15:36:48 +00:00
|
|
|
(spacemacs|defc dotspacemacs-startup-buffer-multi-digit-delay 0.4
|
|
|
|
"The minimum delay in seconds between number key presses."
|
|
|
|
'number
|
|
|
|
'spacemacs-dotspacemacs-init)
|
|
|
|
|
2021-02-11 17:41:39 +00:00
|
|
|
(spacemacs|defc dotspacemacs-excluded-packages '()
|
|
|
|
"A list of packages that will not be installed and loaded."
|
|
|
|
'(repeat symbol)
|
|
|
|
'spacemacs-dotspacemacs-layers)
|
|
|
|
|
|
|
|
(spacemacs|defc dotspacemacs-frozen-packages '()
|
|
|
|
"A list of packages that cannot be updated."
|
|
|
|
'(repeat symbol)
|
|
|
|
'spacemacs-dotspacemacs-layers)
|
|
|
|
|
|
|
|
(spacemacs|defc dotspacemacs-pretty-docs nil
|
2017-06-23 15:58:45 +00:00
|
|
|
"Run `spacemacs/prettify-org-buffer' when
|
2021-02-11 17:41:39 +00:00
|
|
|
visiting README.org files of Spacemacs."
|
|
|
|
'boolean
|
|
|
|
'spacemacs-dotspacemacs-init)
|
2017-06-23 15:58:45 +00:00
|
|
|
|
2021-02-11 17:41:39 +00:00
|
|
|
(spacemacs|defc dotspacemacs-new-empty-buffer-major-mode nil
|
|
|
|
"Set the major mode for a new empty buffer."
|
|
|
|
'symbol
|
|
|
|
'spacemacs-dotspacemacs-init)
|
2019-05-28 21:18:36 +00:00
|
|
|
|
2021-02-11 17:41:39 +00:00
|
|
|
(spacemacs|defc dotspacemacs-use-clean-aindent-mode t
|
2020-03-13 17:52:47 +00:00
|
|
|
"Correct indentation for simple modes.
|
|
|
|
|
|
|
|
If non nil activate `clean-aindent-mode' which tries to correct
|
2021-03-21 01:41:32 +00:00
|
|
|
virtual indentation of simple modes. This can interfere with mode specific
|
2020-03-13 17:52:47 +00:00
|
|
|
indent handling like has been reported for `go-mode'.
|
2021-02-11 17:41:39 +00:00
|
|
|
If it does deactivate it here. (default t)"
|
|
|
|
'boolean
|
|
|
|
'spacemacs-dotspacemacs-init)
|
2020-08-10 21:27:24 +00:00
|
|
|
|
2021-02-11 17:41:39 +00:00
|
|
|
(spacemacs|defc dotspacemacs-swap-number-row nil
|
2020-08-10 21:27:24 +00:00
|
|
|
"Shift number row for easier access.
|
|
|
|
|
2020-08-17 22:04:44 +00:00
|
|
|
If non-nil shift your number row to match the entered keyboard layout
|
|
|
|
(only in insert mode). Currently the keyboard layouts
|
|
|
|
(qwerty-us qwertz-de) are supported.
|
|
|
|
New layouts can be added in `spacemacs-editing' layer.
|
2021-02-11 17:41:39 +00:00
|
|
|
(default nil)"
|
|
|
|
'boolean
|
|
|
|
'spacemacs-dotspacemacs-init)
|
2020-03-13 17:52:47 +00:00
|
|
|
|
2021-02-11 17:41:39 +00:00
|
|
|
(spacemacs|defc dotspacemacs-home-shorten-agenda-source nil
|
2020-07-02 22:44:29 +00:00
|
|
|
"If nil the home buffer shows the full path of agenda items
|
2021-02-11 17:41:39 +00:00
|
|
|
and todos. If non nil only the file name is shown."
|
|
|
|
'boolean
|
|
|
|
'spacemacs-dotspacemacs-init)
|
2020-07-02 22:44:29 +00:00
|
|
|
|
2020-03-19 00:13:25 +00:00
|
|
|
(defvar dotspacemacs--pretty-ignore-subdirs
|
|
|
|
'(".cache/junk")
|
|
|
|
"Subdirectories of `spacemacs-start-directory' to ignore when
|
2020-08-10 22:16:09 +00:00
|
|
|
prettifying Org files.")
|
2020-03-19 00:13:25 +00:00
|
|
|
|
2021-02-11 17:41:39 +00:00
|
|
|
(spacemacs|defc dotspacemacs-scratch-buffer-persistent nil
|
2020-11-14 09:02:51 +00:00
|
|
|
"If non-nil, *scratch* buffer will be persistent. Things you write down in
|
2021-02-11 17:41:39 +00:00
|
|
|
*scratch* buffer will be saved automatically."
|
|
|
|
'boolean
|
|
|
|
'spacemacs-dotspacemacs-init)
|
2020-11-14 09:02:51 +00:00
|
|
|
|
2021-02-11 17:41:39 +00:00
|
|
|
(spacemacs|defc dotspacemacs-scratch-buffer-unkillable nil
|
2020-11-14 09:02:51 +00:00
|
|
|
"If non-nil, `kill-buffer' on *scratch* buffer
|
2021-02-11 17:41:39 +00:00
|
|
|
will bury it instead of killing."
|
|
|
|
'boolean
|
|
|
|
'spacemacs-dotspacemacs-init)
|
2020-11-14 09:02:51 +00:00
|
|
|
|
2021-02-11 17:41:39 +00:00
|
|
|
(spacemacs|defc dotspacemacs-byte-compile nil
|
|
|
|
"If non-nil, byte-compile some of Spacemacs files."
|
|
|
|
'boolean
|
|
|
|
'spacemacs-dotspacemacs-init)
|
2021-01-31 10:56:44 +00:00
|
|
|
|
2017-06-23 15:58:45 +00:00
|
|
|
(defun dotspacemacs//prettify-spacemacs-docs ()
|
|
|
|
"Run `spacemacs/prettify-org-buffer' if `buffer-file-name'
|
2020-08-10 22:16:09 +00:00
|
|
|
looks like Spacemacs documentation."
|
2017-06-23 15:58:45 +00:00
|
|
|
(when (and dotspacemacs-pretty-docs
|
2017-06-23 17:05:55 +00:00
|
|
|
spacemacs-start-directory
|
2020-03-19 00:13:25 +00:00
|
|
|
buffer-file-name)
|
|
|
|
(let ((start-dir (expand-file-name spacemacs-start-directory))
|
|
|
|
(buf-path (expand-file-name buffer-file-name)))
|
|
|
|
(when (and (string-prefix-p start-dir buf-path)
|
|
|
|
(not (--any? (string-prefix-p (expand-file-name it start-dir) buf-path)
|
|
|
|
dotspacemacs--pretty-ignore-subdirs)))
|
|
|
|
(spacemacs/prettify-org-buffer)))))
|
2017-06-23 15:58:45 +00:00
|
|
|
|
2015-04-19 03:40:24 +00:00
|
|
|
;; only for backward compatibility
|
|
|
|
(defalias 'dotspacemacs-mode 'emacs-lisp-mode)
|
2015-03-01 17:49:39 +00:00
|
|
|
|
2015-12-17 03:27:22 +00:00
|
|
|
(defmacro dotspacemacs|call-func (func &optional msg)
|
|
|
|
"Call the function from the dotfile only if it is bound.
|
2020-08-10 22:16:09 +00:00
|
|
|
If MSG is not nil then display a message in `*Messages*'. Errors
|
|
|
|
are caught and signaled to user in spacemacs buffer."
|
2015-12-17 03:27:22 +00:00
|
|
|
`(progn
|
|
|
|
(when ,msg (spacemacs-buffer/message ,msg))
|
|
|
|
(when (fboundp ',func)
|
|
|
|
(condition-case-unless-debug err
|
|
|
|
(,func)
|
|
|
|
(error
|
2016-01-12 04:58:47 +00:00
|
|
|
(configuration-layer//increment-error-count)
|
2015-12-17 03:27:22 +00:00
|
|
|
(spacemacs-buffer/append (format "Error in %s: %s\n"
|
|
|
|
',(symbol-name func)
|
|
|
|
(error-message-string err))
|
|
|
|
t))))))
|
|
|
|
|
2018-07-03 05:20:06 +00:00
|
|
|
(defun dotspacemacs/call-user-env ()
|
|
|
|
"Call the function `dotspacemacs/user-env'."
|
|
|
|
(interactive)
|
|
|
|
(dotspacemacs|call-func dotspacemacs/user-env "Calling dotfile user env..."))
|
|
|
|
|
|
|
|
(defun dotspacemacs/go-to-function (func)
|
|
|
|
"Open the dotfile and goes to FUNC function."
|
|
|
|
(interactive)
|
|
|
|
(find-function func))
|
|
|
|
|
|
|
|
(defun dotspacemacs/go-to-user-env ()
|
|
|
|
"Go to the `dotspacemacs/user-env' function."
|
|
|
|
(interactive)
|
|
|
|
(dotspacemacs/go-to-function 'dotspacemacs/user-env))
|
|
|
|
|
2016-10-10 13:11:55 +00:00
|
|
|
(defun dotspacemacs//check-layers-changed ()
|
|
|
|
"Check if the value of `dotspacemacs-configuration-layers'
|
2020-08-10 22:16:09 +00:00
|
|
|
changed, and issue a warning if it did."
|
2016-10-10 13:11:55 +00:00
|
|
|
(unless (eq dotspacemacs-configuration-layers
|
|
|
|
dotspacemacs--configuration-layers-saved)
|
2019-08-06 10:28:01 +00:00
|
|
|
(spacemacs-buffer/warning (concat
|
|
|
|
"`dotspacemacs-configuration-layers' was "
|
|
|
|
"changed outside of `dotspacemacs/layers'."))))
|
2016-10-10 13:11:55 +00:00
|
|
|
(add-hook 'spacemacs-post-user-config-hook
|
|
|
|
'dotspacemacs//check-layers-changed)
|
|
|
|
|
2016-03-17 02:43:50 +00:00
|
|
|
(defun dotspacemacs//read-editing-style-config (config)
|
|
|
|
"Read editing style CONFIG: apply variables and return the editing style.
|
2020-08-10 22:16:09 +00:00
|
|
|
CONFIG can be the symbol of an editing style or a list where the car is
|
|
|
|
the symbol of an editing style and the cdr is a list of keyword arguments like
|
2020-08-10 21:27:24 +00:00
|
|
|
`:variables'."
|
2016-03-17 02:43:50 +00:00
|
|
|
(cond
|
|
|
|
((symbolp config) config)
|
|
|
|
((listp config)
|
2018-06-07 10:13:06 +00:00
|
|
|
(let ((variables (spacemacs/mplist-get-values config :variables)))
|
2016-03-17 02:43:50 +00:00
|
|
|
(while variables
|
|
|
|
(let ((var (pop variables)))
|
|
|
|
(if (consp variables)
|
|
|
|
(condition-case-unless-debug err
|
|
|
|
(set-default var (eval (pop variables)))
|
|
|
|
('error
|
|
|
|
(spacemacs-buffer/append
|
|
|
|
(format (concat "\nAn error occurred while reading the "
|
|
|
|
"editing style variable %s "
|
|
|
|
"(error: %s). Be sure to quote the value "
|
2019-08-06 10:28:01 +00:00
|
|
|
"if needed.\n")
|
|
|
|
var err))))
|
|
|
|
(spacemacs-buffer/warning "Missing value for variable %s !" var)))))
|
2016-03-17 02:43:50 +00:00
|
|
|
(car config))))
|
|
|
|
|
2016-03-25 04:24:52 +00:00
|
|
|
(defun dotspacemacs/add-layer (layer-name)
|
|
|
|
"Add LAYER_NAME to dotfile and reload the it.
|
2020-08-10 22:16:09 +00:00
|
|
|
Returns non nil if the layer has been effectively inserted."
|
2017-07-02 13:48:06 +00:00
|
|
|
(unless (configuration-layer/layer-used-p layer-name)
|
2016-03-25 04:24:52 +00:00
|
|
|
(with-current-buffer (find-file-noselect (dotspacemacs/location))
|
2020-10-05 00:07:12 +00:00
|
|
|
(goto-char (point-min))
|
2019-08-06 10:28:01 +00:00
|
|
|
(let ((insert-point
|
|
|
|
(re-search-forward
|
|
|
|
"[^`]dotspacemacs-configuration-layers\\s-*\n?[^(]*\\((\\)")))
|
2016-11-01 08:57:22 +00:00
|
|
|
(insert (format "%S" layer-name))
|
|
|
|
(unless (equal (point) (point-at-eol))
|
|
|
|
(insert "\n"))
|
|
|
|
(indent-region insert-point (min (point-max)
|
|
|
|
(+ insert-point 2
|
|
|
|
(length (symbol-name layer-name)))))
|
2016-03-25 04:24:52 +00:00
|
|
|
(save-buffer)))
|
|
|
|
(load-file (dotspacemacs/location))
|
|
|
|
t))
|
|
|
|
|
2018-06-16 19:21:58 +00:00
|
|
|
(defun dotspacemacs//profile-user-config (f &rest args)
|
2019-08-06 10:28:01 +00:00
|
|
|
"Compute time taken by the `dotspacemacs/user-config' function."
|
2018-06-16 19:21:58 +00:00
|
|
|
(let ((stime (current-time)))
|
|
|
|
(apply f args)
|
|
|
|
(setq dotspacemacs--user-config-elapsed-time
|
|
|
|
(float-time (time-subtract (current-time) stime)))))
|
|
|
|
|
2015-03-31 03:16:33 +00:00
|
|
|
(defun dotspacemacs/sync-configuration-layers (&optional arg)
|
2015-03-02 05:27:36 +00:00
|
|
|
"Synchronize declared layers in dotfile with spacemacs.
|
|
|
|
|
2020-08-10 22:16:09 +00:00
|
|
|
Called with `C-u' skips `dotspacemacs/user-config'.
|
|
|
|
Called with `C-u C-u' skips `dotspacemacs/user-config' _and_ preliminary tests."
|
2015-03-02 05:27:36 +00:00
|
|
|
(interactive "P")
|
2015-03-31 03:16:33 +00:00
|
|
|
(when (file-exists-p dotspacemacs-filepath)
|
2015-09-01 03:26:47 +00:00
|
|
|
(with-current-buffer (find-file-noselect dotspacemacs-filepath)
|
|
|
|
(let ((dotspacemacs-loading-progress-bar nil))
|
|
|
|
(setq spacemacs-loading-string "")
|
|
|
|
(save-buffer)
|
2015-09-12 03:04:55 +00:00
|
|
|
(let ((tests-ok (or (equal arg '(16)) (dotspacemacs/test-dotfile t))))
|
2015-09-01 03:26:47 +00:00
|
|
|
(if tests-ok
|
|
|
|
(progn
|
|
|
|
(load-file buffer-file-name)
|
|
|
|
(dotspacemacs|call-func dotspacemacs/init
|
|
|
|
"Calling dotfile init...")
|
2016-03-17 02:43:50 +00:00
|
|
|
(dotspacemacs|call-func dotspacemacs/user-init
|
|
|
|
"Calling dotfile user init...")
|
|
|
|
(setq dotspacemacs-editing-style
|
|
|
|
(dotspacemacs//read-editing-style-config
|
|
|
|
dotspacemacs-editing-style))
|
2018-07-03 05:20:06 +00:00
|
|
|
(dotspacemacs/call-user-env)
|
2018-05-08 05:36:08 +00:00
|
|
|
;; try to force a redump when reloading the configuration
|
|
|
|
(let ((spacemacs-force-dump t))
|
|
|
|
(configuration-layer/load))
|
2015-11-01 11:03:18 +00:00
|
|
|
(if (member arg '((4) (16)))
|
2016-01-18 03:06:04 +00:00
|
|
|
(message (concat "Done (`dotspacemacs/user-config' "
|
|
|
|
"function has been skipped)."))
|
|
|
|
(dotspacemacs|call-func dotspacemacs/user-config
|
|
|
|
"Calling dotfile user config...")
|
2016-05-12 00:07:26 +00:00
|
|
|
(run-hooks 'spacemacs-post-user-config-hook)
|
2016-04-03 04:38:13 +00:00
|
|
|
(message "Done.")))
|
2015-09-01 03:26:47 +00:00
|
|
|
(switch-to-buffer-other-window dotspacemacs-test-results-buffer)
|
|
|
|
(spacemacs-buffer/warning "Some tests failed, check `%s' buffer"
|
2015-10-08 07:44:59 +00:00
|
|
|
dotspacemacs-test-results-buffer))))))
|
2017-07-02 13:48:06 +00:00
|
|
|
(when (configuration-layer/package-used-p 'spaceline)
|
2018-06-14 05:10:44 +00:00
|
|
|
(spacemacs//restore-buffers-powerline)))
|
2015-03-02 04:02:14 +00:00
|
|
|
|
2015-09-01 03:16:14 +00:00
|
|
|
(defun dotspacemacs/get-variable-string-list ()
|
|
|
|
"Return a list of all the dotspacemacs variables as strings."
|
|
|
|
(all-completions "" obarray
|
|
|
|
(lambda (x)
|
|
|
|
(and (boundp x)
|
|
|
|
(not (keywordp x))
|
2017-02-06 01:28:10 +00:00
|
|
|
;; avoid private variables to show up
|
|
|
|
(not (string-match-p "--" (symbol-name x)))
|
|
|
|
(string-prefix-p "dotspacemacs" (symbol-name x))))))
|
2015-09-01 03:16:14 +00:00
|
|
|
|
|
|
|
(defun dotspacemacs/get-variable-list ()
|
|
|
|
"Return a list of all dotspacemacs variable symbols."
|
|
|
|
(mapcar 'intern (dotspacemacs/get-variable-string-list)))
|
|
|
|
|
2015-08-14 16:25:54 +00:00
|
|
|
(defmacro dotspacemacs|symbol-value (symbol)
|
|
|
|
"Return the value of SYMBOL corresponding to a dotspacemacs variable.
|
2020-08-10 22:16:09 +00:00
|
|
|
If SYMBOL value is `display-graphic-p' then return the result of
|
|
|
|
`(display-graphic-p)', otherwise return the value of the symbol."
|
2015-08-14 16:25:54 +00:00
|
|
|
`(if (eq 'display-graphic-p ,symbol) (display-graphic-p) ,symbol))
|
|
|
|
|
2014-11-22 02:19:50 +00:00
|
|
|
(defun dotspacemacs/location ()
|
|
|
|
"Return the absolute path to the spacemacs dotfile."
|
2015-04-30 08:03:06 +00:00
|
|
|
dotspacemacs-filepath)
|
2014-11-22 02:19:50 +00:00
|
|
|
|
2015-03-31 02:18:32 +00:00
|
|
|
(defun dotspacemacs/copy-template ()
|
|
|
|
"Copy `.spacemacs.template' in home directory. Ask for confirmation
|
2020-08-10 22:16:09 +00:00
|
|
|
before copying the file if the destination already exists."
|
2014-11-22 03:33:54 +00:00
|
|
|
(interactive)
|
2015-03-31 02:18:32 +00:00
|
|
|
(let* ((copy? (if (file-exists-p dotspacemacs-filepath)
|
|
|
|
(y-or-n-p
|
2016-09-24 13:59:43 +00:00
|
|
|
(format "%s already exists. Do you want to overwrite it ? "
|
2015-03-31 02:18:32 +00:00
|
|
|
dotspacemacs-filepath)) t)))
|
|
|
|
(when copy?
|
|
|
|
(copy-file (concat dotspacemacs-template-directory
|
2019-08-06 10:28:01 +00:00
|
|
|
".spacemacs.template")
|
|
|
|
dotspacemacs-filepath t)
|
2015-03-31 02:18:32 +00:00
|
|
|
(message "%s has been installed." dotspacemacs-filepath))))
|
|
|
|
|
|
|
|
(defun dotspacemacs//ido-completing-read (prompt candidates)
|
|
|
|
"Call `ido-completing-read' with a CANDIDATES alist where the key is
|
2020-08-10 22:16:09 +00:00
|
|
|
a display strng and the value is the actual value to return."
|
2015-03-31 03:16:33 +00:00
|
|
|
(let ((ido-max-window-height (1+ (length candidates))))
|
|
|
|
(cadr (assoc (ido-completing-read prompt (mapcar 'car candidates))
|
|
|
|
candidates))))
|
2015-03-31 02:18:32 +00:00
|
|
|
|
2016-12-18 17:05:10 +00:00
|
|
|
(defun dotspacemacs/maybe-install-dotfile ()
|
|
|
|
"Install the dotfile if it does not exist."
|
|
|
|
(unless (file-exists-p dotspacemacs-filepath)
|
2017-10-30 01:43:43 +00:00
|
|
|
(spacemacs-buffer/set-mode-line "Dotfile wizard installer" t)
|
2016-12-18 17:05:10 +00:00
|
|
|
(when (dotspacemacs/install 'with-wizard)
|
2017-07-01 14:54:37 +00:00
|
|
|
(configuration-layer/load))))
|
2016-12-18 17:05:10 +00:00
|
|
|
|
2015-03-31 02:18:32 +00:00
|
|
|
(defun dotspacemacs/install (arg)
|
2015-03-31 03:16:33 +00:00
|
|
|
"Install the dotfile, return non nil if the doftile has been installed.
|
2015-03-31 02:18:32 +00:00
|
|
|
|
2020-08-10 22:16:09 +00:00
|
|
|
If ARG is non nil then ask questions to the user before installing the dotfile."
|
2015-03-31 02:18:32 +00:00
|
|
|
(interactive "P")
|
|
|
|
;; preferences is an alist where the key is the text to replace by
|
|
|
|
;; the value in the dotfile
|
|
|
|
(let ((preferences
|
|
|
|
(when arg
|
|
|
|
;; editing style
|
|
|
|
`(("dotspacemacs-editing-style 'vim"
|
2015-09-01 02:08:10 +00:00
|
|
|
,(format
|
|
|
|
"dotspacemacs-editing-style '%S"
|
|
|
|
(dotspacemacs//ido-completing-read
|
2016-01-09 19:19:01 +00:00
|
|
|
"What is your preferred editing style? "
|
2015-09-01 02:08:10 +00:00
|
|
|
'(("Among the stars aboard the Evil flagship (vim)"
|
|
|
|
vim)
|
|
|
|
("On the planet Emacs in the Holy control tower (emacs)"
|
2015-09-11 14:28:30 +00:00
|
|
|
emacs)))))
|
2015-09-19 05:05:17 +00:00
|
|
|
("dotspacemacs-distribution 'spacemacs"
|
2015-09-11 14:28:30 +00:00
|
|
|
,(format
|
|
|
|
"dotspacemacs-distribution '%S"
|
|
|
|
(dotspacemacs//ido-completing-read
|
|
|
|
"What distribution of spacemacs would you like to start with? "
|
2016-01-09 19:19:01 +00:00
|
|
|
`(("The standard distribution, recommended (spacemacs)"
|
2015-09-11 14:28:30 +00:00
|
|
|
spacemacs)
|
2016-01-09 19:19:01 +00:00
|
|
|
(,(concat "A minimalist distribution that you can build on "
|
|
|
|
"(spacemacs-base)")
|
2017-10-08 11:55:14 +00:00
|
|
|
spacemacs-base)))))))))
|
2015-03-31 02:18:32 +00:00
|
|
|
(with-current-buffer (find-file-noselect
|
2016-01-09 19:19:01 +00:00
|
|
|
(concat dotspacemacs-template-directory
|
|
|
|
".spacemacs.template"))
|
2015-03-31 02:18:32 +00:00
|
|
|
(dolist (p preferences)
|
2015-12-16 14:45:08 +00:00
|
|
|
(goto-char (point-min))
|
2015-03-31 02:18:32 +00:00
|
|
|
(re-search-forward (car p))
|
|
|
|
(replace-match (cadr p)))
|
|
|
|
(let ((install
|
|
|
|
(if (file-exists-p dotspacemacs-filepath)
|
|
|
|
(y-or-n-p
|
2016-09-24 13:59:43 +00:00
|
|
|
(format "%s already exists. Do you want to overwrite it ? "
|
2015-03-31 02:18:32 +00:00
|
|
|
dotspacemacs-filepath)) t)))
|
2015-03-31 03:16:33 +00:00
|
|
|
(when install
|
|
|
|
(write-file dotspacemacs-filepath)
|
|
|
|
(message "%s has been installed." dotspacemacs-filepath)
|
2016-05-14 16:09:25 +00:00
|
|
|
t))))
|
2016-11-07 15:37:38 +00:00
|
|
|
(dotspacemacs/load-file)
|
|
|
|
;; force new wizard values to be applied
|
|
|
|
(dotspacemacs/init))
|
2015-03-31 02:18:32 +00:00
|
|
|
|
2015-03-01 04:33:57 +00:00
|
|
|
(defun dotspacemacs/load-file ()
|
2015-02-18 00:04:16 +00:00
|
|
|
"Load ~/.spacemacs if it exists."
|
2014-11-22 02:19:50 +00:00
|
|
|
(let ((dotspacemacs (dotspacemacs/location)))
|
2015-08-26 05:58:01 +00:00
|
|
|
(if (file-exists-p dotspacemacs)
|
2016-11-07 15:37:38 +00:00
|
|
|
(unless (with-demoted-errors "Error loading .spacemacs: %S"
|
|
|
|
(load dotspacemacs))
|
2018-06-16 19:21:58 +00:00
|
|
|
(dotspacemacs/safe-load))))
|
2021-02-11 17:41:39 +00:00
|
|
|
(advice-add 'dotspacemacs/layers :after
|
|
|
|
'spacemacs-customization//validate-dotspacemacs-layers-vars)
|
|
|
|
(advice-add 'dotspacemacs/init :after
|
|
|
|
'spacemacs-customization//validate-dotspacemacs-init-vars)
|
|
|
|
(advice-add 'dotspacemacs/user-config :around
|
|
|
|
'dotspacemacs//profile-user-config))
|
2015-08-26 05:58:01 +00:00
|
|
|
|
2017-04-28 22:44:27 +00:00
|
|
|
(defun spacemacs/title-prepare (title-format)
|
2015-07-10 13:57:18 +00:00
|
|
|
"A string is printed verbatim except for %-constructs.
|
|
|
|
%a -- prints the `abbreviated-file-name', or `buffer-name'
|
|
|
|
%t -- prints `projectile-project-name'
|
|
|
|
%I -- prints `invocation-name'
|
|
|
|
%S -- prints `system-name'
|
|
|
|
%U -- prints contents of $USER
|
|
|
|
%b -- prints buffer name
|
|
|
|
%f -- prints visited file name
|
|
|
|
%F -- prints frame name
|
|
|
|
%s -- prints process status
|
|
|
|
%p -- prints percent of buffer above top of window, or Top, Bot or All
|
|
|
|
%P -- prints percent of buffer above bottom of window, perhaps plus Top, or
|
|
|
|
print Bottom or All
|
|
|
|
%m -- prints mode name
|
|
|
|
%n -- prints Narrow if appropriate
|
|
|
|
%z -- prints mnemonics of buffer, terminal, and keyboard coding systems
|
|
|
|
%Z -- like %z, but including the end-of-line format"
|
2019-06-01 10:25:05 +00:00
|
|
|
;; save-match-data to work around Emacs bug, see
|
|
|
|
;; https://github.com/syl20bnr/spacemacs/issues/9700
|
2018-10-28 19:25:08 +00:00
|
|
|
(save-match-data
|
2019-08-06 10:28:01 +00:00
|
|
|
;; disable buffer-list-update-hook to work around recursive invocations
|
|
|
|
;; caused by the temp-buffer used by `format-spec' below, see
|
2019-06-01 10:25:05 +00:00
|
|
|
;; https://github.com/syl20bnr/spacemacs/issues/12387
|
|
|
|
(let* ((buffer-list-update-hook nil)
|
2019-08-06 10:28:01 +00:00
|
|
|
(project-name
|
|
|
|
(when (string-match-p "%t" title-format)
|
|
|
|
(if (boundp 'spacemacs--buffer-project-name)
|
|
|
|
spacemacs--buffer-project-name
|
2021-03-18 03:13:27 +00:00
|
|
|
(setq-local spacemacs--buffer-project-name
|
|
|
|
(if (fboundp 'projectile-project-name)
|
|
|
|
(projectile-project-name)
|
|
|
|
"-")))))
|
2019-08-06 10:28:01 +00:00
|
|
|
(abbreviated-file-name
|
|
|
|
(when (string-match-p "%a" title-format)
|
|
|
|
(if (boundp 'spacemacs--buffer-abbreviated-filename)
|
|
|
|
spacemacs--buffer-abbreviated-filename
|
2021-03-18 03:13:27 +00:00
|
|
|
(setq-local spacemacs--buffer-abbreviated-filename
|
|
|
|
(abbreviate-file-name (or (buffer-file-name)
|
|
|
|
(buffer-name)))))))
|
2018-10-28 19:25:08 +00:00
|
|
|
(fs (format-spec-make
|
|
|
|
?a abbreviated-file-name
|
|
|
|
?t project-name
|
2020-10-05 00:07:12 +00:00
|
|
|
?S (system-name)
|
2018-10-28 19:25:08 +00:00
|
|
|
?I invocation-name
|
|
|
|
?U (or (getenv "USER") "")
|
|
|
|
?b "%b"
|
|
|
|
?f "%f"
|
|
|
|
?F "%F"
|
|
|
|
?* "%*"
|
|
|
|
?+ "%+"
|
|
|
|
?s "%s"
|
|
|
|
?l "%l"
|
|
|
|
?c "%c"
|
|
|
|
?p "%p"
|
|
|
|
?P "%P"
|
|
|
|
?m "%m"
|
|
|
|
?n "%n"
|
|
|
|
?z "%z"
|
|
|
|
?Z "%Z"
|
|
|
|
?\[ "%["
|
|
|
|
?\] "%]"
|
|
|
|
?% "%%"
|
2021-03-15 20:51:18 +00:00
|
|
|
?- "%-")))
|
|
|
|
|
2018-10-28 19:25:08 +00:00
|
|
|
(format-spec title-format fs))))
|
2015-07-10 13:57:18 +00:00
|
|
|
|
2015-08-26 05:58:01 +00:00
|
|
|
(defun dotspacemacs/safe-load ()
|
|
|
|
"Error recovery from malformed .spacemacs.
|
2020-08-10 22:16:09 +00:00
|
|
|
Loads default .spacemacs template and suspends pruning of orphan packages.
|
|
|
|
Informs users of error and prompts for default editing style for use during
|
|
|
|
error recovery."
|
2015-08-26 05:58:01 +00:00
|
|
|
(load (concat dotspacemacs-template-directory
|
|
|
|
".spacemacs.template"))
|
|
|
|
(defadvice dotspacemacs/layers
|
|
|
|
(after error-recover-preserve-packages activate)
|
|
|
|
(progn
|
2016-08-20 00:31:57 +00:00
|
|
|
(setq-default dotspacemacs-install-packages 'used-but-keep-unused)
|
2015-08-26 05:58:01 +00:00
|
|
|
(ad-disable-advice 'dotspacemacs/layers 'after
|
|
|
|
'error-recover-preserve-packages)
|
|
|
|
(ad-activate 'dotspacemacs/layers)))
|
|
|
|
(defadvice dotspacemacs/init
|
|
|
|
(after error-recover-prompt-for-style activate)
|
|
|
|
(progn
|
|
|
|
(setq-default dotspacemacs-editing-style
|
|
|
|
(intern
|
|
|
|
(ido-completing-read
|
2015-09-17 01:37:42 +00:00
|
|
|
(format
|
|
|
|
(concat
|
|
|
|
"Spacemacs encountered an error while "
|
|
|
|
"loading your `%s' file.\n"
|
|
|
|
"Pick your editing style for recovery "
|
|
|
|
"(use left and right arrows): ")
|
|
|
|
dotspacemacs-filepath)
|
2015-08-26 05:58:01 +00:00
|
|
|
'(("vim" vim)
|
|
|
|
("emacs" emacs)
|
|
|
|
("hybrid" hybrid))
|
2015-09-17 01:37:42 +00:00
|
|
|
nil t nil nil 'vim)))
|
2015-08-26 05:58:01 +00:00
|
|
|
(ad-disable-advice 'dotspacemacs/init 'after
|
|
|
|
'error-recover-prompt-for-style)
|
|
|
|
(ad-activate 'dotspacemacs/init))))
|
2014-11-22 02:19:50 +00:00
|
|
|
|
2015-06-26 16:27:40 +00:00
|
|
|
(defun dotspacemacs//test-dotspacemacs/layers ()
|
|
|
|
"Tests for `dotspacemacs/layers'"
|
2015-06-30 02:53:51 +00:00
|
|
|
(insert
|
2015-09-01 02:08:10 +00:00
|
|
|
(format (concat "\n* Testing settings in dotspacemacs/layers "
|
|
|
|
"[[file:%s::dotspacemacs/layers][Show in File]]\n")
|
2015-06-30 02:53:51 +00:00
|
|
|
dotspacemacs-filepath))
|
2015-06-26 16:27:40 +00:00
|
|
|
;; protect global values of these variables
|
2019-08-06 10:28:01 +00:00
|
|
|
(let (dotspacemacs-additional-packages
|
|
|
|
dotspacemacs-configuration-layer-path
|
|
|
|
dotspacemacs-configuration-layers
|
|
|
|
dotspacemacs-excluded-packages
|
2016-08-20 00:31:57 +00:00
|
|
|
dotspacemacs-install-packages
|
2019-08-06 10:28:01 +00:00
|
|
|
(passed-tests 0)
|
|
|
|
(total-tests 0))
|
2015-06-26 16:27:40 +00:00
|
|
|
(load dotspacemacs-filepath)
|
|
|
|
(dotspacemacs/layers)
|
2019-08-06 10:28:01 +00:00
|
|
|
(spacemacs//test-list 'stringp
|
|
|
|
'dotspacemacs-configuration-layer-path
|
|
|
|
"is a string" "path")
|
|
|
|
(spacemacs//test-list 'file-directory-p
|
|
|
|
'dotspacemacs-configuration-layer-path
|
|
|
|
"exists in filesystem" "path")
|
2015-06-26 16:27:40 +00:00
|
|
|
(setq dotspacemacs-configuration-layers
|
2015-09-01 02:08:10 +00:00
|
|
|
(mapcar (lambda (l) (if (listp l) (car l) l))
|
2020-06-28 01:48:59 +00:00
|
|
|
(remove nil dotspacemacs-configuration-layers)))
|
2019-08-06 10:28:01 +00:00
|
|
|
(spacemacs//test-list 'configuration-layer/get-layer-path
|
|
|
|
'dotspacemacs-configuration-layers
|
|
|
|
"can be found" "layer")
|
2015-06-30 02:53:51 +00:00
|
|
|
(insert (format
|
2015-09-01 02:08:10 +00:00
|
|
|
(concat "** RESULTS: "
|
|
|
|
"[[file:%s::dotspacemacs/layers][dotspacemacs/layers]] "
|
|
|
|
"passed %s out of %s tests\n")
|
2015-09-01 01:52:47 +00:00
|
|
|
dotspacemacs-filepath passed-tests total-tests))
|
|
|
|
(equal passed-tests total-tests)))
|
2015-06-26 16:27:40 +00:00
|
|
|
|
2015-09-01 03:16:14 +00:00
|
|
|
(defmacro dotspacemacs||let-init-test (&rest body)
|
|
|
|
"Macro to protect dotspacemacs variables"
|
|
|
|
`(let ((fpath dotspacemacs-filepath)
|
2021-03-19 11:06:07 +00:00
|
|
|
,@(mapcar (lambda (symbol)
|
|
|
|
`(,symbol ,(let ((v (symbol-value symbol)))
|
|
|
|
(if (or (symbolp v) (listp v))
|
|
|
|
`',v v))))
|
|
|
|
(dotspacemacs/get-variable-list))
|
2015-09-01 03:16:14 +00:00
|
|
|
(passed-tests 0) (total-tests 0))
|
|
|
|
(setq dotspacemacs-filepath fpath)
|
|
|
|
(load dotspacemacs-filepath)
|
|
|
|
,@body))
|
|
|
|
|
2015-06-26 16:27:40 +00:00
|
|
|
(defun dotspacemacs//test-dotspacemacs/init ()
|
|
|
|
"Tests for `dotspacemacs/init'"
|
2015-06-30 02:53:51 +00:00
|
|
|
(insert
|
2015-09-01 02:08:10 +00:00
|
|
|
(format (concat "\n* Testing settings in dotspacemacs/init "
|
|
|
|
"[[file:%s::dotspacemacs/init][Show in File]]\n")
|
2015-06-30 02:53:51 +00:00
|
|
|
dotspacemacs-filepath))
|
2015-09-01 03:16:14 +00:00
|
|
|
(dotspacemacs||let-init-test
|
|
|
|
(dotspacemacs/init)
|
|
|
|
(spacemacs//test-var
|
2018-01-12 04:53:44 +00:00
|
|
|
(lambda (x)
|
|
|
|
(or (member x '(vim
|
|
|
|
emacs
|
|
|
|
hybrid))
|
|
|
|
(and (listp x)
|
2018-06-08 16:04:36 +00:00
|
|
|
(member (car x) '(vim emacs hybrid))
|
2018-06-07 10:13:06 +00:00
|
|
|
(spacemacs/mplist-get-values x :variables))))
|
2016-03-17 02:43:50 +00:00
|
|
|
'dotspacemacs-editing-style
|
2018-06-08 16:04:36 +00:00
|
|
|
"is \'vim, \'emacs or \'hybrid or and list with `:variables' keyword")
|
2018-01-12 04:53:44 +00:00
|
|
|
(spacemacs//test-var
|
|
|
|
(lambda (x)
|
2018-01-17 16:28:52 +00:00
|
|
|
(let ((themes '(spacemacs
|
|
|
|
all-the-icons
|
|
|
|
custom
|
2018-09-06 12:44:09 +00:00
|
|
|
doom
|
2018-01-17 16:28:52 +00:00
|
|
|
vim-powerline
|
|
|
|
vanilla)))
|
|
|
|
(or (member x themes)
|
|
|
|
(and (listp x)
|
|
|
|
(memq (car x) themes)
|
|
|
|
;; TODO define a function to remove several properties at once
|
2019-08-06 10:28:01 +00:00
|
|
|
(null (spacemacs/mplist-remove
|
|
|
|
(spacemacs/mplist-remove (cdr x) :separator)
|
|
|
|
:separator-scale))))))
|
2018-01-12 04:53:44 +00:00
|
|
|
'dotspacemacs-mode-line-theme
|
2018-01-17 16:28:52 +00:00
|
|
|
(concat
|
|
|
|
"is \'spacemacs, \'all-the-icons, \'custom, \'vim-powerline or 'vanilla "
|
|
|
|
"or a list with `car' one of the previous values and properties one of "
|
|
|
|
"the following: `:separator' or `:separator-scale'"))
|
2015-09-01 03:16:14 +00:00
|
|
|
(spacemacs//test-var
|
|
|
|
(lambda (x) (member x '(original cache nil)))
|
|
|
|
'dotspacemacs-auto-save-file-location (concat "is one of \'original, "
|
|
|
|
"\'cache or nil"))
|
|
|
|
(spacemacs//test-var
|
2015-09-12 22:16:36 +00:00
|
|
|
(lambda (x) (member x '(all any current nil)))
|
2019-08-06 10:28:01 +00:00
|
|
|
'dotspacemacs-highlight-delimiters
|
|
|
|
"is one of \'all, \'any, \'current or nil")
|
2015-09-01 03:16:14 +00:00
|
|
|
(spacemacs//test-list
|
2016-06-26 06:38:57 +00:00
|
|
|
(lambda (x)
|
|
|
|
(let ((el (or (car-safe x) x))
|
|
|
|
(list-size (cdr-safe x)))
|
2021-01-04 18:33:49 +00:00
|
|
|
(member el '(recents recents-by-project bookmarks projects todos agenda))))
|
|
|
|
'dotspacemacs-startup-lists (concat "includes \'recents, 'recents-by-project, "
|
2019-08-06 10:28:01 +00:00
|
|
|
"\'bookmarks, \'todos, "
|
|
|
|
"\'agenda or \'projects"))
|
2016-06-26 06:38:57 +00:00
|
|
|
(spacemacs//test-list
|
|
|
|
(lambda (x)
|
|
|
|
(let ((el (or (car-safe x) x))
|
|
|
|
(list-size (cdr-safe x)))
|
2021-01-04 18:33:49 +00:00
|
|
|
(if (eq el 'recents-by-project)
|
|
|
|
(and (consp list-size)
|
|
|
|
(numberp (car list-size))
|
|
|
|
(numberp (cdr list-size)))
|
|
|
|
(or (null list-size) (numberp list-size)))))
|
|
|
|
'dotspacemacs-startup-lists (concat "list size is a number, unless "
|
|
|
|
"list type is recents-by-project "
|
|
|
|
"when it is a pair of numbers"))
|
2015-09-01 03:16:14 +00:00
|
|
|
(spacemacs//test-var 'stringp 'dotspacemacs-leader-key "is a string")
|
|
|
|
(spacemacs//test-var 'stringp 'dotspacemacs-emacs-leader-key "is a string")
|
|
|
|
(spacemacs//test-var
|
2015-10-02 19:29:13 +00:00
|
|
|
(lambda (x) (or (null x) (stringp x)))
|
|
|
|
'dotspacemacs-major-mode-leader-key "is a string or nil")
|
|
|
|
(spacemacs//test-var
|
|
|
|
(lambda (x) (or (null x) (stringp x)))
|
|
|
|
'dotspacemacs-major-mode-emacs-leader-key "is a string or nil")
|
2016-01-09 06:53:24 +00:00
|
|
|
(spacemacs//test-var 'stringp 'dotspacemacs-emacs-command-key "is a string")
|
2015-09-01 03:16:14 +00:00
|
|
|
(insert (format
|
|
|
|
(concat "** RESULTS: "
|
|
|
|
"[[file:%s::dotspacemacs/init][dotspacemacs/init]] "
|
|
|
|
"passed %s out of %s tests\n")
|
|
|
|
dotspacemacs-filepath passed-tests total-tests))
|
|
|
|
(equal passed-tests total-tests)))
|
2015-06-26 16:27:40 +00:00
|
|
|
|
2015-09-01 01:52:47 +00:00
|
|
|
(defun dotspacemacs/test-dotfile (&optional hide-buffer)
|
|
|
|
"Test settings in dotfile for correctness.
|
2020-08-10 22:16:09 +00:00
|
|
|
Return non-nil if all the tests passed."
|
2015-06-26 16:27:40 +00:00
|
|
|
(interactive)
|
core: implement :depends for package declarations
This replaces the older pattern
:toggle (configuration-layer/package-usedp ..)
This implementation ensures that :disabled-for honors dependent packages, i.e.
if package a depends on package b, which is owned by layer c, and layer c is
disabled for layer d, then neither package a nor b will be configured for layer
d. Previously, this was only true for package a, but not b.
This commit also fixes:
- configuration-layer/describe-package now shows which post-init and pre-init
functions are disabled, if any
- Does not recreate all layer objects unconditionally when calling
configuration-layer/discover-layers. Previously, this led to all layers being
recreated after e.g. `SPC h SPC`, without any of the dotfile information.
Since this information is now necessary for
configuration-layer/describe-package, it’s important that we don’t clear the
indexed layers when invoking this function.
2017-06-21 10:27:59 +00:00
|
|
|
(configuration-layer/discover-layers 'refresh-index)
|
2015-06-26 16:27:40 +00:00
|
|
|
(let ((min-version "0.0"))
|
|
|
|
;; dotspacemacs-version not implemented yet
|
|
|
|
;; (if (version< dotspacemacs-version min-version)
|
|
|
|
(if nil
|
2015-09-01 02:08:10 +00:00
|
|
|
(error (format (concat "error: dotspacemacs/test-dotfile requires "
|
2019-08-06 10:28:01 +00:00
|
|
|
"dotspacemacs-version %s")
|
|
|
|
min-version))
|
2015-09-01 01:52:47 +00:00
|
|
|
(with-current-buffer (get-buffer-create dotspacemacs-test-results-buffer)
|
|
|
|
(unless hide-buffer
|
|
|
|
(switch-to-buffer-other-window dotspacemacs-test-results-buffer))
|
2015-06-30 02:53:51 +00:00
|
|
|
(org-mode)
|
2015-09-01 02:13:56 +00:00
|
|
|
(org-indent-mode)
|
|
|
|
(view-mode)
|
|
|
|
(when (bound-and-true-p flyspell-mode)
|
|
|
|
(flyspell-mode -1))
|
|
|
|
(let (buffer-read-only)
|
|
|
|
(erase-buffer)
|
|
|
|
(insert (format "* Running tests on [[file:%s][%s]] (v%s)\n"
|
|
|
|
dotspacemacs-filepath dotspacemacs-filepath "0.0"))
|
|
|
|
;; dotspacemacs-version not implemented yet
|
2019-08-06 10:28:01 +00:00
|
|
|
;; (insert (format "* Running tests on %s (v%s)\n"
|
|
|
|
;; dotspacemacs-filepath dotspacemacs-version))
|
2015-09-01 02:13:56 +00:00
|
|
|
(prog1
|
2015-09-01 03:27:18 +00:00
|
|
|
;; execute all tests no matter what
|
2015-12-16 14:45:08 +00:00
|
|
|
(cl-reduce (lambda (x y)
|
core: implement :depends for package declarations
This replaces the older pattern
:toggle (configuration-layer/package-usedp ..)
This implementation ensures that :disabled-for honors dependent packages, i.e.
if package a depends on package b, which is owned by layer c, and layer c is
disabled for layer d, then neither package a nor b will be configured for layer
d. Previously, this was only true for package a, but not b.
This commit also fixes:
- configuration-layer/describe-package now shows which post-init and pre-init
functions are disabled, if any
- Does not recreate all layer objects unconditionally when calling
configuration-layer/discover-layers. Previously, this led to all layers being
recreated after e.g. `SPC h SPC`, without any of the dotfile information.
Since this information is now necessary for
configuration-layer/describe-package, it’s important that we don’t clear the
indexed layers when invoking this function.
2017-06-21 10:27:59 +00:00
|
|
|
(and (funcall y) x))
|
|
|
|
'(dotspacemacs//test-dotspacemacs/layers
|
|
|
|
dotspacemacs//test-dotspacemacs/init)
|
|
|
|
:initial-value t)
|
2015-09-01 02:13:56 +00:00
|
|
|
(goto-char (point-min))))))))
|
2015-06-26 16:27:40 +00:00
|
|
|
|
2015-01-27 03:51:47 +00:00
|
|
|
(provide 'core-dotspacemacs)
|