Skip to content

Commit

Permalink
Merge remote-tracking branch 'upstream/develop' into the-big-pull
Browse files Browse the repository at this point in the history
  • Loading branch information
JAremko committed Mar 25, 2016
2 parents b9d0869 + 35b314f commit b000bb4
Show file tree
Hide file tree
Showing 218 changed files with 2,687 additions and 1,862 deletions.
5 changes: 2 additions & 3 deletions CHANGELOG.next
Original file line number Diff line number Diff line change
Expand Up @@ -110,7 +110,7 @@ This file containes the change log for the next major version of Spacemacs.
location in the line)
- ~SPC j $~ to go to the end of line (and set a mark at the previous location
in the line)
- ~SPC j b~ to jump to a bookmark
- ~SPC j b~ to undo a jump (go back to previous location)
- ~SPC j d~ to jump to a listing of the current directory
- ~SPC j D~ to jump to a listing of the current directory (other window)
- ~SPC j f~ to jump to the definition of the function around point
Expand All @@ -123,8 +123,7 @@ This file containes the change log for the next major version of Spacemacs.
- ~SPC j n~ to split the current line at point, insert a new line and auto-indent
- ~SPC j s~ to split a quoted string or s-expression in place
- ~SPC j S~ to split a quoted string or s-expression, insert a new line and auto-indent
- ~SPC j u~ to undo a jump (go back to previous location)
- ~SPC j U~ to jump to a URL in the current buffer
- ~SPC j u~ to jump to a URL in the current buffer
- ~SPC j v~ to jump to the definition/declaration of the variable around point
- ~SPC j w~ to jump to a word in the current buffer (works as an evil motion)
(thanks to justbur)
Expand Down
4 changes: 4 additions & 0 deletions CONTRIBUTING.org
Original file line number Diff line number Diff line change
Expand Up @@ -154,6 +154,10 @@ Contributed configuration layers are stored in the =layers/= folder. The
=layers/= folder also contains categories prefixed with =+= to put your layers
in. For example a layer for a language would go in the =layers/+lang/= folder.

Layer with no associated configuration will be rejected. For instance a layer
with just a package and a hook can be easily replace by the usage of the
variable =dotspacemacs-additional-packages=.

*** File header
The file header for =elisp= files should look like the following template:

Expand Down
38 changes: 18 additions & 20 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,21 +3,19 @@
***
<p align="center"><img src="/doc/img/title2.png" alt="Spacemacs"/></p>
<p align="center">
<b><a href="doc/DOCUMENTATION.org#core-pillars">philosophy</a></b>
<b><a href="http://spacemacs.org/doc/DOCUMENTATION#orgheadline5">philosophy</a></b>
|
<b><a href="doc/DOCUMENTATION.org#goals">goals</a></b>
<b><a href="http://spacemacs.org/doc/DOCUMENTATION#orgheadline8">for whom?</a></b>
|
<b><a href="doc/DOCUMENTATION.org#user-content-who-can-benefit-from-this">for whom?</a></b>
<b><a href="http://spacemacs.org/doc/DOCUMENTATION#orgheadline7">screenshots</a></b>
|
<b><a href="doc/DOCUMENTATION.org#screenshots">screenshots</a></b>
|
<b><a href="doc/DOCUMENTATION.org">documentation</a></b>
<b><a href="http://spacemacs.org/doc/DOCUMENTATION">documentation</a></b>
|
<b><a href="CONTRIBUTING.org">contribute</a></b>
|
<b><a href="doc/DOCUMENTATION.org#achievements">achievements</a></b>
<b><a href="http://spacemacs.org/doc/DOCUMENTATION#orgheadline187">achievements</a></b>
|
<b><a href="doc/FAQ.org">FAQ</a></b>
<b><a href="http://spacemacs.org/doc/FAQ">FAQ</a></b>
</p>
***
<p align="center">
Expand Down Expand Up @@ -134,8 +132,9 @@ XEmacs is an old fork of Emacs. The X in its name is unrelated to X11.
Both Emacs and XEmacs have graphical support.

