branch: elpa/evil
commit 759392a1cd8c90c27a2ecc67d3e65f752452e33f
Author: Axel Forsman <axels...@gmail.com>
Commit: Axel Forsman <axels...@gmail.com>

    Autoload evil-digraph
---
 evil-commands.el                | 157 ++++++++++++++++------------------------
 evil-common.el                  |  40 +++++-----
 evil-core.el                    |  73 +++++++++----------
 evil-digraphs.el                |  16 ++--
 evil-macros.el                  |   9 +--
 evil-tests.el                   |   1 +
 evil.el                         |   1 -
 scripts/evil-extract-docstrings |   1 +
 8 files changed, 132 insertions(+), 166 deletions(-)

diff --git a/evil-commands.el b/evil-commands.el
index dd99184936..c3e42d699b 100644
--- a/evil-commands.el
+++ b/evil-commands.el
@@ -24,8 +24,9 @@
 ;; You should have received a copy of the GNU General Public License
 ;; along with Evil.  If not, see <http://www.gnu.org/licenses/>.
 
+;;; Code:
+
 (require 'evil-common)
-(require 'evil-digraphs)
 (require 'evil-search)
 (require 'evil-states)
 (require 'evil-ex)
@@ -50,8 +51,6 @@
 ;; :keep-visual t and :repeat motion; these are automatically
 ;; set by the `evil-define-motion' macro.
 
-;;; Code:
-
 (evil-define-motion evil-forward-char (count &optional crosslines noerror)
   "Move cursor to the right by COUNT characters.
 Movement is restricted to the current line unless CROSSLINES is non-nil.
@@ -73,19 +72,15 @@ of the line or the buffer; just return nil."
          ;; was `evil-next-line' or `evil-previous-line'.
          (setq this-command last-command)
          (unless noerror (signal (car err) (cdr err)))))))
-   (noerror
-    (condition-case nil
-        (evil-forward-char count crosslines nil)
-      (error)))
-   (t
-    (evil-motion-loop (nil (or count 1))
-      (forward-char)
-      ;; don't put the cursor on a newline
-      (and (not evil-move-beyond-eol)
-           (not (evil-visual-state-p))
-           (not (evil-operator-state-p))
-           (eolp) (not (eobp)) (not (bolp))
-           (forward-char))))))
+   (noerror (ignore-errors (evil-forward-char count crosslines)))
+   (t (evil-motion-loop (nil (or count 1))
+        (forward-char)
+        ;; don't put the cursor on a newline
+        (and (not evil-move-beyond-eol)
+             (not (evil-visual-state-p))
+             (not (evil-operator-state-p))
+             (eolp) (not (eobp)) (not (bolp))
+             (forward-char))))))
 
 (evil-define-motion evil-backward-char (count &optional crosslines noerror)
   "Move cursor to the left by COUNT characters.
@@ -107,16 +102,12 @@ of the line or the buffer; just return nil."
          ;; was `evil-next-line' or `evil-previous-line'.
          (setq this-command last-command)
          (unless noerror (signal (car err) (cdr err)))))))
