2015-01-27 03:51:47 +00:00
|
|
|
;;; core-dotspacemacs.el --- Spacemacs Core File
|
2015-01-14 04:12:56 +00:00
|
|
|
;;
|
2018-01-04 07:00:25 +00:00
|
|
|
;; Copyright (c) 2012-2018 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.
|
|
|
|
;;
|
|
|
|
;;; License: GPLv3
|
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.")
|
|
|
|
|
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
|
|
|
|
((and env (file-exists-p env-dir))
|
|
|
|
env-dir)
|
|
|
|
((file-exists-p no-env-dir-default)
|
|
|
|
no-env-dir-default)
|
|
|
|
(t
|
2016-07-25 11:36:25 +00:00
|
|
|
nil))
|
|
|
|
"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
|
2015-05-29 17:08:48 +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)
|
|
|
|
((and dotspacemacs-directory (file-exists-p spacemacs-dir-init)) spacemacs-dir-init)
|
|
|
|
(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
|
|
|
|
2015-09-12 11:35:41 +00:00
|
|
|
(defvar 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'
|
2015-09-08 01:16:15 +00:00
|
|
|
or `spacemacs'.")
|
|
|
|
|
2018-05-06 04:02:44 +00:00
|
|
|
(defvar dotspacemacs-emacs-pdumper-executable-file nil
|
|
|
|
"Absolute file path pointing to emacs 27.1 executable compiled with support
|
|
|
|
for the portable dumper (this is currently the branch pdumper).
|
|
|
|
If nil then automatic dump of emacs is disabled.")
|
|
|
|
|
|
|
|
(defvar dotspacemacs-emacs-dumper-dump-file "spacemacs.pdmp"
|
|
|
|
"File path of Spacemacs dump file. This is the file created by the portable
|
|
|
|
dumper. To load it when starting Emacs add the parameter `--dump-file'
|
|
|
|
when invoking Emacs 27.1 executable on the command line, for instance:
|
|
|
|
./emacs --dump-file=spacedump.pdump
|
|
|
|
If the file path is relative, it will be relative to the directory pointed
|
|
|
|
by `dotspacemacs-emacs-pdumper-executable-file'.")
|
|
|
|
|
2018-01-29 04:22:38 +00:00
|
|
|
(defvar dotspacemacs-gc-cons '(100000000 0.1)
|
|
|
|
"Set `gc-cons-threshold' and `gc-cons-percentage' when startup finishes.
|
|
|
|
This is an advanced option and should not be changed unless you suspect
|
|
|
|
performance issues due to garbage collection operations.")
|
|
|
|
|
2015-11-18 18:49:41 +00:00
|
|
|
(defvar dotspacemacs-elpa-https t
|
|
|
|
"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
|
|
|
|
environment, otherwise it is strongly recommended to let it set to t.")
|
|
|
|
|
2015-12-06 07:22:49 +00:00
|
|
|
(defvar dotspacemacs-elpa-timeout 5
|
|
|
|
"Maximum allowed time in seconds to contact an ELPA repository.")
|
|
|
|
|
2017-11-12 14:33:58 +00:00
|
|
|
(defvar dotspacemacs-use-spacelpa nil
|
|
|
|
"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
|
2017-11-12 14:33:58 +00:00
|
|
|
version of packages from MELPA.")
|
|
|
|
|
2017-10-30 04:57:48 +00:00
|
|
|
(defvar dotspacemacs-verify-spacelpa-archives nil
|
|
|
|
"If non-nil then verify the signature for downloaded Spacelpa archives.")
|
|
|
|
|
2017-10-29 04:27:00 +00:00
|
|
|
(defvar 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
|
|
|
|
versions, set this to `emacs-version'.")
|
2015-10-14 08:52:45 +00:00
|
|
|
|
2014-11-22 02:19:50 +00:00
|
|
|
(defvar dotspacemacs-configuration-layer-path '()
|
|
|
|
"List of additional paths where to look for configuration layers.
|
2015-02-15 03:15:25 +00:00
|
|
|
Paths must have a trailing slash (ie. `~/.mycontribs/')")
|
2014-11-22 02:19:50 +00:00
|
|
|
|
2016-08-20 00:31:57 +00:00
|
|
|
(defvar dotspacemacs-install-packages 'used-only
|
|
|
|
"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*
|
|
|
|
packages supported by Spacemacs and never uninstalls them.")
|
2016-05-31 02:58:59 +00:00
|
|
|
|
2016-03-27 19:55:24 +00:00
|
|
|
(defvar 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
|
|
|
|
`dotspacemacs-configuration-layers' to install it.")
|
2016-01-31 05:05:27 +00:00
|
|
|
|
2016-03-27 19:56:15 +00:00
|
|
|
(defvar dotspacemacs-ask-for-lazy-installation t
|
|
|
|
"If non-nil then Spacemacs will ask for confirmation before installing
|
|
|
|
a layer lazily.")
|
|
|
|
|
2015-04-21 04:33:23 +00:00
|
|
|
(defvar dotspacemacs-additional-packages '()
|
|
|
|
"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
|
2015-09-28 06:05:18 +00:00
|
|
|
configuration in `dotspacemacs/user-config'.")
|
2015-04-21 04:33:23 +00:00
|
|
|
|
2017-02-02 03:59:03 +00:00
|
|
|
(defvar dotspacemacs--additional-theme-packages '()
|
|
|
|
"Same as `dotspacemacs-additonal-packages' but reserved for themes declared
|
|
|
|
in `dotspacemacs-themes'.")
|
2017-01-26 04:30:25 +00:00
|
|
|
|
2015-03-19 04:29:42 +00:00
|
|
|
(defvar 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
|
|
|
|
section of the documentation for details on available variables.")
|
2015-03-19 04:29:42 +00:00
|
|
|
|
2015-03-13 03:55:38 +00:00
|
|
|
(defvar dotspacemacs-startup-banner 'official
|
|
|
|
"Specify the startup banner. Default value is `official', it displays
|
|
|
|
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.
|
|
|
|
If the value is nil then no banner is displayed.")
|
2014-12-25 20:38:13 +00:00
|
|
|
|
2016-01-05 15:17:23 +00:00
|
|
|
(defvar dotspacemacs-scratch-mode 'text-mode
|
|
|
|
"Default major mode of the scratch buffer.")
|
|
|
|
|
2017-09-14 22:18:50 +00:00
|
|
|
(defvar dotspacemacs-initial-scratch-message 'nil
|
|
|
|
"Initial message in the scratch buffer.")
|
|
|
|
|
2016-08-04 00:37:00 +00:00
|
|
|
(defvar 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
|
|
|
|
whenever you start Emacs.")
|
2015-11-22 15:49:20 +00:00
|
|
|
|
2015-09-12 03:00:33 +00:00
|
|
|
(defvar dotspacemacs-configuration-layers '(emacs-lisp)
|
2016-05-30 12:55:12 +00:00
|
|
|
"List of configuration layers to load.")
|
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.")
|
|
|
|
|
2015-07-05 03:51:32 +00:00
|
|
|
(defvar dotspacemacs-themes '(spacemacs-dark
|
2016-06-13 01:15:10 +00:00
|
|
|
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
|
2015-01-24 03:02:08 +00:00
|
|
|
with 2 themes variants, one dark and one light")
|
2014-11-28 04:14:51 +00:00
|
|
|
|
2018-01-17 03:59:29 +00:00
|
|
|
(defvar 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',
|
|
|
|
`all-the-icons', `custom', `vim-powerline' and `vanilla'. The first three
|
|
|
|
are spaceline themes. `vanilla' is default Emacs mode-line. `custom' is a
|
|
|
|
user defined themes, refer to the DOCUMENTATION.org for more info on how
|
2018-01-17 03:59:29 +00:00
|
|
|
to create your own spaceline theme. Value can be a symbol or a list with
|
|
|
|
additional properties like '(all-the-icons :separator-scale 1.5).")
|
2018-01-12 04:53:44 +00:00
|
|
|
|
2017-04-28 22:44:27 +00:00
|
|
|
(defvar dotspacemacs-frame-title-format "%I@%S"
|
2015-07-10 13:57:18 +00:00
|
|
|
"Default format string for a frame title bar, using the
|
|
|
|
original format spec, and additional customizations.")
|
|
|
|
|
2017-04-28 22:44:27 +00:00
|
|
|
(defvar dotspacemacs-icon-title-format nil
|
|
|
|
"Default format string for a icon title bar, using the
|
|
|
|
original format spec, and additional customizations.")
|
|
|
|
|
2015-02-24 05:41:50 +00:00
|
|
|
(defvar dotspacemacs-colorize-cursor-according-to-state t
|
2015-10-02 17:50:45 +00:00
|
|
|
"If non nil the cursor color matches the state color in GUI Emacs.")
|
2015-02-24 05:41:50 +00:00
|
|
|
|
2014-12-06 22:55:20 +00:00
|
|
|
(defvar dotspacemacs-leader-key "SPC"
|
|
|
|
"The leader key.")
|
|
|
|
|
2015-03-23 23:06:48 +00:00
|
|
|
(defvar dotspacemacs-emacs-leader-key "M-m"
|
2015-03-19 04:29:42 +00:00
|
|
|
"The leader key accessible in `emacs state' and `insert state'")
|
|
|
|
|
2014-12-19 05:35:14 +00:00
|
|
|
(defvar dotspacemacs-major-mode-leader-key ","
|
|
|
|
"Major mode leader key is a shortcut key which is the equivalent of
|
2015-03-08 03:24:42 +00:00
|
|
|
pressing `<leader> m`. Set it to `nil` to disable it.")
|
2014-12-19 05:35:14 +00:00
|
|
|
|
2015-03-23 23:06:48 +00:00
|
|
|
(defvar dotspacemacs-major-mode-emacs-leader-key "C-M-m"
|
2015-03-19 04:29:42 +00:00
|
|
|
"Major mode leader key accessible in `emacs state' and `insert state'")
|
|
|
|
|
2016-10-10 01:28:09 +00:00
|
|
|
(defvar dotspacemacs-ex-command-key ":"
|
|
|
|
"The key used for Vim Ex commands.")
|
2016-05-29 01:34:28 +00:00
|
|
|
|
2016-01-09 07:23:04 +00:00
|
|
|
(defvar dotspacemacs-command-key "SPC"
|
2016-01-09 06:53:24 +00:00
|
|
|
"The key used for Emacs commands (M-x) (after pressing on the leader key).")
|
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
|
|
|
|
2015-12-02 00:25:37 +00:00
|
|
|
(defvar dotspacemacs-distinguish-gui-tab nil
|
|
|
|
"If non nil, distinguish C-i and tab in the GUI version of
|
|
|
|
emacs.")
|
|
|
|
|
|
|
|
;; (defvar dotspacemacs-distinguish-gui-ret nil
|
|
|
|
;; "If non nil, distinguish C-m and return in the GUI version of
|
|
|
|
;; emacs.")
|
|
|
|
|
2015-01-27 03:40:02 +00:00
|
|
|
(defvar dotspacemacs-default-font '("Source Code Pro"
|
|
|
|
:size 13
|
|
|
|
:weight normal
|
2018-01-17 03:59:29 +00:00
|
|
|
:width normal)
|
|
|
|
"Default font, or prioritized list of fonts. This setting has no effect when
|
|
|
|
running Emacs in terminal.")
|
2015-01-27 03:40:02 +00:00
|
|
|
|
2016-01-11 05:56:43 +00:00
|
|
|
(defvar dotspacemacs-remap-Y-to-y$ nil
|
|
|
|
"If non nil `Y' is remapped to `y$' in Evil states.")
|
2015-09-29 03:09:44 +00:00
|
|
|
|
2016-05-06 11:39:12 +00:00
|
|
|
(defvar dotspacemacs-retain-visual-state-on-shift t
|
|
|
|
"If non-nil, the shift mappings `<' and `>' retain visual state
|
|
|
|
if used there.")
|
2016-04-09 20:19:50 +00:00
|
|
|
|
2016-06-03 03:10:11 +00:00
|
|
|
(defvar dotspacemacs-visual-line-move-text nil
|
2016-06-02 21:33:52 +00:00
|
|
|
"If non-nil, J and K move lines up and down when in visual mode.")
|
|
|
|
|
2016-01-11 05:56:43 +00:00
|
|
|
(defvar dotspacemacs-ex-substitute-global nil
|
|
|
|
"If non nil, inverse the meaning of `g' in `:substitute' Evil ex-command.")
|
2016-01-08 14:16:26 +00:00
|
|
|
|
2016-04-29 21:20:19 +00:00
|
|
|
(defvar dotspacemacs-folding-method 'evil
|
|
|
|
"Code folding method. Possible values are `evil' and `origami'.")
|
|
|
|
|
2015-11-11 05:55:42 +00:00
|
|
|
(defvar dotspacemacs-default-layout-name "Default"
|
|
|
|
" Name of the default layout.")
|
|
|
|
|
|
|
|
(defvar dotspacemacs-display-default-layout nil
|
|
|
|
"If non nil the default layout name is displayed in the mode-line.")
|
|
|
|
|
2015-11-11 05:58:09 +00:00
|
|
|
(defvar dotspacemacs-auto-resume-layouts nil
|
|
|
|
"If non nil then the last auto saved layouts are resume automatically upon
|
|
|
|
start.")
|
2015-11-09 04:51:29 +00:00
|
|
|
|
2016-10-08 12:02:10 +00:00
|
|
|
(defvar dotspacemacs-auto-generate-layout-names nil
|
|
|
|
"If non-nil, auto-generate layout name when creating new layouts.
|
|
|
|
Only has effect when using the \"jump to layout by number\" commands.")
|
|
|
|
|
2015-11-11 05:14:46 +00:00
|
|
|
(defvar dotspacemacs-max-rollback-slots 5
|
|
|
|
"Maximum number of rollback slots to keep in the cache.")
|
|
|
|
|
2015-10-30 16:20:02 +00:00
|
|
|
(defvar 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
|
|
|
|
no major mode or minor modes are active.")
|
2015-10-30 16:20:02 +00:00
|
|
|
|
2015-06-19 03:54:07 +00:00
|
|
|
(defvar dotspacemacs-auto-save-file-location 'cache
|
|
|
|
"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
|
2017-08-06 12:37:01 +00:00
|
|
|
file stored in the cache directory and `nil' to disable auto-saving.")
|
2015-05-04 12:12:39 +00:00
|
|
|
|
2016-11-24 22:05:55 +00:00
|
|
|
(defvar dotspacemacs-enable-paste-transient-state nil
|
2017-08-06 12:37:01 +00:00
|
|
|
"If non-nil, the paste transient-state is enabled. While enabled, pressing
|
|
|
|
`p' several times cycles through the elements in the `kill-ring'.")
|
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
|
|
|
|
2015-07-25 16:56:06 +00:00
|
|
|
(defvar 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
|
|
|
|
`which-key-idle-delay'.")
|
|
|
|
|
|
|
|
(defvar dotspacemacs-which-key-position 'bottom
|
|
|
|
"Location of the which-key popup buffer. Possible choices are bottom,
|
|
|
|
right, and right-then-bottom. The last one will display on the
|
|
|
|
right if possible and fallback to bottom if not.")
|
2015-07-25 16:56:06 +00:00
|
|
|
|
2016-10-18 16:32:33 +00:00
|
|
|
(defvar dotspacemacs-switch-to-buffer-prefers-purpose nil
|
|
|
|
"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
|
|
|
|
window.")
|
|
|
|
|
2015-02-16 02:25:12 +00:00
|
|
|
(defvar dotspacemacs-loading-progress-bar t
|
|
|
|
"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
|
|
|
|
to boost the loading time.")
|
|
|
|
|
2015-01-13 04:27:07 +00:00
|
|
|
(defvar dotspacemacs-fullscreen-at-startup nil
|
|
|
|
"If non nil the frame is fullscreen when Emacs starts up (Emacs 24.4+ only).")
|
|
|
|
|
2015-01-12 17:22:17 +00:00
|
|
|
(defvar dotspacemacs-fullscreen-use-non-native nil
|
|
|
|
"If non nil `spacemacs/toggle-fullscreen' will not use native fullscreen. Use
|
|
|
|
to disable fullscreen animations in OSX.")
|
|
|
|
|
2014-12-15 13:19:24 +00:00
|
|
|
(defvar 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).
|
|
|
|
Takes effect only if `dotspacemacs-fullscreen-at-startup' is nil.")
|
2014-11-22 02:19:50 +00:00
|
|
|
|
2014-12-27 18:15:18 +00:00
|
|
|
(defvar dotspacemacs-active-transparency 90
|
|
|
|
"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
|
|
|
|
can be toggled through `toggle-transparency'.")
|
|
|
|
|
|
|
|
(defvar dotspacemacs-inactive-transparency 90
|
|
|
|
"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
|
|
|
|
can be toggled through `toggle-transparency'.")
|
|
|
|
|
2016-01-28 21:38:14 +00:00
|
|
|
(defvar dotspacemacs-show-transient-state-title t
|
|
|
|
"If non nil show the titles of transient states.")
|
|
|
|
|
2016-01-28 13:27:41 +00:00
|
|
|
(defvar dotspacemacs-show-transient-state-color-guide t
|
|
|
|
"If non nil show the color guide hint for transient state keys.")
|
|
|
|
|
2014-12-23 21:39:57 +00:00
|
|
|
(defvar dotspacemacs-mode-line-unicode-symbols t
|
|
|
|
"If non nil unicode symbols are displayed in the mode-line (eg. for lighters)")
|
|
|
|
|
2014-11-22 02:19:50 +00:00
|
|
|
(defvar 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
|
|
|
|
screen.")
|
2014-11-22 02:19:50 +00:00
|
|
|
|
2015-11-03 04:29:16 +00:00
|
|
|
(defvar 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
|
|
|
|
restricts line-number to the specified list of major-mode.")
|
2015-10-26 17:12:41 +00:00
|
|
|
|
2018-02-03 21:53:23 +00:00
|
|
|
(defvar dotspacemacs-enable-server t
|
|
|
|
"If non-nil, start an Emacs server if one is not already running.")
|
|
|
|
|
2014-12-12 22:59:49 +00:00
|
|
|
(defvar dotspacemacs-persistent-server nil
|
|
|
|
"If non nil advises quit functions to keep server open when quitting.")
|
|
|
|
|
2014-12-12 05:08:30 +00:00
|
|
|
(defvar dotspacemacs-smartparens-strict-mode nil
|
|
|
|
"If non-nil smartparens-strict-mode will be enabled in programming modes.")
|
|
|
|
|
2016-02-12 14:13:39 +00:00
|
|
|
(defvar dotspacemacs-smart-closing-parenthesis nil
|
|
|
|
"If non-nil pressing the closing parenthesis `)' key in insert mode passes
|
2017-04-10 03:55:00 +00:00
|
|
|
over any automatically added closing parenthesis, bracket, quote, etc…
|
2017-08-06 12:37:01 +00:00
|
|
|
This can be temporary disabled by pressing `C-q' before `)'.")
|
2016-02-12 14:13:39 +00:00
|
|
|
|
2017-04-10 03:55:00 +00:00
|
|
|
(defvar dotspacemacs-zone-out-when-idle nil
|
|
|
|
"Either nil or a number of seconds. If non-nil zone out after the specified
|
|
|
|
number of seconds.")
|
2017-03-29 15:08:53 +00:00
|
|
|
|
2015-04-19 05:04:05 +00:00
|
|
|
(defvar dotspacemacs-highlight-delimiters 'all
|
2015-07-24 00:41:52 +00:00
|
|
|
"Select a scope to highlight delimiters. Possible values are `any',
|
2016-01-05 05:37:19 +00:00
|
|
|
`current', `all' or `nil'. Default is `all' (highlight any scope and
|
2017-08-06 12:37:01 +00:00
|
|
|
emphasize the current one.")
|
2015-04-16 11:15:50 +00:00
|
|
|
|
2016-01-05 05:37:19 +00:00
|
|
|
(defvar dotspacemacs-whitespace-cleanup nil
|
|
|
|
"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 `nil' to disable cleanup.")
|
2015-10-16 16:56:57 +00:00
|
|
|
|
2016-10-20 00:29:06 +00:00
|
|
|
(defvar 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
|
2016-10-20 00:29:06 +00:00
|
|
|
tool of the list. Supported tools are `rg', `ag', `pt', `ack' and `grep'.")
|
2015-04-15 02:23:57 +00:00
|
|
|
|
2016-10-17 02:33:05 +00:00
|
|
|
(defvar 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.
|
|
|
|
Possible values for list-type are:
|
2016-09-02 20:42:37 +00:00
|
|
|
`recents' `bookmarks' `projects' `agenda' `todos'.
|
|
|
|
List sizes may be nil, in which case
|
|
|
|
`spacemacs--buffer-startup-lists-length' takes effect.
|
|
|
|
")
|
2015-07-17 05:38:34 +00:00
|
|
|
|
2016-09-02 20:45:34 +00:00
|
|
|
(defvar dotspacemacs-startup-buffer-responsive t
|
|
|
|
"True if the home buffer should respond to resize events.")
|
|
|
|
|
2014-11-22 02:19:50 +00:00
|
|
|
(defvar dotspacemacs-excluded-packages '()
|
2016-01-18 03:06:04 +00:00
|
|
|
"A list of packages that will not be install and loaded.")
|
2014-11-22 02:19:50 +00:00
|
|
|
|
2016-07-09 18:55:45 +00:00
|
|
|
(defvar dotspacemacs-frozen-packages '()
|
|
|
|
"A list of packages that cannot be updated.")
|
|
|
|
|
2017-06-23 17:35:44 +00:00
|
|
|
(defvar dotspacemacs-pretty-docs nil
|
2017-06-23 15:58:45 +00:00
|
|
|
"Run `spacemacs/prettify-org-buffer' when
|
|
|
|
visiting README.org files of Spacemacs.")
|
|
|
|
|
|
|
|
(defun dotspacemacs//prettify-spacemacs-docs ()
|
|
|
|
"Run `spacemacs/prettify-org-buffer' if `buffer-file-name'
|
|
|
|
has `spacemacs-start-directory'"
|
|
|
|
(when (and dotspacemacs-pretty-docs
|
2017-06-23 17:05:55 +00:00
|
|
|
spacemacs-start-directory
|
|
|
|
buffer-file-name
|
2017-06-23 15:58:45 +00:00
|
|
|
(string-prefix-p (expand-file-name spacemacs-start-directory)
|
2017-06-23 17:05:55 +00:00
|
|
|
(expand-file-name buffer-file-name)))
|
2017-06-23 15:58:45 +00:00
|
|
|
(spacemacs/prettify-org-buffer)))
|
|
|
|
|
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.
|
2016-11-23 03:49:23 +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))))))
|
|
|
|
|
2016-10-10 13:11:55 +00:00
|
|
|
(defun dotspacemacs//check-layers-changed ()
|
|
|
|
"Check if the value of `dotspacemacs-configuration-layers'
|
|
|
|
changed, and issue a warning if it did."
|
|
|
|
(unless (eq dotspacemacs-configuration-layers
|
|
|
|
dotspacemacs--configuration-layers-saved)
|
|
|
|
(spacemacs-buffer/warning
|
|
|
|
"`dotspacemacs-configuration-layers' was changed outside of `dotspacemacs/layers'.")))
|
|
|
|
(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.
|
|
|
|
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
|
|
|
|
`:variables'."
|
|
|
|
(cond
|
|
|
|
((symbolp config) config)
|
|
|
|
((listp config)
|
|
|
|
(let ((variables (spacemacs/mplist-get config :variables)))
|
|
|
|
(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 "
|
|
|
|
"if needed.\n") var err))))
|
|
|
|
(spacemacs-buffer/warning "Missing value for variable %s !"
|
|
|
|
var)))))
|
|
|
|
(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.
|
|
|
|
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))
|
|
|
|
(beginning-of-buffer)
|
|
|
|
(let ((insert-point (re-search-forward
|
2017-06-08 17:59:40 +00:00
|
|
|
"[^`]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))
|
|
|
|
|
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.
|
|
|
|
|
2015-09-12 03:04:55 +00:00
|
|
|
Called with `C-u' skips `dotspacemacs/user-config'.
|
2015-09-28 06:05:18 +00:00
|
|
|
Called with `C-u C-u' skips `dotspacemacs/user-config' _and_ preleminary 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))
|
2017-07-01 14:54:37 +00:00
|
|
|
(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)
|
2015-10-08 07:44:59 +00:00
|
|
|
(spacemacs//set-powerline-for-startup-buffers)))
|
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.
|
|
|
|
If SYMBOL value is `display-graphic-p' then return the result of
|
|
|
|
`(display-graphic-p)', otherwise return the value of the symbol."
|
|
|
|
`(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
|
|
|
|
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
|
|
|
|
".spacemacs.template") dotspacemacs-filepath t)
|
|
|
|
(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
|
|
|
|
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
|
|
|
|
|
|
|
If ARG is non nil then Ask questions to the user before installing the dotfile."
|
|
|
|
(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))
|
2015-08-26 05:58:01 +00:00
|
|
|
(dotspacemacs/safe-load)))))
|
|
|
|
|
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"
|
|
|
|
(let* ((fs (format-spec-make
|
2017-04-29 03:39:41 +00:00
|
|
|
?a (abbreviate-file-name (or (buffer-file-name)
|
|
|
|
(buffer-name)))
|
|
|
|
?t (if (fboundp 'projectile-project-name)
|
|
|
|
(projectile-project-name)
|
|
|
|
"-")
|
2015-07-10 13:57:18 +00:00
|
|
|
?S system-name
|
|
|
|
?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"
|
2018-01-07 02:54:15 +00:00
|
|
|
?\[ "%["
|
|
|
|
?\] "%]"
|
2015-07-10 13:57:18 +00:00
|
|
|
?% "%%"
|
|
|
|
?- "%-"
|
|
|
|
)))
|
2017-04-28 22:44:27 +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.
|
|
|
|
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."
|
|
|
|
(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
|
|
|
|
(let (dotspacemacs-configuration-layer-path dotspacemacs-configuration-layers
|
|
|
|
dotspacemacs-additional-packages dotspacemacs-excluded-packages
|
2016-08-20 00:31:57 +00:00
|
|
|
dotspacemacs-install-packages
|
2015-06-26 16:27:40 +00:00
|
|
|
(passed-tests 0) (total-tests 0))
|
|
|
|
(load dotspacemacs-filepath)
|
|
|
|
(dotspacemacs/layers)
|
|
|
|
(spacemacs//test-list
|
2015-09-01 02:08:10 +00:00
|
|
|
'stringp 'dotspacemacs-configuration-layer-path
|
|
|
|
"is a string" "path")
|
2015-06-26 16:27:40 +00:00
|
|
|
(spacemacs//test-list
|
2015-09-01 02:08:10 +00:00
|
|
|
'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))
|
|
|
|
dotspacemacs-configuration-layers))
|
2015-06-26 16:27:40 +00:00
|
|
|
(spacemacs//test-list
|
2015-06-30 02:53:51 +00:00
|
|
|
'configuration-layer/get-layer-path
|
|
|
|
'dotspacemacs-configuration-layers "can be found" "layer")
|
|
|
|
(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)
|
|
|
|
,@(dotspacemacs/get-variable-list)
|
|
|
|
(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)
|
|
|
|
(eq 'hybrid (car x))
|
|
|
|
(spacemacs/mplist-get x :variables))))
|
2016-03-17 02:43:50 +00:00
|
|
|
'dotspacemacs-editing-style
|
|
|
|
"is \'vim, \'emacs or \'hybrid or and list with `:variable' 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
|
|
|
|
vim-powerline
|
|
|
|
vanilla)))
|
|
|
|
(or (member x themes)
|
|
|
|
(and (listp x)
|
|
|
|
(memq (car x) themes)
|
|
|
|
;; TODO define a function to remove several properties at once
|
|
|
|
(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)))
|
|
|
|
'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)))
|
|
|
|
(member el '(recents bookmarks projects todos agenda))))
|
|
|
|
'dotspacemacs-startup-lists (concat "includes \'recents, "
|
|
|
|
"\'bookmarks, \'todos, "
|
|
|
|
"\'agenda or \'projects"))
|
|
|
|
(spacemacs//test-list
|
|
|
|
(lambda (x)
|
|
|
|
(let ((el (or (car-safe x) x))
|
|
|
|
(list-size (cdr-safe x)))
|
|
|
|
(or (null list-size)(numberp list-size))))
|
|
|
|
'dotspacemacs-startup-lists (concat "list size is a number"))
|
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.
|
|
|
|
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 "
|
|
|
|
"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
|
|
|
|
;; (insert (format "* Running tests on %s (v%s)\n" dotspacemacs-filepath dotspacemacs-version))
|
|
|
|
(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)
|