2015-01-27 03:51:47 +00:00
|
|
|
;;; core-dotspacemacs.el --- Spacemacs Core File
|
2015-01-14 04:12:56 +00:00
|
|
|
;;
|
|
|
|
;; Copyright (c) 2012-2014 Sylvain Benner
|
|
|
|
;; Copyright (c) 2014-2015 Sylvain Benner & Contributors
|
|
|
|
;;
|
|
|
|
;; 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.")
|
|
|
|
|
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
|
|
|
|
2014-12-25 20:38:13 +00:00
|
|
|
(defvar dotspacemacs-startup-banner 'random
|
|
|
|
"Specify the startup banner. If the value is an integer then the
|
|
|
|
banner with the corresponding index is used, if the value is `random'
|
|
|
|
then the banner is chosen randomly among the available banners, if
|
|
|
|
the value is nil then no banner is displayed.")
|
|
|
|
|
2014-11-22 02:19:50 +00:00
|
|
|
(defvar dotspacemacs-configuration-layers '()
|
2015-02-15 03:15:25 +00:00
|
|
|
"List of configuration layers to load. If it is the symbol `all' instead
|
|
|
|
of a list then all discovered layers will be installed.")
|
2014-11-22 02:19:50 +00:00
|
|
|
|
2015-01-28 02:45:39 +00:00
|
|
|
(defvar dotspacemacs-themes '(solarized-light
|
|
|
|
solarized-dark
|
|
|
|
leuven
|
|
|
|
monokai
|
|
|
|
zenburn)
|
2015-01-24 03:02:08 +00:00
|
|
|
"List of themes, the first of the list is loaded when spacemacs starts.
|
|
|
|
Press <SPC> T n to cycle to the next theme in the list (works great
|
|
|
|
with 2 themes variants, one dark and one light")
|
2014-11-28 04:14:51 +00:00
|
|
|
|
2015-02-24 05:41:50 +00:00
|
|
|
(defvar dotspacemacs-colorize-cursor-according-to-state t
|
|
|
|
"If non nil the cursor color matches the state color.")
|
|
|
|
|
2014-12-06 22:55:20 +00:00
|
|
|
(defvar dotspacemacs-leader-key "SPC"
|
|
|
|
"The leader key.")
|
|
|
|
|
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
|
|
|
|
pressing `<leader> m`")
|
|
|
|
|
2015-01-27 03:40:02 +00:00
|
|
|
(defvar dotspacemacs-default-font '("Source Code Pro"
|
|
|
|
:size 13
|
|
|
|
:weight normal
|
|
|
|
:width normal
|
2015-01-28 02:46:37 +00:00
|
|
|
:powerline-scale 1.1)
|
2015-02-08 01:05:24 +00:00
|
|
|
"Default font. `powerline-scale' allows to quickly tweak the mode-line
|
2015-01-27 03:40:02 +00:00
|
|
|
size to make separators look not too crappy.")
|
|
|
|
|
2014-12-11 03:12:19 +00:00
|
|
|
(defvar dotspacemacs-command-key ":"
|
|
|
|
"The key used for Evil commands (ex-commands) and Emacs commands (M-x).
|
|
|
|
By default the command key is `:' so ex-commands are executed like in Vim
|
|
|
|
with `:' and Emacs commands are executed with `<leader> :'.")
|
|
|
|
|
2014-11-29 02:48:16 +00:00
|
|
|
(defvar dotspacemacs-guide-key-delay 0.4
|
|
|
|
"Guide-key delay in seconds.")
|
2015-02-05 03:35:36 +00:00
|
|
|
|
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'.")
|
|
|
|
|
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
|
|
|
|
"If non nil smooth scrolling (native-scrolling) is enabled. Smooth scrolling
|
|
|
|
overrides the default behavior of Emacs which recenters the point when
|
|
|
|
it reaches the top or bottom of the screen.")
|
|
|
|
|
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.")
|
|
|
|
|
2015-02-17 18:31:51 +00:00
|
|
|
(defvar dotspacemacs-delete-orphan-packages t
|
2015-02-15 03:03:30 +00:00
|
|
|
"If non-nil spacemacs will delete any orphan packages, i.e. packages that are
|
|
|
|
declared in a layer which is not a member of
|
|
|
|
`dotspacemacs-configuration-layers'")
|
|
|
|
|
2014-11-22 02:19:50 +00:00
|
|
|
(defvar dotspacemacs-default-package-repository 'melpa-stable
|
|
|
|
"The default package repository used if no explicit repository has been
|
|
|
|
specified with an installed package.
|
2015-02-15 03:15:25 +00:00
|
|
|
NOT USED FOR NOW :-)")
|
2014-11-22 02:19:50 +00:00
|
|
|
|
|
|
|
(defvar dotspacemacs-excluded-packages '()
|
|
|
|
"A list of packages and/or extensions that will not be install and loaded.")
|
|
|
|
|
2015-03-02 04:02:14 +00:00
|
|
|
(defvar dotspacemacs-mode-map
|
|
|
|
(let ((map (make-sparse-keymap)))
|
|
|
|
(define-key map (kbd "C-c C-c") 'dotspacemacs/sync-configuration-layers)
|
|
|
|
map)
|
|
|
|
"Keymap for dostpacemacs-mode.")
|
|
|
|
|
2015-03-01 17:49:39 +00:00
|
|
|
(define-derived-mode dotspacemacs-mode emacs-lisp-mode "dotspacemacs"
|
2015-03-02 04:02:14 +00:00
|
|
|
"dotspacemacs major mode for Spacemacs dotfile.
|
|
|
|
|
|
|
|
\\{dotspacemacs-mode-map}"
|
2015-03-02 04:51:38 +00:00
|
|
|
:group 'spacemacs
|
|
|
|
(run-at-time
|
|
|
|
"2 sec" nil
|
|
|
|
(lambda () (message "C-c C-c to apply your changes."))))
|
2015-03-01 17:49:39 +00:00
|
|
|
|
2015-03-02 05:27:36 +00:00
|
|
|
(defun dotspacemacs/sync-configuration-layers (arg)
|
|
|
|
"Synchronize declared layers in dotfile with spacemacs.
|
|
|
|
|
|
|
|
If ARG is non nil then `dotspacemacs/config' is called at the end of the
|
|
|
|
synchronization."
|
|
|
|
(interactive "P")
|
2015-03-02 04:02:14 +00:00
|
|
|
(let ((dotspacemacs-loading-progress-bar nil))
|
|
|
|
(load-file buffer-file-name)
|
2015-03-02 06:12:07 +00:00
|
|
|
(dotspacemacs|call-func dotspacemacs/config "Calling dotfile init...")
|
2015-03-02 05:27:36 +00:00
|
|
|
(configuration-layer/sync)
|
|
|
|
(if arg
|
|
|
|
(progn
|
|
|
|
(dotspacemacs|call-func dotspacemacs/config "Calling dotfile config...")
|
|
|
|
(message "Done (`dotspacemacs/config' function has been called)."))
|
|
|
|
(message "Done."))))
|
2015-03-02 04:02:14 +00:00
|
|
|
|
2014-11-22 02:19:50 +00:00
|
|
|
(defun dotspacemacs/location ()
|
|
|
|
"Return the absolute path to the spacemacs dotfile."
|
|
|
|
(concat user-home-directory ".spacemacs"))
|
|
|
|
|
2014-11-22 03:33:54 +00:00
|
|
|
(defun dotspacemacs/install ()
|
|
|
|
"Install `.spacemacs.template' in home directory. Ask for confirmation
|
|
|
|
before installing the file if the destination already exists."
|
|
|
|
(interactive)
|
|
|
|
(let* ((dotfile "~/.spacemacs")
|
2015-03-01 17:49:39 +00:00
|
|
|
(install
|
|
|
|
(if (file-exists-p dotfile)
|
|
|
|
(y-or-n-p
|
|
|
|
(format "%s already exists. Do you want to overwite it ? "
|
|
|
|
dotfile)) t)))
|
2014-11-22 03:33:54 +00:00
|
|
|
(when install
|
2014-12-25 20:24:26 +00:00
|
|
|
(copy-file (concat dotspacemacs-template-directory
|
2014-11-22 03:33:54 +00:00
|
|
|
".spacemacs.template") dotfile t)
|
|
|
|
(message "%s has been installed." dotfile))))
|
|
|
|
|
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)))
|
|
|
|
(if (file-exists-p dotspacemacs) (load dotspacemacs))))
|
|
|
|
|
2015-02-11 22:00:22 +00:00
|
|
|
(defmacro dotspacemacs|call-func (func &optional msg)
|
|
|
|
"Call the function from the dotfile only if it is bound.
|
|
|
|
If MSG is not nil then display a message in `*Messages'."
|
|
|
|
`(progn
|
|
|
|
(when ,msg (spacemacs/message ,msg))
|
|
|
|
(if (fboundp ',func) (,func))))
|
2014-11-22 02:19:50 +00:00
|
|
|
|
2015-01-27 03:51:47 +00:00
|
|
|
(provide 'core-dotspacemacs)
|