**Note:** Ubuntu LTS 12.04 and 14.04 repositories have only Emacs 24.3
available. You are advised to [build from source](https://www.gnu.org/software/emacs/manual/html_node/efaq/Installing-Emacs.html) Emacs 24.4 or greater, as most packages require
this version. The same may be true for other distributions as well.
available. You are advised to [build from source][build_source] Emacs 24.4 or
greater, as most packages require this version. The same may be true for other
distributions as well.

### OS X

Expand Down Expand Up @@ -227,8 +226,7 @@ For efficient searches we recommend to install `pt` ([the platinum searcher][]).
4. Restart Emacs to complete the installation.
If the mode-line turns red then be sure to visit the
[troubleshooting][troubleshoot] guide and consult the [FAQ][FAQ.org].
If the mode-line turns red then be sure to consult the [FAQ][FAQ.org].
## Installation alongside another configuration
Expand Down Expand Up @@ -372,14 +370,13 @@ Thank you!

[Twitter]: http://i.imgur.com/tXSoThF.png
[CONTRIBUTING.org]: CONTRIBUTING.org
[CONVENTIONS.org]: doc/CONVENTIONS.org
[DOCUMENTATION.org]: doc/DOCUMENTATION.org
[QUICK_START.org]: doc/QUICK_START.org
[FAQ.org]: doc/FAQ.org
[VIMUSERS.org]: doc/VIMUSERS.org
[dotfile]: doc/DOCUMENTATION.org#dotfile-configuration
[troubleshoot]: doc/DOCUMENTATION.org#troubleshoot
[osx layer]: layers/osx/README.org
[CONVENTIONS.org]: http://spacemacs.org/doc/CONVENTIONS
[DOCUMENTATION.org]: http://spacemacs.org/doc/DOCUMENTATION
[QUICK_START.org]: http://spacemacs.org/doc/QUICK_START
[FAQ.org]: http://spacemacs.org/doc/FAQ
[VIMUSERS.org]: http://spacemacs.org/doc/VIMUSERS
[dotfile]: http://spacemacs.org/doc/DOCUMENTATION#orgheadline45
[osx layer]: http://spacemacs.org/layers/osx/README
[Gitter Chat]: https://gitter.im/syl20bnr/spacemacs
[Gitter Chat IRC server]: https://irc.gitter.im/
[emacs-mac-port]: https://github.com/railwaycat/homebrew-emacsmacport
Expand All @@ -395,4 +392,5 @@ Thank you!
[Stack Exchange]: http://emacs.stackexchange.com/questions/tagged/spacemacs
[Reddit]: https://www.reddit.com/r/spacemacs
[quote01]: https://gitter.im/syl20bnr/spacemacs?at=568e627a0cdaaa62045a7df6
[build_source]: https://www.gnu.org/software/emacs/manual/html_node/efaq/Installing-Emacs.html
[Bountysource]: https://salt.bountysource.com/teams/spacemacs
149 changes: 90 additions & 59 deletions core/core-configuration-layer.el
Original file line number Diff line number Diff line change
Expand Up @@ -8,10 +8,6 @@
;; This file is not part of GNU Emacs.
;;
;;; License: GPLv3
;;
;;; Commentary:
;;
;;; Code:

(require 'cl-lib)
(require 'eieio)
Expand Down Expand Up @@ -281,26 +277,40 @@ refreshed during the current session."
(package-read-all-archive-contents)
(unless quiet (spacemacs-buffer/append "\n")))))

