Skip to content

Commit

Permalink
reorganize spacemacs-base distribution into +spacemacs/spacemacs-xxx
Browse files Browse the repository at this point in the history
This idea is to have the spacemacs-base distribution only configure defaults for
built-in packages. Those buit-in packages are now configured in the new layer
spacemacs-defaults.
Additionally some other packages of spacemacs-base have been dispatched to
better suiting spacemacs layers.

Projectile has been moved to the new layer spacemacs-project

- Move the following packages to bootsrap distributio layer:
  - exec-path-from-shell
  - evil-evilified-state
  - holy-mode
  - hybrid-mode
  - spacemacs-theme
- ace-window has been moved to spacemacs-navigation
- centered-buffer-mode has been moved to spacemacs-editing-visual
- pcre2el has been moved to spacemacs-editing
- evil-escape and evil-visualstar have been moved to spacemacs-evil
  • Loading branch information
syl20bnr committed Mar 5, 2018
1 parent 2e8727a commit 0fa3658
Show file tree
Hide file tree
Showing 26 changed files with 382 additions and 322 deletions.
39 changes: 0 additions & 39 deletions layers/+distributions/spacemacs-base/README.org
Original file line number Diff line number Diff line change
Expand Up @@ -11,42 +11,3 @@ This is the base distribution for Spacemacs.
- Minimalistic approach to Spacemacs, contains only the core packages. Good starting
point to make something completely new. This distribution should not be used for
a new standalone Spacemacs installation except you have very good reasons to.
It contains the following packages:
- abbrev
- ace-window
- archive-mode
- bookmark
- centered-buffer-mode
- conf-mode
- dired
- electric-indent-mode
- ediff
- eldoc
- evil-escape
- evil-evilified-state
- evil-visualstar
- help-fns+
- hi-lock
- holy-mode
- hybrid-mode
- image-mode
- imenu
- linum
- occur-mode
- package-menu
- page-break-lines
- pcre2el
- process-menu
- projectile
- recentf
- savehist
- saveplace
- spacemacs-theme
- subword
- tar-mode
- uniquify
- url
- visual-line-mode
- whitespace
- winner
- zone
12 changes: 12 additions & 0 deletions layers/+distributions/spacemacs-base/layers.el
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
;;; layers.el --- Spacemacs base distribution layers File
;;
;; Copyright (c) 2012-2018 Sylvain Benner & Contributors
;;
;; Author: Sylvain Benner <[email protected]>
;; URL: https://github.com/syl20bnr/spacemacs
;;
;; This file is not part of GNU Emacs.
;;
;;; License: GPLv3