-   (noerror
-    (condition-case nil
-        (evil-backward-char count crosslines nil)
-      (error nil)))
-   (t
-    (evil-motion-loop (nil (or count 1))
-      (backward-char)
-      ;; don't put the cursor on a newline
-      (unless (or (evil-visual-state-p) (evil-operator-state-p))
-        (evil-adjust-cursor))))))
+   (noerror (ignore-errors (evil-backward-char count crosslines)))
+   (t (evil-motion-loop (nil (or count 1))
+        (backward-char)
+        ;; don't put the cursor on a newline
+        (unless (or (evil-visual-state-p) (evil-operator-state-p))
+          (evil-adjust-cursor))))))
 
 (evil-define-motion evil-next-line (count)
   "Move the cursor COUNT lines down."
@@ -191,17 +182,13 @@ If COUNT is given, move COUNT - 1 lines downward first."
 (evil-define-motion evil-beginning-of-visual-line ()
   "Move the cursor to the first character of the current screen line."
   :type exclusive
-  (if (fboundp 'beginning-of-visual-line)
-      (beginning-of-visual-line)
-    (beginning-of-line)))
+  (beginning-of-visual-line))
 
 (evil-define-motion evil-end-of-visual-line (count)
   "Move the cursor to the last character of the current screen line.
 If COUNT is given, move COUNT - 1 screen lines downward first."
   :type inclusive
-  (if (fboundp 'end-of-visual-line)
-      (end-of-visual-line count)
-    (end-of-line count)))
+  (end-of-visual-line count))
 
 (evil-define-motion evil-end-of-line-or-visual-line (count)
   "Move the cursor to the last character of the current screen
@@ -306,9 +293,8 @@ If called after a change operator, i.e. cw or cW,
 `evil-want-change-word-to-end' is non-nil and point is on a word,
 then both behave like ce or cE.
 
-If point is at the end of the buffer and cannot be moved signal
-'end-of-buffer is raised.
-"
+If point is at the end of the buffer and cannot be moved then
+`end-of-buffer' is signaled."
   :type exclusive
   (let ((thing (if bigword 'evil-WORD 'evil-word))
         (orig (point))
@@ -800,9 +786,8 @@ Columns are counted from zero."
     (cond
      ((markerp marker)
       (switch-to-buffer (marker-buffer marker))
-      (goto-char (marker-position marker)))
-     ((numberp marker)
       (goto-char marker))
+     ((numberp marker) (goto-char marker))
      ((consp marker)
       (when (or (find-buffer-visiting (car marker))
                 (and (y-or-n-p (format "Visit file %s again? "
@@ -874,8 +859,7 @@ for specifying the tag."
       (let ((tag (funcall (or find-tag-default-function
                               (get major-mode 'find-tag-default-function)
                               #'find-tag-default))))
-        (unless tag (user-error "No tag candidate found around point"))
-        (find-tag tag))))))
+        (find-tag (or tag (user-error "No tag found around point"))))))))
 
 (evil-define-motion evil-lookup ()
   "Look up the keyword at point.
@@ -883,10 +867,9 @@ Calls `evil-lookup-func'."
   (funcall evil-lookup-func))
 
 (defun evil-ret-gen (count indent?)
-  (let* ((field  (get-char-property (point) 'field))
-         (button (get-char-property (point) 'button))
-         (doc    (get-char-property (point) 'widget-doc))
-         (widget (or field button doc)))
+  (let ((widget (or (get-char-property (point) 'field)
+                    (get-char-property (point) 'button)
+                    (get-char-property (point) 'widget-doc))))
     (cond
      ((and widget
            (fboundp 'widget-type)
@@ -913,8 +896,7 @@ Calls `evil-lookup-func'."
         (delete-horizontal-space t)
         (newline count)
         (indent-according-to-mode)))
-     (t
-      (evil-next-line-first-non-blank count)))))
+     (t (evil-next-line-first-non-blank count)))))
 
 (evil-define-motion evil-ret (count)
   "Move the cursor COUNT lines down.
@@ -935,10 +917,9 @@ In Insert state, insert a newline and indent."
   :jump t
   :type line
   (evil-ensure-column
-    (move-to-window-line (max (or count 0)
-                              (if (= (point-min) (window-start))
-                                  0
-                                scroll-margin)))))
+    (move-to-window-line
+     (max (or count 0)
+          (if (= (point-min) (window-start)) 0 scroll-margin)))))
 
 (evil-define-motion evil-window-middle ()
   "Move the cursor to the middle line in the window."
@@ -959,16 +940,14 @@ In Insert state, insert a newline and indent."
   :repeat nil
   :keep-visual t
   (interactive "p")
-  (let ((scroll-preserve-screen-position nil))
-    (scroll-down count)))
+  (let (scroll-preserve-screen-position) (scroll-down count)))
 
 (evil-define-command evil-scroll-line-down (count)
   "Scroll the window COUNT lines downwards."
   :repeat nil
   :keep-visual t
   (interactive "p")
-  (let ((scroll-preserve-screen-position nil))
-    (scroll-up count)))
+  (let (scroll-preserve-screen-position) (scroll-up count)))
 
 (evil-define-command evil-scroll-count-reset ()
   "Set `evil-scroll-count' to 0.
@@ -1404,16 +1383,16 @@ the left edge."
 
 (defun evil-match (direction count)
   "Find COUNTth next match in DIRECTION."
-  (unless (and (boundp 'evil-search-module)
-               (eq evil-search-module 'evil-search))
+  (defvar evil-search-module)
+  (unless (eq evil-search-module 'evil-search)
     (user-error "Match text objects only work with Evil search module"))
   (let ((pnt (point))
-        (count (abs count)) ;; Undo effect of evil-visual-direction
+        (count (abs count)) ; Undo effect of evil-visual-direction
         (evil-ex-search-direction 'backward)
         (visual-state (evil-visual-state-p))
         on-start-match in-match on-end-match)
     (save-excursion
-      (unless (eobp) (forward-char)) ;; If on start of a match, stay there
+      (unless (eobp) (forward-char)) ; If on start of a match, stay there
       (evil-ex-search 1)
       (setq on-start-match (= evil-ex-search-match-beg pnt)
             in-match (<= evil-ex-search-match-beg pnt (1- 
evil-ex-search-match-end))
@@ -1588,7 +1567,7 @@ be joined with the previous line if and only if
   (interactive "p")
   (if (or evil-backspace-join-lines (not (bolp)))
       (call-interactively 'delete-backward-char)
-    (user-error "Beginning of line")))
+    (signal 'beginning-of-line nil)))
 
 (evil-define-command evil-delete-backward-word ()
   "Delete previous word."
@@ -1600,7 +1579,7 @@ be joined with the previous line if and only if
      ((or (not (bolp)) (bobp)) (delete-region (max beg 
(line-beginning-position))
                                               end))
      (evil-backspace-join-lines (delete-char -1))
-     (t (user-error "Beginning of line")))))
+     (t (signal 'beginning-of-line nil)))))
 
 (evil-define-command evil-delete-back-to-indentation ()
   "Delete back to the first non-whitespace character.
@@ -1610,14 +1589,12 @@ current line.  If point is on the beginning of the 
line, behave
 according to `evil-backspace-join-lines'."
   (let ((beg (if (<= (current-column) (current-indentation))
                  (line-beginning-position)
-               (save-excursion
-                 (evil-first-non-blank)
-                 (point)))))
+               (save-excursion (evil-first-non-blank) (point)))))
     (cond
      ((and (bolp) (evil-replace-state-p)) (evil-replace-backspace))
      ((bolp) (evil-delete-backward-char-and-join 1))
-     ((evil-replace-state-p) (while (< beg (point))
-                               (evil-replace-backspace)))
+     ((evil-replace-state-p)
+      (while (< beg (point)) (evil-replace-backspace)))
      (t (delete-region beg (point))))))
 
 (defun evil-ex-delete-or-yank (should-delete beg end type register count 
yank-handler)
@@ -1629,15 +1606,13 @@ given."
   (when count
     ;; with COUNT, the command should go the end of the region and delete/yank
     ;; COUNT lines from there
-    (setq beg (save-excursion
-                (goto-char end)
-                (forward-line -1)
-                (point))
-          end (save-excursion
-                (goto-char end)
-                (line-beginning-position count))
+    (setq beg (save-excursion (goto-char end)
+                              (line-beginning-position 0))
+          end (save-excursion (goto-char end)
+                              (line-beginning-position count))
           type 'line))
-  (funcall (if should-delete 'evil-delete 'evil-yank) beg end type register 
yank-handler))
+  (funcall (if should-delete #'evil-delete #'evil-yank)
+           beg end type register yank-handler))
 
 (evil-define-operator evil-ex-delete (beg end type register count yank-handler)
   "The Ex delete command.
@@ -1708,8 +1683,7 @@ of the block."
        (t (evil-open-below 1))))
      ((eq type 'block)
       (evil-insert 1 nlines))
-     (t
-      (evil-insert 1)))
+     (t (evil-insert 1)))
     (setq evil-this-register nil)))
 
 (evil-define-operator evil-change-line (beg end type register yank-handler)
@@ -1811,18 +1785,16 @@ Add (add-hook 'evil-local-mode-hook 
'turn-on-undo-tree-mode) to your init file f
 
 (evil-define-operator evil-invert-case (beg end type)
   "Invert case of text."
-  (let (char)
-    (if (eq type 'block)
-        (evil-apply-on-block #'evil-invert-case beg end nil)
-      (save-excursion
-        (goto-char beg)
-        (while (< beg end)
-          (setq char (following-char))
-          (delete-char 1 nil)
-          (if (eq (upcase char) char)
-              (insert-char (downcase char) 1)
-            (insert-char (upcase char) 1))
-          (setq beg (1+ beg)))))))
+  (if (eq type 'block)
+      (evil-apply-on-block #'evil-invert-case beg end nil)
+    (save-excursion
+      (goto-char beg)
+      (while (< beg end)
+        (let ((char (following-char)))
+          (delete-char 1)
+          (insert-char
+           (if (eq (upcase char) char) (downcase char) (upcase char))))
+        (setq beg (1+ beg))))))
 
 (evil-define-operator evil-invert-char (beg end type)
   "Invert case of character."
@@ -1842,7 +1814,7 @@ Add (add-hook 'evil-local-mode-hook 
'turn-on-undo-tree-mode) to your init file f
 (evil-define-operator evil-rot13 (beg end type)
   "ROT13 encrypt text."
   (if (eq type 'block)
-      (evil-apply-on-block #'evil-rot13 beg end nil)
+      (evil-apply-on-block #'rot13-region beg end nil)
     (rot13-region beg end)))
 
 (evil-define-operator evil-join (beg end)
@@ -2944,6 +2916,7 @@ next VCOUNT - 1 lines below the current one."
 (evil-define-command evil-ex-show-digraphs ()
   "Show a list of all available digraphs."
   :repeat nil
+  (eval-and-compile (require 'evil-digraphs))
   (let ((columns 3))
     (evil-with-view-list
       :name "evil-digraphs"
@@ -3808,22 +3781,18 @@ Supports positions in the following formats: 
\"path:line path(line)\",
 
 (evil-define-command evil-find-file-at-point-visual ()
   "Find the filename selected by the visual region.
-    Returns an error message if the file does not exist."
+Signal an error if the file does not exist."
   (require 'ffap)
   (let ((region (buffer-substring (region-beginning) (region-end))))
     (if (file-exists-p region)
         (find-file-at-point region)
-      (user-error (format "Can't find file \"%s\" in path" region)))))
+      (user-error "Can't find file \"%s\" in path" region))))
 
 (evil-ex-define-argument-type state
   "Define an argument type which can take state names."
   :collection
   (lambda (arg predicate flag)
-    (let ((completions
-           (append '("nil")
-                   (mapcar #'(lambda (state)
-                               (format "%s" (car state)))
-                           evil-state-properties))))
+    (let ((completions (cons '(nil) evil-state-properties)))
       (when arg
         (cond
          ((eq flag nil)
diff --git a/evil-common.el b/evil-common.el
index e1ce7df4d9..f3563cce04 100644
--- a/evil-common.el
+++ b/evil-common.el
@@ -27,7 +27,6 @@
 ;;; Code:
 
 (require 'evil-vars)
-(require 'evil-digraphs)
 (require 'rect)
 (require 'thingatpt)
 (require 'cl-lib)
@@ -239,14 +238,21 @@ ALIST-VAR points to an association list with entries of 
the form
 
 (defun evil-state-property (state prop &optional value)
   "Return the value of property PROP for STATE.
-PROP is a keyword as used by `evil-define-state'.
-STATE is the state's symbolic name.
-If VALUE is non-nil and the value is a variable,
-return the value of that variable."
-  (let ((val (evil-get-property evil-state-properties state prop)))
-    (if (and value (symbolp val) (boundp val))
-        (symbol-value val)
-      val)))
+PROP is a keyword as used by `evil-define-state'. STATE is the state's
+symbolic name. If VALUE is non-nil and the value is a variable, return
+the value of that variable.
+
+If STATE is t, return an association list of states and their PROP
+values instead."
+  (if (eq state t)
+      (cl-loop for (key . plist) in evil-state-properties with result do
+               (let ((p (plist-member plist prop)))
+                 (when p (push (cons key (cadr p)) result)))
+               finally return result)
+    (let ((val (plist-get (cdr (assq state evil-state-properties)) prop)))
+      (if (and value (symbolp val) (boundp val))
+          (symbol-value val)
+        val))))
 
 (eval-and-compile (defalias 'evil-swap #'cl-rotatef))
 
@@ -394,8 +400,7 @@ If PROPERTIES is the empty list, all properties are 
removed."
 (defun evil-yank-handler (&optional motion)
   "Return the yank handler for MOTION.
 MOTION defaults to the current motion."
-  (setq motion (or motion evil-this-motion))
-  (evil-get-command-property motion :yank-handler))
+  (evil-get-command-property (or motion evil-this-motion) :yank-handler))
 
 (defun evil-declare-motion (command)
   "Declare COMMAND to be a movement function.
@@ -476,8 +481,8 @@ If any character set is complemented, the result is also 
complemented."
   "Read from keyboard or INPUT and build a command description.
 Return (CMD COUNT), where COUNT is the numeric prefix argument.
 Both COUNT and CMD may be nil."
+  (when input (setq unread-command-events (append input 
unread-command-events)))
   (let (count negative)
-    (when input (setq unread-command-events (append input 
unread-command-events)))
     (catch 'done
       (while t
         (let ((seq (read-key-sequence "")))
@@ -493,14 +498,12 @@ Both COUNT and CMD may be nil."
                                    (list (car cmd) (* (or count 1)
                                                       (or (cadr cmd) 1))))))))
                ((or (eq cmd #'digit-argument)
-                    (and (equal seq "0")
-                         count))
-                (let* ((event (aref seq (- (length seq) 1)))
+                    (and (equal seq "0") count))
+                (let* ((event (aref seq (1- (length seq))))
                        (char (or (when (characterp event) event)
                                  (when (symbolp event)
                                    (get event 'ascii-character))))
-                       (digit (if (or (characterp char) (integerp char))
-                                  (- (logand char ?\177) ?0))))
+                       (digit (when (integerp char) (- (logand char ?\177) 
?0))))
                   (setq count (+ (* 10 (or count 0)) digit))))
                ((eq cmd #'negative-argument)
                 (setq negative (not negative)))
@@ -555,6 +558,7 @@ as a command. Its main use is in the `evil-read-key-map'."
   (interactive)
   (read-quoted-char))
 
+(declare-function evil-digraph "evil-digraphs")
 (defun evil-read-digraph-char-with-overlay (overlay)
   "Read two chars, displaying the first in OVERLAY, replacing \"?\".
 Return the digraph from `evil-digraph', else return second char."
@@ -2710,7 +2714,7 @@ will make `line' the type of the `next-line' command."
 
 (defun evil-type-property (type prop)
   "Return property PROP for TYPE."
-  (evil-get-property evil-type-properties type prop))
+  (plist-get (cdr (assq type evil-type-properties)) prop))
 
 (defun evil-type-p (sym)
   "Whether SYM is the name of a type."
diff --git a/evil-core.el b/evil-core.el
index f5cdef4204..fabb050223 100644
--- a/evil-core.el
+++ b/evil-core.el
@@ -805,15 +805,13 @@ See also `evil-mode-for-keymap'."
 (defun evil-set-auxiliary-keymap (map state &optional aux)
   "Set the auxiliary keymap for MAP in STATE to AUX.
 If AUX is nil, create a new auxiliary keymap."
-  (unless (keymapp aux)
-    (setq aux (make-sparse-keymap)))
+  (unless aux (setq aux (make-sparse-keymap)))
   (unless (evil-auxiliary-keymap-p aux)
     (evil-set-keymap-prompt
      aux (format "Auxiliary keymap for %s"
                  (or (evil-state-property state :name)
                      (format "%s state" state)))))
-  (define-key map
-    (vconcat (list (intern (format "%s-state" state)))) aux)
+  (define-key map (vector (intern (format "%s-state" state))) aux)
   aux)
 (put 'evil-set-auxiliary-keymap 'lisp-indent-function 'defun)
 
@@ -825,7 +823,7 @@ IGNORE-PARENT are non-nil then a new auxiliary
 keymap is created even if the parent of MAP has
 one already."
   (when state
-    (let* ((key (vconcat (list (intern (format "%s-state" state)))))
+    (let* ((key (vector (intern (format "%s-state" state))))
            (parent-aux (when (and ignore-parent
                                   (keymap-parent map))
                          (lookup-key (keymap-parent map) key)))
@@ -1207,47 +1205,44 @@ the local keymap will be `evil-test-state-local-map', 
and so on.
        ;; it depends on the current buffer and its active keymaps
        ;; (to which we may have assigned state bindings), as well as
        ;; states whose definitions may not have been processed yet.
-       (evil-put-property
-        'evil-state-properties ',state
-        :name ',name
-        :toggle ',toggle
-        :mode (defvar ,mode nil
-                ,(format "Non-nil if %s is enabled.
+       (let ((plist (list
+                     :name ',name
+                     :toggle ',toggle
+                     :mode (defvar ,mode nil
+                             ,(format "Non-nil if %s is enabled.
 Use the command `%s' to change this variable." name toggle))
-        :keymap (defvar ,keymap (make-sparse-keymap)
-                  ,(format "Keymap for %s." name))
-        :local (defvar ,local nil
-                 ,(format "Non-nil if %s is enabled.
+                     :keymap (defvar ,keymap (make-sparse-keymap)
+                               ,(format "Keymap for %s." name))
+                     :local (defvar ,local nil
+                              ,(format "Non-nil if %s is enabled.
 Use the command `%s' to change this variable." name toggle))
-        :local-keymap (defvar ,local-keymap nil
-                        ,(format "Buffer-local keymap for %s." name))
-        :tag (defvar ,tag ,tag-value
-               ,(format "Mode line tag for %s." name))
-        :message (defvar ,message ,message-value
-                   ,(format "Echo area message for %s." name))
-        :cursor (defvar ,cursor ',cursor-value
-                  ,(format "Cursor for %s.
+                     :local-keymap (defvar ,local-keymap nil
+                                     ,(format "Buffer-local keymap for %s." 
name))
+                     :tag (defvar ,tag ,tag-value
+                            ,(format "Mode line tag for %s." name))
+                     :message (defvar ,message ,message-value
+                                ,(format "Echo area message for %s." name))
+                     :cursor (defvar ,cursor ',cursor-value
+                               ,(format "Cursor for %s.
 May be a cursor type as per `cursor-type', a color string as passed
 to `set-cursor-color', a zero-argument function for changing the
 cursor, or a list of the above." name))
-        :entry-hook (defvar ,entry-hook nil
-                      ,(format "Hooks to run when entering %s." name))
-        :exit-hook (defvar ,exit-hook nil
-                     ,(format "Hooks to run when exiting %s." name))
-        :modes (defvar ,modes nil
-                 ,(format "Modes that should come up in %s." name))
-        :input-method ',input-method
-        :predicate ',predicate
-        :enable ',enable)
+                     :entry-hook (defvar ,entry-hook nil
+                                   ,(format "Hooks to run when entering %s." 
name))
+                     :exit-hook (defvar ,exit-hook nil
+                                  ,(format "Hooks to run when exiting %s." 
name))
+                     :modes (defvar ,modes nil
+                              ,(format "Modes that should come up in %s." 
name))
+                     :input-method ',input-method
+                     :predicate ',predicate
+                     :enable ',enable)))
+       (evil--add-to-alist evil-state-properties ',state plist))
 
        ,@(when suppress-keymap
            `((set-keymap-parent ,keymap evil-suppress-map)))
 
-       (dolist (func ',entry-hook-value)
-         (add-hook ',entry-hook func))
-
-       (dolist (func ',exit-hook-value)
-         (add-hook ',exit-hook func))
+       (dolist (func ',entry-hook-value) (add-hook ',entry-hook func))
+       (dolist (func ',exit-hook-value) (add-hook ',exit-hook func))
 
        (defun ,predicate (&optional state)
          ,(format "Whether the current state is %s.
@@ -1286,8 +1281,8 @@ If ARG is nil, don't display a message in the echo 
area.%s" name doc)
                  ;; an error would be raised. This strange situation
                  ;; should not arise in general and there should
                  ;; probably be a better way to handle this situation.
-                 (if deactivate-current-input-method-function
-                     (deactivate-input-method)))
+                 (when deactivate-current-input-method-function
+                   (deactivate-input-method)))
                (unless evil-no-display
                  (evil-refresh-cursor ',state)
                  (evil-refresh-mode-line ',state)
diff --git a/evil-digraphs.el b/evil-digraphs.el
index 7344bd9d00..2bd36879bb 100644
--- a/evil-digraphs.el
+++ b/evil-digraphs.el
@@ -25,10 +25,10 @@
 ;; You should have received a copy of the GNU General Public License
 ;; along with Evil.  If not, see <http://www.gnu.org/licenses/>.
 
-(require 'evil-vars)
-
 ;;; Code:
 
+(require 'evil-vars)
+
 (defgroup evil-digraphs nil
   "Digraph support based on RFC 1345."
   :group 'evil
@@ -41,9 +41,7 @@ a cons cell of the digraph and its character replacement,
 where the digraph is a list of two characters.
 See also `evil-digraphs-table'."
   :type '(alist :key-type (list character character)
-                :value-type character)
-  :require 'evil-digraphs
-  :group 'evil-digraphs)
+                :value-type character))
 
 (defconst evil-digraphs-table
   '(((?N ?U) . ?\x00)
@@ -1716,16 +1714,16 @@ This includes all digraphs defined in RFC 1345,
 as well as miscellaneous digraphs for multi-byte characters.
 See also `evil-digraphs-table-user'.")
 
+;;;###autoload
 (defun evil-digraph (digraph)
   "Convert DIGRAPH to character or list representation.
 If DIGRAPH is a list (CHAR1 CHAR2), return the corresponding character;
 if DIGRAPH is a character, return the corresponding list.
 Searches in `evil-digraphs-table-user' and `evil-digraphs-table'."
   (if (listp digraph)
-      (let* ((char1 (car digraph))
-             (char2 (cadr digraph)))
-        (or (cdr (assoc (list char1 char2) evil-digraphs-table-user))
-            (cdr (assoc (list char1 char2) evil-digraphs-table))
+      (or (cdr (assoc digraph evil-digraphs-table-user))
+          (cdr (assoc digraph evil-digraphs-table))
+          (cl-destructuring-bind (char1 char2) digraph
             (unless (eq char1 char2)
               (or (cdr (assoc (list char2 char1) evil-digraphs-table-user))
                   (cdr (assoc (list char2 char1) evil-digraphs-table))))))
diff --git a/evil-macros.el b/evil-macros.el
index ebc188e0c4..0180dd0a2c 100644
--- a/evil-macros.el
+++ b/evil-macros.el
@@ -656,9 +656,8 @@ be transformations on buffer positions, like `:expand' and 
`:contract'.
            (debug (&define name
                            [&optional stringp]
                            [&rest [keywordp function-form]])))
-  (let (args defun-forms func key name plist string sym val)
-    ;; standard values
-    (setq plist (plist-put plist :one-to-one t))
+  (let ((plist (list :one-to-one t)) ; standard values
+        args defun-forms func key name string sym val)
     ;; keywords
     (while (keywordp (car-safe body))
       (setq key (pop body)
@@ -670,7 +669,7 @@ be transformations on buffer positions, like `:expand' and 
`:contract'.
                            "^:" "" (symbol-name key)))
               name (intern (format "evil-%s-%s" type sym))
               args (car (cdr-safe func))
-              string (car (cdr (cdr-safe func)))
+              string (cadr (cdr-safe func))
               string (if (stringp string)
                          (format "%s\n\n" string) "")
               plist (plist-put plist key `',name))
@@ -731,7 +730,7 @@ with PROPERTIES.\n\n%s%s" sym type string doc)
                              (and (plist-get plist :contract)
                                   (plist-get plist :one-to-one)))))
     `(progn
-       (evil-put-property 'evil-type-properties ',type ,@plist)
+       (evil--add-to-alist evil-type-properties ',type (list ,@plist))
        ,@defun-forms
        ',type)))
 
diff --git a/evil-tests.el b/evil-tests.el
index ad0df81869..c376acefdd 100644
--- a/evil-tests.el
+++ b/evil-tests.el
@@ -67,6 +67,7 @@
 (require 'elp)
 (require 'ert)
 (require 'evil)
+(require 'evil-digraphs)
 (require 'evil-test-helpers)
 (require 'ispell)
 
diff --git a/evil.el b/evil.el
index dc13a828c0..5bd33e86f9 100644
--- a/evil.el
+++ b/evil.el
@@ -140,7 +140,6 @@
 (require 'evil-macros)
 (require 'evil-search)
 (require 'evil-ex)
-(require 'evil-digraphs)
 (require 'evil-types)
 (require 'evil-commands)
 (require 'evil-jumps)
diff --git a/scripts/evil-extract-docstrings b/scripts/evil-extract-docstrings
index 06afa43e69..55dbd79561 100755
--- a/scripts/evil-extract-docstrings
+++ b/scripts/evil-extract-docstrings
@@ -4,6 +4,7 @@
 
 (add-to-list 'load-path (expand-file-name ".." cur-path))
 (require 'evil)
+(require 'evil-digraphs)
 (require 'json)
 (require 'help)
 

Reply via email to