Make it possible to use spacemacs-bootstrap layer as a distribution

This commit is contained in:
syl20bnr 2016-04-06 10:05:34 -04:00
parent bb46ced71c
commit 09ff77fbd4
7 changed files with 75 additions and 61 deletions

View File

@ -869,8 +869,9 @@ path."
layer-name))))
(setq configuration-layer--layers (reverse configuration-layer--layers))
;; distribution and bootstrap layers are always first
(push (configuration-layer/make-layer dotspacemacs-distribution)
configuration-layer--layers)
(unless (eq 'spacemacs-bootstrap dotspacemacs-distribution)
(push (configuration-layer/make-layer dotspacemacs-distribution)
configuration-layer--layers))
(push (configuration-layer/make-layer 'spacemacs-bootstrap)
configuration-layer--layers))

View File

@ -63,7 +63,8 @@ version the release note it displayed")
:abbrev-table nil
(setq buffer-read-only t
truncate-lines t)
(page-break-lines-mode)
(when (fboundp 'page-break-lines-mode)
(page-break-lines-mode))
;; needed to make tab work correctly in terminal
(evil-define-key 'motion spacemacs-buffer-mode-map
(kbd "C-i") 'widget-forward)
@ -732,7 +733,8 @@ border."
(bookmark-all-names))
(spacemacs//insert--shortcut "b" "Bookmarks:")
(insert list-separator)))
((eq el 'projects)
((and (eq el 'projects)
(fboundp 'projectile-mode))
(projectile-mode)
(when (spacemacs-buffer//insert-file-list
"Projects:"

View File

@ -21,7 +21,7 @@
"Spacemacs requires Emacs version %d or above.")
emacs-version spacemacs-emacs-min-version)
(load-file (concat user-emacs-directory "core/core-load-paths.el"))
(require 'core-spacemacs)
(require 'core-spacemacs)
(spacemacs/init)
(spacemacs/maybe-install-dotfile)
(configuration-layer/sync)

View File

@ -109,40 +109,6 @@ It runs `tabulated-list-revert-hook', then calls `tabulated-list-print'."
(`all (add-hook 'before-save-hook 'whitespace-cleanup))
(`trailing (add-hook 'before-save-hook 'delete-trailing-whitespace)))
;; Thanks to `editorconfig-emacs' for many of these
(defvar spacemacs--indent-variable-alist
'(((awk-mode c-mode c++-mode java-mode groovy-mode
idl-mode java-mode objc-mode pike-mode) . c-basic-offset)
(python-mode . python-indent-offset)
(cmake-mode . cmake-tab-width)
(coffee-mode . coffee-tab-width)
(cperl-mode . cperl-indent-level)
(css-mode . css-indent-offset)
(elixir-mode . elixir-smie-indent-basic)
((emacs-lisp-mode lisp-mode) . lisp-indent-offset)
(enh-ruby-mode . enh-ruby-indent-level)
(erlang-mode . erlang-indent-level)
((js-mode json-mode) . js-indent-level)
(js2-mode . js2-basic-offset)
(js3-mode . js3-indent-level)
(latex-mode . (LaTeX-indent-level tex-indent-basic))
(livescript-mode . livescript-tab-width)
(mustache-mode . mustache-basic-offset)
(nxml-mode . nxml-child-indent)
(perl-mode . perl-indent-level)
(puppet-mode . puppet-indent-level)
(ruby-mode . ruby-indent-level)
(rust-mode . rust-indent-offset)
(scala-mode . scala-indent:step)
(sgml-mode . sgml-basic-offset)
(sh-mode . sh-basic-offset)
(web-mode . web-mode-markup-indent-offset)
(yaml-mode . yaml-indent-offset))
"An alist where each key is either a symbol corresponding
to a major mode, a list of such symbols, or the symbol t,
acting as default. The values are either integers, symbols
or lists of these.")
;; ---------------------------------------------------------------------------
;; UI
;; ---------------------------------------------------------------------------

View File

@ -894,25 +894,3 @@ is nonempty."
(interactive)
(delete-windows-on "*compilation*"))
(defun spacemacs//set-evil-shift-width ()
"Set the value of `evil-shift-width' based on the indentation settings of the
current major mode."
(let ((shift-width
(catch 'break
(dolist (test spacemacs--indent-variable-alist)
(let ((mode (car test))
(val (cdr test)))
(when (or (and (symbolp mode) (derived-mode-p mode))
(and (listp mode) (apply 'derived-mode-p mode))
(eq 't mode))
(when (not (listp val))
(setq val (list val)))
(dolist (v val)
(cond
((integerp v) (throw 'break v))
((and (symbolp v) (boundp v))
(throw 'break (symbol-value v))))))))
(throw 'break (default-value 'evil-shift-width)))))
(when (and (integerp shift-width)
(< 0 shift-width))
(setq-local evil-shift-width shift-width))))

View File

@ -0,0 +1,44 @@
;;; config.el --- Spacemacs Bootstrap Layer configuration File
;;
;; Copyright (c) 2012-2016 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
;; Thanks to `editorconfig-emacs' for many of these
(defvar spacemacs--indent-variable-alist
'(((awk-mode c-mode c++-mode java-mode groovy-mode
idl-mode java-mode objc-mode pike-mode) . c-basic-offset)
(python-mode . python-indent-offset)
(cmake-mode . cmake-tab-width)
(coffee-mode . coffee-tab-width)
(cperl-mode . cperl-indent-level)
(css-mode . css-indent-offset)
(elixir-mode . elixir-smie-indent-basic)
((emacs-lisp-mode lisp-mode) . lisp-indent-offset)
(enh-ruby-mode . enh-ruby-indent-level)
(erlang-mode . erlang-indent-level)
((js-mode json-mode) . js-indent-level)
(js2-mode . js2-basic-offset)
(js3-mode . js3-indent-level)
(latex-mode . (LaTeX-indent-level tex-indent-basic))
(livescript-mode . livescript-tab-width)
(mustache-mode . mustache-basic-offset)
(nxml-mode . nxml-child-indent)
(perl-mode . perl-indent-level)
(puppet-mode . puppet-indent-level)
(ruby-mode . ruby-indent-level)
(rust-mode . rust-indent-offset)
(scala-mode . scala-indent:step)
(sgml-mode . sgml-basic-offset)
(sh-mode . sh-basic-offset)
(web-mode . web-mode-markup-indent-offset)
(yaml-mode . yaml-indent-offset))
"An alist where each key is either a symbol corresponding
to a major mode, a list of such symbols, or the symbol t,
acting as default. The values are either integers, symbols
or lists of these.")

View File

@ -50,6 +50,29 @@
(call-interactively binding)
(evil-goto-definition))))
(defun spacemacs//set-evil-shift-width ()
"Set the value of `evil-shift-width' based on the indentation settings of the
current major mode."
(let ((shift-width
(catch 'break
(dolist (test spacemacs--indent-variable-alist)
(let ((mode (car test))
(val (cdr test)))
(when (or (and (symbolp mode) (derived-mode-p mode))
(and (listp mode) (apply 'derived-mode-p mode))
(eq 't mode))
(when (not (listp val))
(setq val (list val)))
(dolist (v val)
(cond
((integerp v) (throw 'break v))
((and (symbolp v) (boundp v))
(throw 'break (symbol-value v))))))))
(throw 'break (default-value 'evil-shift-width)))))
(when (and (integerp shift-width)
(< 0 shift-width))
(setq-local evil-shift-width shift-width))))
(defmacro spacemacs|define-text-object (key name start end)
(let ((inner-name (make-symbol (concat "evil-inner-" name)))
(outer-name (make-symbol (concat "evil-outer-" name)))