(configuration-layer/declare-layers '(spacemacs-defaults))
4 changes: 3 additions & 1 deletion layers/+distributions/spacemacs-bootstrap/README.org
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,9 @@
This layer loads the necessary packages for spacemacs to start-up.

** Features:
- Loads =evil= key bindings
- Loads =evil= key bindings and macros for auto-evilifcation of maps
- Loads =holy= and =hybrid= modes
- Loads the official Spacemacs theme
- Loads =use-package= which is used to load other packages more easily
- Loads =hydra= which is used to create transient modes
- Loads =which-key= which is used to show keybindings in other modes
Expand Down
66 changes: 65 additions & 1 deletion layers/+distributions/spacemacs-bootstrap/packages.el
Original file line number Diff line number Diff line change
Expand Up @@ -11,17 +11,30 @@

(setq spacemacs-bootstrap-packages
'(
;; bootstrap packages,
;; `use-package' cannot be used for bootstrap packages configuration
(async :step bootstrap)
(bind-map :step bootstrap)
(bind-key :step bootstrap)
(diminish :step bootstrap)
(evil :step bootstrap)
(exec-path-from-shell :step bootstrap
:toggle (or (spacemacs/system-is-mac)
(spacemacs/system-is-linux)
(eq window-system 'x)))
(hydra :step bootstrap)
(use-package :step bootstrap)
(which-key :step bootstrap)
;; pre packages, initialized aftert the bootstrap packages
;; these packages can use use-package
(evil-evilified-state :location local :step pre :protected t)
(holy-mode :location local :step pre)
(hybrid-mode :location local :step pre)
(spacemacs-theme :location built-in)
))

;; Note: `use-package' cannot be used for bootstrap packages configuration

;; bootstrap packages

(defun spacemacs-bootstrap/init-async ())

Expand Down Expand Up @@ -272,6 +285,10 @@
(evil-declare-ignore-repeat 'spacemacs/next-error)
(evil-declare-ignore-repeat 'spacemacs/previous-error))

(defun spacemacs-bootstrap/init-exec-path-from-shell ()
(require 'exec-path-from-shell)
(exec-path-from-shell-initialize))

(defun spacemacs-bootstrap/init-hydra ()
(require 'hydra)
(setq hydra-key-doc-function 'spacemacs//hydra-key-doc-function
Expand Down Expand Up @@ -475,3 +492,50 @@

(which-key-mode)
(spacemacs|diminish which-key-mode "" " K"))

;; pre packages

(defun spacemacs-bootstrap/init-evil-evilified-state ()
(use-package evil-evilified-state)
(define-key evil-evilified-state-map (kbd dotspacemacs-leader-key)
spacemacs-default-map))

(defun spacemacs-bootstrap/init-holy-mode ()
(use-package holy-mode
:commands holy-mode
:init
(progn
(when (eq 'emacs dotspacemacs-editing-style)
(holy-mode))
(spacemacs|add-toggle holy-mode
:status holy-mode
:on (progn (when (bound-and-true-p hybrid-mode)
(hybrid-mode -1))
(holy-mode))
:off (holy-mode -1)
:documentation "Globally toggle holy mode."
:evil-leader "tEe")
(spacemacs|diminish holy-mode " Ⓔe" " Ee"))))

(defun spacemacs-bootstrap/init-hybrid-mode ()
(use-package hybrid-mode
:config
(progn
(when (eq 'hybrid dotspacemacs-editing-style) (hybrid-mode))
(spacemacs|add-toggle hybrid-mode
:status hybrid-mode
:on (progn (when (bound-and-true-p holy-mode)
(holy-mode -1))
(hybrid-mode))
:off (hybrid-mode -1)
:documentation "Globally toggle hybrid mode."
:evil-leader "tEh")
(spacemacs|diminish hybrid-mode " Ⓔh" " Eh"))))

(defun spacemacs-bootstrap/init-spacemacs-theme ()
(use-package spacemacs-theme
:defer t
:init
(progn
(setq spacemacs-theme-comment-bg t)
(setq spacemacs-theme-org-height t))))
3 changes: 2 additions & 1 deletion layers/+distributions/spacemacs/layers.el
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
;;; layers.el --- Spacemacs Layer layers File
;;; layers.el --- Spacemacs distribution Layer layers File
;;
;; Copyright (c) 2012-2018 Sylvain Benner & Contributors
;;
Expand All @@ -23,6 +23,7 @@
spacemacs-modeline
spacemacs-navigation
spacemacs-org
spacemacs-project
spacemacs-purpose
spacemacs-visual
))
15 changes: 11 additions & 4 deletions layers/+spacemacs/spacemacs-completion/README.org
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,16 @@
- [[#features][Features:]]

* Description
This layer adds basics for providing code-completion for various major modes
to Spacemacs.
This layer does basic setup for completion frameworks like =helm=, =ivy= and
=ido=.

Its main role is to ensure sane defaults and consistent UI between =helm=
and =ivy= because even when you are using only one of them you could still
need to use the other (for instance a package that supports only =helm=).

Advanced configuration of these packages can be found in their respective
layers in =+completion= layer directory.

** Features:
- Preconfiguration of =helm= and =ivy= for other layers to use.
- Adding of =ido-navigation= configuration and transient state.
- Base preconfiguration of =helm= and =ivy= for other layers to use.
- Basic support for =ido-navigation= configuration and transient state.
13 changes: 13 additions & 0 deletions layers/+spacemacs/spacemacs-defaults/README.org
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
#+TITLE: spacemacs-defaults

* Table of Contents :TOC_4_gh:noexport:
- [[#description][Description]]
- [[#features][Features:]]

* Description
This layer configures mostly Emacs built-in packages to given them better
defaults.

** Features:
See [[file:packages.el][packages.el]] for a list of all configured packages or use Spacemacs help system
with ~SPC h SPC spacemacs-defaults~ to browse all the configuration for this layer.
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
;;; config.el --- Spacemacs Base Layer configuration File
;;; config.el --- Spacemacs Defaults Layer configuration File
;;
;; Copyright (c) 2012-2018 Sylvain Benner & Contributors
;;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
;;; funcs.el --- Spacemacs Base Layer functions File
;;; funcs.el --- Spacemacs Defaults Layer functions File
;;
;; Copyright (c) 2012-2018 Sylvain Benner & Contributors
;;
Expand Down Expand Up @@ -134,37 +134,6 @@ automatically applied to."
(while (condition-case nil (windmove-down) (error nil))
(delete-window))))

(defun spacemacs/toggle-centered-buffer-mode ()
"Toggle `spacemacs-centered-buffer-mode'."
(interactive)
(when (require 'centered-buffer-mode nil t)
(call-interactively 'spacemacs-centered-buffer-mode)))

(defun spacemacs/toggle-centered-buffer-mode-frame ()
"Open current buffer in the new frame centered and without mode-line."
(interactive)
(when (require 'centered-buffer-mode nil t)
(switch-to-buffer-other-frame (current-buffer) t)
(toggle-frame-fullscreen)
(run-with-idle-timer
;; FIXME: We need this delay to make sure that the
;; `toggle-frame-fullscreen' fully "finished"
;; it will be better to use something more reliable
;; instead :)
1
nil
(lambda ()
(call-interactively 'spacemacs-centered-buffer-mode)
(setq mode-line-format nil)))))

(defun spacemacs/centered-buffer-mode-full-width ()
"Center buffer in the frame."
;; FIXME Needs new key-binding.
(interactive)
(when (require 'centered-buffer-mode nil t)
(spacemacs/maximize-horizontally)
(call-interactively 'spacemacs-centered-buffer-mode)))

(defun spacemacs/useful-buffer-p (buffer)
"Determines if a buffer is useful."
(let ((buf-name (buffer-name buffer)))
Expand Down Expand Up @@ -475,19 +444,6 @@ If the universal prefix argument is used then kill the buffer too."
(kill-buffer-and-window)
(delete-window)))

(defun spacemacs/ace-delete-window (&optional arg)
"Ace delete window.
If the universal prefix argument is used then kill the buffer too."
(interactive "P")
(require 'ace-window)
(aw-select
" Ace - Delete Window"
(lambda (window)
(when (equal '(4) arg)
(with-selected-window window
(spacemacs/kill-this-buffer arg)))
(aw-delete-window window))))

;; our own implementation of kill-this-buffer from menu-bar.el
(defun spacemacs/kill-this-buffer (&optional arg)
"Kill the current buffer.
Expand All @@ -499,18 +455,6 @@ If the universal prefix argument is used then kill also the window."
(kill-buffer-and-window)
(kill-buffer))))

(defun spacemacs/ace-kill-this-buffer (&optional arg)
"Ace kill visible buffer in a window.
If the universal prefix argument is used then kill also the window."
(interactive "P")
(require 'ace-window)
(let (golden-ratio-mode)
(aw-select
" Ace - Kill buffer in Window"
(lambda (window)
(with-selected-window window
(spacemacs/kill-this-buffer arg))))))

;; found at http://emacswiki.org/emacs/KillingBuffers
(defun spacemacs/kill-other-buffers (&optional arg)
"Kill all other buffers.
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
;;; keybindings.el --- Spacemacs Base Layer key-bindings File
;;; keybindings.el --- Spacemacs Defaults Layer key-bindings File
;;
;; Copyright (c) 2012-2018 Sylvain Benner & Contributors
;;
Expand Down
Loading

2 comments on commit 0fa3658

@punassuming
Copy link
Contributor

@punassuming punassuming commented on 0fa3658 Mar 8, 2018

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is almost exactly how I had everything moved over in my local repo =)

@cormacc
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Was scratching my head over CI failures on all recent pull requests til I saw this :)

Please sign in to comment.