Fixes #35 spacemacs dotfile should be optional
This commit is contained in:
parent
19a1bbadd7
commit
97a5a335f7
|
@ -1,32 +1,25 @@
|
|||
;; -*- mode: emacs-lisp -*-
|
||||
;; This file is loaded by Spacemacs at startup.
|
||||
;; It must be stored in the home directory.
|
||||
;; It must be stored in your home directory.
|
||||
|
||||
;; Variables
|
||||
|
||||
(defconst dotspacemacs-version "1.01"
|
||||
"The version of this file.")
|
||||
|
||||
(defvar dotspacemacs-configuration-layer-path '()
|
||||
"List of additional paths where to look for configuration layers.
|
||||
Paths must have a trailing slash (ie. `~/.mycontribs/')"
|
||||
(setq-default
|
||||
;; List of additional paths where to look for configuration layers.
|
||||
;; Paths must have a trailing slash (ie. `~/.mycontribs/')
|
||||
dotspacemacs-configuration-layer-path '()
|
||||
;; List of contribution to load.
|
||||
dotspacemacs-configuration-layers '()
|
||||
;; If non nil the frame is maximized when Emacs starts up (Emacs 24.4+ only)
|
||||
dotspacemacs-fullscreen-at-startup nil
|
||||
;; A list of packages and/or extensions that will not be install and loaded.
|
||||
dotspacemacs-excluded-packages '()
|
||||
;; The default package repository used if no explicit repository has been
|
||||
;; specified with an installed package.
|
||||
;; Not used for now.
|
||||
dotspacemacs-default-package-repository nil
|
||||
)
|
||||
|
||||
(defvar dotspacemacs-configuration-layers '()
|
||||
"List of contribution to load."
|
||||
)
|
||||
|
||||
(defvar dotspacemacs-fullscreen-at-startup t
|
||||
"If non nil the frame is maximized when Emacs starts up.")
|
||||
|
||||
(defvar dotspacemacs-default-package-repository 'melpa-stable
|
||||
"The default package repository used if no explicit repository has been
|
||||
specified with an installed package."
|
||||
)
|
||||
|
||||
(defvar dotspacemacs-excluded-packages '()
|
||||
"A list of packages and/or extensions that will not be install and loaded.")
|
||||
|
||||
;; Functions
|
||||
|
||||
(defun dotspacemacs/init ()
|
||||
|
|
|
@ -45,6 +45,27 @@ initialize the extension.")
|
|||
"Hash table of layers locations where the key is a layer symbol and the value
|
||||
is its path.")
|
||||
|
||||
(defvar dotspacemacs-configuration-layer-path '()
|
||||
"List of additional paths where to look for configuration layers.
|
||||
Paths must have a trailing slash (ie. `~/.mycontribs/')"
|
||||
)
|
||||
|
||||
(defvar dotspacemacs-configuration-layers '()
|
||||
"list of contribution to load."
|
||||
)
|
||||
|
||||
(defvar dotspacemacs-fullscreen-at-startup nil
|
||||
"If non nil the frame is maximized when Emacs starts up (Emacs 24.4+ only).")
|
||||
|
||||
(defvar dotspacemacs-default-package-repository 'melpa-stable
|
||||
"The default package repository used if no explicit repository has been
|
||||
specified with an installed package.
|
||||
NOT USED FOR NOW :-)"
|
||||
)
|
||||
|
||||
(defvar dotspacemacs-excluded-packages '()
|
||||
"A list of packages and/or extensions that will not be install and loaded.")
|
||||
|
||||
(defun contribsys/dotfile-location ()
|
||||
"Return the absolute path to the spacemacs dotfile."
|
||||
(concat user-home-directory ".spacemacs"))
|
||||
|
@ -57,34 +78,6 @@ is its path.")
|
|||
(copy-file (concat user-emacs-directory ".spacemacs.template") dotfile))
|
||||
(load dotfile)))
|
||||
|
||||
(defun contribsys/check-dotspacemacs-version ()
|
||||
"Return t if the check pass, otherwise return nil and display an error
|
||||
message.
|
||||
|
||||
The check pass if the expected major version stored in
|
||||
`spacemacs-dotspacemacs-version' is the same as the expected major version from
|
||||
spacemacs.
|
||||
"
|
||||
(if (and (boundp 'dotspacemacs-version)
|
||||
(and (equal (car (version-to-list dotspacemacs-version))
|
||||
(car (version-to-list spacemacs-dotspacemacs-version)))))
|
||||
t
|
||||
(defun display-startup-echo-area-message ()
|
||||
"Change the default welcome message of minibuffer to another one."
|
||||
(message "Error during loading of Spacemacs."))
|
||||
(spacemacs/append-to-buffer
|
||||
(format (concat
|
||||
"Error: '~/.spacemacs' version mismatch.\n"
|
||||
"Found version %s instead of %s.\n\n"
|
||||
"Check for recent commits message and look for "
|
||||
"'~/.emacs.d/.spacemacs.template' to update your configuration "
|
||||
"file.\nIf you have a hard time to update it, feel free to open "
|
||||
"an issue.")
|
||||
(if (boundp 'dotspacemacs-version)
|
||||
dotspacemacs-version)
|
||||
spacemacs-dotspacemacs-version))
|
||||
nil))
|
||||
|
||||
(defun contribsys/declare-layer (sym &optional contrib)
|
||||
"Declare a layer with SYM name (symbol). If CONTRIB is non nil then the layer
|
||||
is a contribution layer."
|
||||
|
|
31
init.el
31
init.el
|
@ -26,22 +26,21 @@
|
|||
(load (concat spacemacs-core-directory "contribsys.el"))
|
||||
;; User configuration file for Spacemacs: ~/.spacemacs
|
||||
(contribsys/load-dotfile)
|
||||
(when (contribsys/check-dotspacemacs-version)
|
||||
(dotspacemacs/init)
|
||||
;; default configuration layer of spacemacs
|
||||
(contribsys/declare-layer 'spacemacs)
|
||||
;; configuration layers coming from `dotspacemacs-configuration-layers'
|
||||
(contribsys/discover-contrib-layers)
|
||||
(contribsys/declare-user-configuration-layers)
|
||||
;; heavy lifting, load all packages and extensions
|
||||
(contribsys/load-layers)
|
||||
;; Temporary fix until automatic orphan packages deletion is ported to
|
||||
;; Emacs 24.4
|
||||
(contribsys/delete-orphan-packages)
|
||||
;; Ultimate configuration decisions are given to the user who can defined
|
||||
;; them in his/her ~/.spacemacs file
|
||||
(dotspacemacs/config)
|
||||
(contribsys/setup-after-init-hook))
|
||||
(if (fboundp 'dotspacemacs/init) (dotspacemacs/init))
|
||||
;; default configuration layer of spacemacs
|
||||
(contribsys/declare-layer 'spacemacs)
|
||||
;; configuration layers coming from `dotspacemacs-configuration-layers'
|
||||
(contribsys/discover-contrib-layers)
|
||||
(contribsys/declare-user-configuration-layers)
|
||||
;; heavy lifting, load all packages and extensions
|
||||
(contribsys/load-layers)
|
||||
;; Temporary fix until automatic orphan packages deletion is ported to
|
||||
;; Emacs 24.4
|
||||
(contribsys/delete-orphan-packages)
|
||||
;; Ultimate configuration decisions are given to the user who can defined
|
||||
;; them in his/her ~/.spacemacs file
|
||||
(if (fboundp 'dotspacemacs/config) (dotspacemacs/config))
|
||||
(contribsys/setup-after-init-hook)
|
||||
|
||||
;; start a server for subsequent emacs clients
|
||||
(require 'server)
|
||||
|
|
Loading…
Reference in New Issue