branch: elpa/evil-lisp-state
commit d614275d93416d6f55e72b3c33cc710810aced13
Author: syl20bnr <[email protected]>
Commit: syl20bnr <[email protected]>
Fix byte-compilation for defcustom variable
---
README.md | 3 +++
evil-lisp-state.el | 38 ++++++++++++++++++++++----------------
2 files changed, 25 insertions(+), 16 deletions(-)
diff --git a/README.md b/README.md
index eef8a04f3a..a3f10b172a 100644
--- a/README.md
+++ b/README.md
@@ -69,6 +69,9 @@ whose value is determined by the custom variable
For instance, `sp-forward-slurp-sexp` is performed with `s` and the backward
version `sp-backward-slurp-sexp` with `<tab>s`.
+**Note:** The variable `evil-lisp-state-backward-prefix` must be set before
+requiring `evil-lisp-state`.
+
## Philosophy
`evil-lisp-state` goal is to replace the `normal state` in lisp buffers so
diff --git a/evil-lisp-state.el b/evil-lisp-state.el
index f45cfd055a..c8a8eb159c 100644
--- a/evil-lisp-state.el
+++ b/evil-lisp-state.el
@@ -5,7 +5,7 @@
;; Author: Sylvain Benner <[email protected]>
;; Keywords: convenience editing evil smartparens lisp mnemonic
;; Created: 9 Oct 2014
-;; Version: 4.2.2
+;; Version: 4.2.3
;; Package-Requires: ((evil "1.0.9") (smartparens "1.6.1"))
;; URL: https://github.com/syl20bnr/evil-lisp-state
@@ -56,6 +56,13 @@
;; - `J` go to next sexp one level down
;; - `K` go to previous one level up
+;; Configuration:
+;; --------------
+
+;; Backward prefix can be changed by setting the variable
+;; `evil-lisp-state-backward-prefix'
+;; It must be set before requiring evil-lisp-state.
+
;; Example Configuration:
;; ----------------------
@@ -86,11 +93,11 @@
:group 'emulations
:prefix 'evil-lisp-state-)
-;;;###autoload
-(defcustom evil-lisp-state-backward-prefix "<tab>"
- "Prefix to execute the backward version of a command"
- :type 'string
- :group 'evil-lisp-state)
+(eval-and-compile
+ (defcustom evil-lisp-state-backward-prefix "<tab>"
+ "Prefix to execute the backward version of a command"
+ :type 'string
+ :group 'evil-lisp-state))
(defmacro evil-lisp-state-define-key (key command &optional backward)
"Define a key binding for KEY and COMMAND.
@@ -98,17 +105,16 @@
If BACKWARD is not nil then a binding is also created for backward version
of COMMAND.
The backward binding is prepended with `evil-lisp-state-backward-prefix'"
- (let ((backward-prefix evil-lisp-state-backward-prefix))
`(let* ((cmdstr ,(symbol-name command))
- (cmdsym (intern (format "sp-%s" cmdstr))))
- (define-key evil-lisp-state-map ,key cmdsym)
- (if ,backward
- (let* ((bcmdstr (if (string-match "forward" cmdstr)
- (replace-regexp-in-string "forward" "backward"
cmdstr)
- (concat "backward-" cmdstr)))
- (bcmdsym (intern (format "sp-%s" bcmdstr)))
- (bkey ,(concat backward-prefix key)))
- (define-key evil-lisp-state-map (kbd bkey) bcmdsym))))))
+ (cmdsym (intern (format "sp-%s" cmdstr))))
+ (define-key evil-lisp-state-map ,key cmdsym)
+ (if ,backward
+ (let* ((bcmdstr (if (string-match "forward" cmdstr)
+ (replace-regexp-in-string "forward" "backward"
cmdstr)
+ (concat "backward-" cmdstr)))
+ (bcmdsym (intern (format "sp-%s" bcmdstr)))
+ (bkey ,(concat evil-lisp-state-backward-prefix key)))
+ (define-key evil-lisp-state-map (kbd bkey) bcmdsym)))))
;; regular normal state key bindings
(define-key evil-lisp-state-map "1" 'digit-argument)