Move evil-cleverparens to spacemacs-evil with major mode toggle
Delete layer evil-cleverparens and move the package to spacemacs-evil layer. The feature is called "Safe structurral editing" for lisp dialects. Support for it is added via pre-init functions in each of the concerned layer and proper documentation is added to their README.org files. This also removes the recently added package evil-smartparens. The goal is to choose the best package for evil safe structural editing. For now we use evil-cleverparens as we supported it first, if evil-smartparens is shown to be a better package we will be able to switch to it.
This commit is contained in:
parent
8bc9060af8
commit
2cb98447af
|
@ -14,6 +14,7 @@
|
|||
- [[#more-details][More details]]
|
||||
- [[#usage][Usage]]
|
||||
- [[#cheatsheet][Cheatsheet]]
|
||||
- [[#structuraly-safe-editing][Structuraly safe editing]]
|
||||
- [[#key-bindings][Key Bindings]]
|
||||
- [[#working-with-clojure-files-barfage-slurpage--more][Working with clojure files (barfage, slurpage & more)]]
|
||||
- [[#leader][Leader]]
|
||||
|
@ -48,6 +49,7 @@ This layer adds support for [[https://clojure.org/][Clojure]] language using [[h
|
|||
- Aligning of code forms via [[https://github.com/clojure-emacs/clojure-mode][clojure-mode]]
|
||||
- Debugging with [[https://bpiel.github.io/sayid/][sayid]]
|
||||
- Clojure cheatsheet
|
||||
- Structuraly safe editing using optional [[https://github.com/luxbock/evil-cleverparens][evil-cleverparens]]
|
||||
|
||||
* Install
|
||||
** Layer
|
||||
|
@ -127,6 +129,28 @@ Type ~SPC m h c~ to display the cheatsheet then type in some terms (space
|
|||
separated) to narrow down the list. For example, try typing in sort map to see
|
||||
some functions that deal with sorting maps.
|
||||
|
||||
** Structuraly safe editing
|
||||
This layer add support for =evil-cleverparens= which allows safely edit
|
||||
lisp code by keeping the s-expressions balanced.
|
||||
|
||||
By default this mode is not activated. You can turn it on locally on a the
|
||||
active buffer with ~SPC m T s~ (=s= for safe).
|
||||
|
||||
To turn it on automatically for all =clojure= buffers call the following
|
||||
function in your =dotspacemacs/user-config= function:
|
||||
|
||||
#+BEGIN_SRC emacs-lisp
|
||||
(spacemacs/toggle-evil-safe-lisp-structural-editing-on-register-hook-clojure-mode)
|
||||
#+END_SRC
|
||||
|
||||
or to enable it for all supported modes:
|
||||
|
||||
#+BEGIN_SRC emacs-lisp
|
||||
(spacemacs/toggle-evil-safe-lisp-structural-editing-on-register-hooks)
|
||||
#+END_SRC
|
||||
|
||||
When enabled the symbol =🆂= should be displayed in the mode-line.
|
||||
|
||||
* Key Bindings
|
||||
** Working with clojure files (barfage, slurpage & more)
|
||||
Spacemacs comes with a special =lisp-state= for working with lisp code that
|
||||
|
|
|
@ -19,6 +19,7 @@
|
|||
(clojure-snippets :toggle (configuration-layer/layer-used-p 'auto-completion))
|
||||
company
|
||||
eldoc
|
||||
evil-cleverparens
|
||||
ggtags
|
||||
counsel-gtags
|
||||
helm-gtags
|
||||
|
@ -310,6 +311,11 @@
|
|||
(add-hook 'cider-repl-mode-hook 'eldoc-mode)
|
||||
(add-hook 'cider-clojure-interaction-mode-hook 'eldoc-mode))
|
||||
|
||||
(defun clojure/pre-init-evil-cleverparens ()
|
||||
(spacemacs|use-package-add-hook evil-cleverparens
|
||||
:pre-init
|
||||
(add-to-list 'evil-lisp-safe-structural-editing-modes 'clojure-mode)))
|
||||
|
||||
(defun clojure/pre-init-popwin ()
|
||||
(spacemacs|use-package-add-hook popwin
|
||||
:post-config
|
||||
|
|
|
@ -4,7 +4,9 @@
|
|||
|
||||
* Table of Contents :TOC_4_gh:noexport:
|
||||
- [[#description][Description]]
|
||||
- [[#features][Features:]]
|
||||
- [[#install][Install]]
|
||||
- [[#structuraly-safe-editing][Structuraly safe editing]]
|
||||
- [[#key-bindings][Key Bindings]]
|
||||
- [[#working-with-lisp-files-barfage-slurpage--more][Working with lisp files (barfage, slurpage & more)]]
|
||||
- [[#leader][Leader]]
|
||||
|
@ -18,6 +20,9 @@
|
|||
* Description
|
||||
A Spacemacs layer providing Common Lisp support via [[https://github.com/slime/slime][SLIME]].
|
||||
|
||||
** Features:
|
||||
- Structuraly safe editing using optional [[https://github.com/luxbock/evil-cleverparens][evil-cleverparens]]
|
||||
|
||||
* Install
|
||||
If you have previously installed slime in any other way, it is recommended that
|
||||
you uninstall it before proceeding. You should clean up any config files tied to
|
||||
|
@ -36,6 +41,28 @@ of Common Lisp, you can specify it in your =~/.spacemacs=
|
|||
(setq inferior-lisp-program "/path/to/your/lisp"))
|
||||
#+END_SRC
|
||||
|
||||
* Structuraly safe editing
|
||||
This layer add support for =evil-cleverparens= which allows safely edit
|
||||
lisp code by keeping the s-expressions balanced.
|
||||
|
||||
By default this mode is not activated. You can turn it on locally on a the
|
||||
active buffer with ~SPC m T s~ (=s= for safe).
|
||||
|
||||
To turn it on automatically for all =common-lisp= buffers call the following
|
||||
function in your =dotspacemacs/user-config= function:
|
||||
|
||||
#+BEGIN_SRC emacs-lisp
|
||||
(spacemacs/toggle-evil-safe-lisp-structural-editing-on-register-hook-common-lisp-mode)
|
||||
#+END_SRC
|
||||
|
||||
or to enable it for all supported modes:
|
||||
|
||||
#+BEGIN_SRC emacs-lisp
|
||||
(spacemacs/toggle-evil-safe-lisp-structural-editing-on-register-hooks)
|
||||
#+END_SRC
|
||||
|
||||
When enabled the symbol =🆂= should be displayed in the mode-line.
|
||||
|
||||
* Key Bindings
|
||||
** Working with lisp files (barfage, slurpage & more)
|
||||
Spacemacs comes with a special =lisp-state= for working with lisp code that
|
||||
|
|
|
@ -13,6 +13,7 @@
|
|||
'(auto-highlight-symbol
|
||||
(common-lisp-snippets :requires yasnippet)
|
||||
evil
|
||||
evil-cleverparens
|
||||
ggtags
|
||||
counsel
|
||||
helm
|
||||
|
@ -38,6 +39,13 @@
|
|||
ad-do-it)
|
||||
ad-do-it)))
|
||||
|
||||
(defun common-lisp/pre-init-evil-cleverparens ()
|
||||
(spacemacs|use-package-add-hook evil-cleverparens
|
||||
:pre-init
|
||||
(progn
|
||||
(add-to-list 'evil-lisp-safe-structural-editing-modes 'common-lisp-mode)
|
||||
(add-to-list 'evil-lisp-safe-structural-editing-modes 'lisp-mode))))
|
||||
|
||||
(defun common-lisp/post-init-helm ()
|
||||
(spacemacs/set-leader-keys-for-major-mode 'lisp-mode
|
||||
"sI" 'spacemacs/helm-slime))
|
||||
|
|
|
@ -11,6 +11,7 @@
|
|||
- [[#debugging-elisp][Debugging Elisp]]
|
||||
- [[#nameless][Nameless]]
|
||||
- [[#aliases][Aliases]]
|
||||
- [[#structuraly-safe-editing][Structuraly safe editing]]
|
||||
- [[#key-bindings][Key bindings]]
|
||||
- [[#additional-testing-functions-with-overseer][Additional testing functions with overseer]]
|
||||
- [[#additional-evaluation-functions][Additional evaluation functions]]
|
||||
|
@ -29,7 +30,8 @@ always be in your dotfile, it is not recommended to uninstall it.
|
|||
- Auto-compile via [[https://github.com/tarsius/auto-compile][auto-compile]] package
|
||||
- Debuggin via [[https://www.gnu.org/software/emacs/manual/html_node/elisp/Edebug.html#Edebug][edebug]]
|
||||
- Ert test runner with [[https://github.com/tonini/overseer.el][overseer]]
|
||||
- Nameless package prefix with [[https://github.com/Malabarba/Nameless][nameless]]
|
||||
- Nameless package prefix with optional [[https://github.com/Malabarba/Nameless][nameless]]
|
||||
- Structuraly safe editing using optional [[https://github.com/luxbock/evil-cleverparens][evil-cleverparens]]
|
||||
|
||||
* Install
|
||||
To use this configuration layer, add it to your =~/.spacemacs=. You will need to
|
||||
|
@ -126,6 +128,28 @@ dotfile:
|
|||
(add-to-list 'nameless-global-aliases '("N" . "nameless"))
|
||||
#+END_SRC
|
||||
|
||||
* Structuraly safe editing
|
||||
This layer add support for =evil-cleverparens= which allows safely edit
|
||||
lisp code by keeping the s-expressions balanced.
|
||||
|
||||
By default this mode is not activated. You can turn it on locally on a the
|
||||
active buffer with ~SPC m T s~ (=s= for safe).
|
||||
|
||||
To turn it on automatically for all =emacs-lisp= buffers call the following
|
||||
function in your =dotspacemacs/user-config= function:
|
||||
|
||||
#+BEGIN_SRC emacs-lisp
|
||||
(spacemacs/toggle-evil-safe-lisp-structural-editing-on-register-hook-emacs-lisp-mode)
|
||||
#+END_SRC
|
||||
|
||||
or to enable it for all supported modes:
|
||||
|
||||
#+BEGIN_SRC emacs-lisp
|
||||
(spacemacs/toggle-evil-safe-lisp-structural-editing-on-register-hooks)
|
||||
#+END_SRC
|
||||
|
||||
When enabled the symbol =🆂= should be displayed in the mode-line.
|
||||
|
||||
* Key bindings
|
||||
|
||||
| Key Binding | Description |
|
||||
|
|
|
@ -19,6 +19,7 @@
|
|||
elisp-slime-nav
|
||||
(emacs-lisp :location built-in)
|
||||
evil
|
||||
evil-cleverparens
|
||||
flycheck
|
||||
ggtags
|
||||
counsel-gtags
|
||||
|
@ -227,6 +228,11 @@
|
|||
(lambda ()
|
||||
(spacemacs|define-text-object ";" "elisp-comment" ";; " ""))))
|
||||
|
||||
(defun emacs-lisp/pre-init-evil-cleverparens ()
|
||||
(spacemacs|use-package-add-hook evil-cleverparens
|
||||
:pre-init
|
||||
(add-to-list 'evil-lisp-safe-structural-editing-modes 'emacs-lisp-mode)))
|
||||
|
||||
(defun emacs-lisp/post-init-flycheck ()
|
||||
;; Don't activate flycheck by default in elisp
|
||||
;; because of too much false warnings
|
||||
|
|
|
@ -6,6 +6,7 @@
|
|||
- [[#description][Description]]
|
||||
- [[#features][Features:]]
|
||||
- [[#install][Install]]
|
||||
- [[#structuraly-safe-editing][Structuraly safe editing]]
|
||||
- [[#key-bindings][Key Bindings]]
|
||||
- [[#navigation][Navigation]]
|
||||
- [[#documentation][Documentation]]
|
||||
|
@ -17,10 +18,11 @@
|
|||
Adds support for the [[http://racket-lang.org/][Racket]] programming language.
|
||||
|
||||
** Features:
|
||||
- Syntax highlighting with =racket-mode=
|
||||
- Test runner
|
||||
- Interactive REPL
|
||||
- Code navigation with =gtags=
|
||||
- Syntax highlighting with =racket-mode=
|
||||
- Test runner
|
||||
- Interactive REPL
|
||||
- Code navigation with =gtags=
|
||||
- Structuraly safe editing using optional [[https://github.com/luxbock/evil-cleverparens][evil-cleverparens]]
|
||||
|
||||
* Install
|
||||
To use this configuration layer, add it to your =~/.spacemacs=. You will need to
|
||||
|
@ -32,6 +34,28 @@ file. You will also need DrRacket installed. Alternatively, one can use the
|
|||
raco pkg install drracket
|
||||
#+END_SRC
|
||||
|
||||
* Structuraly safe editing
|
||||
This layer add support for =evil-cleverparens= which allows safely edit
|
||||
lisp code by keeping the s-expressions balanced.
|
||||
|
||||
By default this mode is not activated. You can turn it on locally on a the
|
||||
active buffer with ~SPC m T s~ (=s= for safe).
|
||||
|
||||
To turn it on automatically for all =racket= buffers call the following
|
||||
function in your =dotspacemacs/user-config= function:
|
||||
|
||||
#+BEGIN_SRC emacs-lisp
|
||||
(spacemacs/toggle-evil-safe-lisp-structural-editing-on-register-hook-racket-mode)
|
||||
#+END_SRC
|
||||
|
||||
or to enable it for all supported modes:
|
||||
|
||||
#+BEGIN_SRC emacs-lisp
|
||||
(spacemacs/toggle-evil-safe-lisp-structural-editing-on-register-hooks)
|
||||
#+END_SRC
|
||||
|
||||
When enabled the symbol =🆂= should be displayed in the mode-line.
|
||||
|
||||
* Key Bindings
|
||||
** Navigation
|
||||
|
||||
|
|
|
@ -4,6 +4,7 @@
|
|||
company-quickhelp
|
||||
ggtags
|
||||
counsel-gtags
|
||||
evil-cleverparens
|
||||
helm-gtags
|
||||
racket-mode
|
||||
))
|
||||
|
@ -29,6 +30,11 @@
|
|||
(defun racket/post-init-counsel-gtags ()
|
||||
(spacemacs/counsel-gtags-define-keys-for-mode 'racket-mode))
|
||||
|
||||
(defun racket/pre-init-evil-cleverparens ()
|
||||
(spacemacs|use-package-add-hook evil-cleverparens
|
||||
:pre-init
|
||||
(add-to-list 'evil-lisp-safe-structural-editing-modes 'racket-mode)))
|
||||
|
||||
(defun racket/post-init-helm-gtags ()
|
||||
(spacemacs/helm-gtags-define-keys-for-mode 'racket-mode))
|
||||
|
||||
|
|
|
@ -4,6 +4,7 @@
|
|||
- [[#description][Description]]
|
||||
- [[#features][Features:]]
|
||||
- [[#install][Install]]
|
||||
- [[#structuraly-safe-editing][Structuraly safe editing]]
|
||||
- [[#key-bindings][Key Bindings]]
|
||||
- [[#compiling][Compiling]]
|
||||
- [[#navigation][Navigation]]
|
||||
|
@ -19,6 +20,7 @@ This layer adds support for Scheme via [[http://www.nongnu.org/geiser/][Geiser]]
|
|||
** Features:
|
||||
- Support the Scheme compiler [[https://www.call-cc.org/][Chicken]]
|
||||
- Support for the extension language platform [[https://www.gnu.org/software/guile/][Guile]]
|
||||
- Structuraly safe editing using optional [[https://github.com/luxbock/evil-cleverparens][evil-cleverparens]]
|
||||
|
||||
* Install
|
||||
To use this configuration layer, add it to your =~/.spacemacs=. You will need to
|
||||
|
@ -33,6 +35,28 @@ For full Chicken support, the following commands should be run:
|
|||
$ curl https://3e8.org/pub/chicken-doc/chicken-doc-repo.tgz | sudo tar zx
|
||||
#+END_SRC
|
||||
|
||||
* Structuraly safe editing
|
||||
This layer add support for =evil-cleverparens= which allows safely edit
|
||||
lisp code by keeping the s-expressions balanced.
|
||||
|
||||
By default this mode is not activated. You can turn it on locally on a the
|
||||
active buffer with ~SPC m T s~ (=s= for safe).
|
||||
|
||||
To turn it on automatically for all =scheme= buffers call the following
|
||||
function in your =dotspacemacs/user-config= function:
|
||||
|
||||
#+BEGIN_SRC emacs-lisp
|
||||
(spacemacs/toggle-evil-safe-lisp-structural-editing-on-register-hook-scheme-mode)
|
||||
#+END_SRC
|
||||
|
||||
or to enable it for all supported modes:
|
||||
|
||||
#+BEGIN_SRC emacs-lisp
|
||||
(spacemacs/toggle-evil-safe-lisp-structural-editing-on-register-hooks)
|
||||
#+END_SRC
|
||||
|
||||
When enabled the symbol =🆂= should be displayed in the mode-line.
|
||||
|
||||
* Key Bindings
|
||||
** Compiling
|
||||
|
||||
|
|
|
@ -12,6 +12,7 @@
|
|||
(setq scheme-packages
|
||||
'(
|
||||
company
|
||||
evil-cleverparens
|
||||
geiser
|
||||
ggtags
|
||||
counsel-gtags
|
||||
|
@ -22,6 +23,11 @@
|
|||
;; Geiser provides completion as long as company mode is loaded.
|
||||
(spacemacs|add-company-backends :modes scheme-mode))
|
||||
|
||||
(defun scheme/pre-init-evil-cleverparens ()
|
||||
(spacemacs|use-package-add-hook evil-cleverparens
|
||||
:pre-init
|
||||
(add-to-list 'evil-lisp-safe-structural-editing-modes 'scheme-mode)))
|
||||
|
||||
(defun scheme/init-geiser ()
|
||||
(use-package geiser
|
||||
:commands run-geiser
|
||||
|
|
|
@ -25,7 +25,6 @@
|
|||
(origami :toggle (eq 'origami dotspacemacs-folding-method))
|
||||
password-generator
|
||||
smartparens
|
||||
(evil-smartparens :toggle dotspacemacs-smartparens-strict-mode)
|
||||
(spacemacs-whitespace-cleanup :location local)
|
||||
string-inflection
|
||||
undo-tree
|
||||
|
@ -275,16 +274,6 @@
|
|||
"ipp" 'password-generator-phonetic
|
||||
"ipn" 'password-generator-numeric))))
|
||||
|
||||
(defun spacemacs-editing/init-evil-smartparens ()
|
||||
(use-package evil-smartparens
|
||||
:defer t
|
||||
:init
|
||||
(progn
|
||||
(when dotspacemacs-smartparens-strict-mode
|
||||
(spacemacs/add-to-hooks 'evil-smartparens-mode '(prog-mode-hook comint-mode-hook))))
|
||||
:config
|
||||
(spacemacs|diminish evil-smartparens-mode)))
|
||||
|
||||
(defun spacemacs-editing/init-smartparens ()
|
||||
(use-package smartparens
|
||||
:defer t
|
||||
|
|
|
@ -0,0 +1,14 @@
|
|||
;;; config.el --- Spacemacs-evil Layer Configuration File for Spacemacs
|
||||
;;
|
||||
;; Copyright (c) 2012-2017 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
|
||||
|
||||
|
||||
(defvar evil-lisp-safe-structural-editing-modes '()
|
||||
"A list of major mode symbols where safe structural editing is supported.")
|
|
@ -12,6 +12,7 @@
|
|||
(setq spacemacs-evil-packages
|
||||
'(evil-anzu
|
||||
evil-args
|
||||
evil-cleverparens
|
||||
evil-ediff
|
||||
evil-exchange
|
||||
evil-iedit-state
|
||||
|
@ -69,6 +70,21 @@
|
|||
(define-key evil-inner-text-objects-map "a" 'evil-inner-arg)
|
||||
(define-key evil-outer-text-objects-map "a" 'evil-outer-arg))))
|
||||
|
||||
(defun spacemacs-evil/init-evil-cleverparens ()
|
||||
(use-package evil-cleverparens
|
||||
:defer t
|
||||
:init
|
||||
(progn
|
||||
(setq evil-cleverparens-use-regular-insert t)
|
||||
(eval `(spacemacs|add-toggle evil-safe-lisp-structural-editing
|
||||
:if (memq dotspacemacs-editing-style '(vim hybrid))
|
||||
:mode evil-cleverparens-mode
|
||||
:documentation "Enable evil-cleverparens."
|
||||
:evil-leader-for-mode
|
||||
,@(mapcar (lambda (x) (cons x "Ts"))
|
||||
evil-lisp-safe-structural-editing-modes)))
|
||||
(spacemacs|diminish evil-cleverparens-mode " 🆂" " [s]"))))
|
||||
|
||||
(defun spacemacs-evil/init-evil-ediff ()
|
||||
(use-package evil-ediff
|
||||
:after (ediff)
|
||||
|
|
|
@ -1,23 +0,0 @@
|
|||
#+TITLE: Evil-Cleverparens layer
|
||||
|
||||
* Table of Contents :TOC_4_gh:noexport:
|
||||
- [[#description][Description]]
|
||||
- [[#install][Install]]
|
||||
|
||||
* Description
|
||||
This simple layer adds the [[https://github.com/luxbock/evil-cleverparens][evil-cleverparens]] package, which overrides common
|
||||
normal-mode vim commands like D, dd, c, etc. to keep parentheses balanced. See
|
||||
the repository for more details.
|
||||
|
||||
* Install
|
||||
To use this configuration layer, add it to your =~/.spacemacs=. You will need to
|
||||
add =evil-cleverparens= to the existing =dotspacemacs-configuration-layers= list
|
||||
in this file.
|
||||
|
||||
Then enable it in your =user-config= function and add your desired hooks, for
|
||||
example:
|
||||
|
||||
#+BEGIN_SRC emacs-lisp
|
||||
(spacemacs/toggle-evil-cleverparens-on)
|
||||
(add-hook 'clojure-mode-hook #'evil-cleverparens-mode)
|
||||
#+END_SRC
|
|
@ -1,24 +0,0 @@
|
|||
;;; packages.el --- evil-cleverparens Layer packages File for Spacemacs
|
||||
;;
|
||||
;; Copyright (c) 2012-2017 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
|
||||
|
||||
(setq evil-cleverparens-packages
|
||||
'(evil-cleverparens))
|
||||
|
||||
(defun evil-cleverparens/init-evil-cleverparens ()
|
||||
(use-package evil-cleverparens
|
||||
:defer t
|
||||
:init
|
||||
(progn
|
||||
(setq evil-cleverparens-use-regular-insert t)
|
||||
(spacemacs|add-toggle evil-cleverparens
|
||||
:mode evil-cleverparens-mode
|
||||
:documentation "Enable evil-cleverparens."))
|
||||
:config (spacemacs|hide-lighter evil-cleverparens-mode)))
|
Loading…
Reference in New Issue