(defun configuration-layer/sync ()
"Synchronize declared layers in dotfile with spacemacs."
(defun configuration-layer/sync (&optional no-install)
"Synchronize declared layers in dotfile with spacemacs.
If NO-INSTALL is non nil then install steps are skipped."
(dotspacemacs|call-func dotspacemacs/layers "Calling dotfile layers...")
(when (spacemacs-buffer//choose-banner)
(spacemacs-buffer//inject-version t))
;; layers
(setq configuration-layer--layers (configuration-layer//declare-layers))
(configuration-layer//configure-layers configuration-layer--layers)
(when dotspacemacs-enable-lazy-installation
(configuration-layer/load-auto-layer-file))
;; packages
(setq configuration-layer--packages (configuration-layer//declare-packages
configuration-layer--layers))
(setq configuration-layer--used-distant-packages
(configuration-layer//get-distant-used-packages
configuration-layer--packages))
(configuration-layer//install-packages
(configuration-layer/filter-objects configuration-layer--used-distant-packages
(lambda (x) (not (oref x :lazy-install)))))
(configuration-layer//configure-packages configuration-layer--packages)
(when dotspacemacs-delete-orphan-packages
(configuration-layer/delete-orphan-packages configuration-layer--packages)))
(unless no-install
(configuration-layer//install-packages
(configuration-layer/filter-objects
configuration-layer--used-distant-packages
(lambda (x)
(not (oref x :lazy-install)))))
(configuration-layer//configure-packages configuration-layer--packages)
(when dotspacemacs-delete-orphan-packages
(configuration-layer/delete-orphan-packages
configuration-layer--packages))))

(defun configuration-layer/load-auto-layer-file ()
"Load `auto-layer.el' file"
(let ((file (concat configuration-layer-directory "auto-layer.el")))
(when (file-exists-p file)
(spacemacs-buffer/message "Loading auto-layer file...")
(load-file file))))

(defun configuration-layer/create-layer ()
"Ask the user for a configuration layer name and the layer
Expand Down Expand Up @@ -369,17 +379,18 @@ layer directory."
"Make `cfgl-layer' objects from the passed layer SYMBOLS."
(delq nil (mapcar 'configuration-layer/make-layer symbols)))

(defun configuration-layer/make-package (pkg &optional obj)
(defun configuration-layer/make-package (pkg &optional obj togglep)
"Return a `cfgl-package' object based on PKG.
If OBJ is non nil then copy PKG properties into OBJ, otherwise create
a new object.
Properties that can be copied are `:location', `:step' and `:excluded'."
Properties that can be copied are `:location', `:step' and `:excluded'.
If TOGGLEP is non nil then `:toggle' parameter is ignored."
(let* ((name-sym (if (listp pkg) (car pkg) pkg))
(name-str (symbol-name name-sym))
(location (when (listp pkg) (plist-get (cdr pkg) :location)))
(step (when (listp pkg) (plist-get (cdr pkg) :step)))
(excluded (when (listp pkg) (plist-get (cdr pkg) :excluded)))
(toggle (when (listp pkg) (plist-get (cdr pkg) :toggle)))
(toggle (when (and togglep (listp pkg)) (plist-get (cdr pkg) :toggle)))
(protected (when (listp pkg) (plist-get (cdr pkg) :protected)))
(copyp (not (null obj)))
(obj (if obj obj (cfgl-package name-str :name name-sym))))
Expand Down Expand Up @@ -602,23 +613,30 @@ Properties that can be copied are `:location', `:step' and `:excluded'."
name pkg-name)))
(post-init-func (intern (format "%S/post-init-%S"
name pkg-name)))
(ownerp (fboundp init-func))
(obj (object-assoc pkg-name :name result)))
(cl-pushnew pkg-name (oref layer :packages))
(if obj
(setq obj (configuration-layer/make-package pkg obj))
(setq obj (configuration-layer/make-package pkg))
(setq obj (configuration-layer/make-package pkg obj ownerp))
(setq obj (configuration-layer/make-package pkg nil ownerp))
(push obj result))
(oset obj :lazy-install lazy-install)
(when (fboundp init-func)
(when ownerp
;; last owner wins over the previous one,
;; still warn about mutliple owners
(when (oref obj :owner)
(spacemacs-buffer/warning
(format (concat "More than one init function found for "
"package %S. Previous owner was %S, "
"replacing it with layer %S.")
pkg (oref obj :owner) name)))
pkg-name (oref obj :owner) name)))
(oset obj :owner name))
(when (and (not ownerp)
(listp pkg)
(spacemacs/mplist-get pkg :toggle))
(spacemacs-buffer/warning
(format (concat "Ignoring :toggle for package %s because "
"layer %S does not own it.") pkg-name name)))
(when (fboundp pre-init-func)
(push name (oref obj :pre-layers)))
(when (fboundp post-init-func)
Expand All @@ -629,8 +647,8 @@ Properties that can be copied are `:location', `:step' and `:excluded'."
(let* ((pkg-name (if (listp pkg) (car pkg) pkg))
(obj (object-assoc pkg-name :name result)))
(if obj
(setq obj (configuration-layer/make-package pkg obj))
(setq obj (configuration-layer/make-package pkg))
(setq obj (configuration-layer/make-package pkg obj t))
(setq obj (configuration-layer/make-package pkg nil t))
(push obj result)
(oset obj :owner 'dotfile))))
(dolist (xpkg dotspacemacs-excluded-packages)
Expand All @@ -649,23 +667,24 @@ Properties that can be copied are `:location', `:step' and `:excluded'."
(defun configuration-layer/lazy-install (layer-name &rest props)
"Configure auto-installation of layer with name LAYER-NAME."
(declare (indent 1))
(when dotspacemacs-enable-lazy-installation
(let ((layer (object-assoc layer-name :name configuration-layer--layers))
(extensions (spacemacs/mplist-get props :extensions)))
(oset layer :lazy-install t)
(dolist (x extensions)
(let ((ext (car x))
(mode (cadr x)))
(add-to-list 'configuration-layer--lazy-mode-alist (cons mode ext))
(add-to-list
'auto-mode-alist
`(,ext . (lambda ()
(configuration-layer//auto-mode
',layer-name ',mode)))))))))
(let ((extensions (spacemacs/mplist-get props :extensions)))
(when (configuration-layer/layer-usedp layer-name)
(let ((layer (object-assoc layer-name
:name configuration-layer--layers)))
(oset layer :lazy-install t)))
(dolist (x extensions)
(let ((ext (car x))
(mode (cadr x)))
(add-to-list 'configuration-layer--lazy-mode-alist (cons mode ext))
(add-to-list
'auto-mode-alist
`(,ext . (lambda ()
(configuration-layer//auto-mode
',layer-name ',mode))))))))

(defun configuration-layer//auto-mode (layer-name mode)
"Auto mode support of lazily installed layers."
(when (configuration-layer//lazy-install-packages layer-name)
(when (configuration-layer//lazy-install-packages layer-name mode)
(funcall mode)))

(defun configuration-layer/filter-objects (objects ffunc)
Expand Down Expand Up @@ -951,24 +970,32 @@ path."
(format (concat "\nAn error occurred while installing %s "
"(error: %s)\n") pkg-name err)))))))

(defun configuration-layer//lazy-install-packages (layer-name)
"Install packages of a lazily installed layer.
(defun configuration-layer//lazy-install-p (layer-name)
"Return non nil if the layer with LAYER-NAME should be lazy installed."
(or (not (memq layer-name configuration-layer--layers))
(let ((layer (object-assoc layer-name :name configuration-layer--layers)))
(oref layer :lazy-install))))

(defun configuration-layer//lazy-install-packages (layer-name mode)
"Install layer with LAYER-NAME to support MODE.
Returns non-nil if the packages have been installed."
(let* ((layer (object-assoc layer-name :name configuration-layer--layers))
(packages (delq nil (mapcar (lambda (x)
(object-assoc
x :name configuration-layer--packages))
(oref layer :packages))))
(pkg-count (length packages)))
(when (and (oref layer :lazy-install)
(yes-or-no-p (format
(concat "Support for %s requires installation of "
"%s package(s), do you want to install?")
layer-name pkg-count)))
(when (and (configuration-layer//lazy-install-p layer-name)
(yes-or-no-p (format
(concat "Support for %s requires installation of "
"layer %s, do you want to install it?")
mode layer-name)))
(when (dotspacemacs/add-layer layer-name)
(configuration-layer/sync 'no-install))
(let* ((layer (object-assoc layer-name :name configuration-layer--layers))
(packages (delq nil
(mapcar (lambda (x)
(object-assoc
x :name configuration-layer--packages))
(oref layer :packages)))))
(configuration-layer//install-packages packages)
(configuration-layer//configure-packages packages)
(oset layer :lazy-install nil))
(not (oref layer :lazy-install))))
t))

(defun configuration-layer//install-packages (packages)
"Install PACKAGES which are not lazy installed."
Expand Down Expand Up @@ -1566,28 +1593,32 @@ to select one."
(when ext (push (cons mode ext) result)))))
result))

(defun configuration-layer//insert-lazy-install-form (mode ext)
(defun configuration-layer//insert-lazy-install-form (layer-name mode ext)
"Insert a configuration form for lazy installation of MODE."
(let ((str (concat "(configuration-layer/lazy-install '"
(symbol-name mode)
(symbol-name layer-name)
" :extensions '("
(let ((print-quoted t)) (prin1-to-string ext))
" "
(symbol-name mode)
"))\n")))
(insert str)))

(defun configuration-layer/insert-lazy-install-configuration ()
"Prompt for a layer and insert the forms to configure lazy installation."
(interactive)
(let ((layer-sym
(completing-read
"Choose a used layer"
(sort (object-assoc-list :name configuration-layer--layers)
(lambda (x y)
(string< (oref (cdr x) :name) (oref (cdr y) :name)))))))
(let ((layer-name
(intern (completing-read
"Choose a used layer"
(sort (object-assoc-list :name configuration-layer--layers)
(lambda (x y)
(string< (oref (cdr x) :name)
(oref (cdr y) :name))))))))
(let ((mode-exts (configuration-layer//lazy-install-extensions-for-layer
(intern layer-sym))))
layer-name)))
(dolist (x mode-exts)
(configuration-layer//insert-lazy-install-form (car x) (cdr x))))))
(configuration-layer//insert-lazy-install-form
layer-name (car x) (cdr x))))))

(defun configuration-layer//increment-error-count ()
"Increment the error counter."
Expand Down
6 changes: 4 additions & 2 deletions core/core-documentation.el
Original file line number Diff line number Diff line change
Expand Up @@ -20,8 +20,10 @@
(defvar spacemacs--category-names
'(("config-files" . "Configuration files")
("email" . "E-mail")
("irc" . "IRC")
("lang" . "Programming and markup languages"))
("intl" . "International support")
("lang" . "Programming and markup languages")
("os" . "Operating systems")
("spacemacs" . "Spacemacs distribution layers"))
"Special names for categories. Used to generate the layers list.")

(defun spacemacs//generate-layers-from-path (path level)
Expand Down
Loading

0 comments on commit b000bb4

Please sign in to comment.