emacs-elpa-diffs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[nongnu] elpa/evil 460af439e5: Suppress operator for some normal state c


From: ELPA Syncer
Subject: [nongnu] elpa/evil 460af439e5: Suppress operator for some normal state commands
Date: Mon, 3 Oct 2022 16:58:25 -0400 (EDT)

branch: elpa/evil
commit 460af439e51da7f6602732318ff52820bd2286fd
Author: Tom Dalziel <tom_dl@hotmail.com>
Commit: Tom Dalziel <33435574+tomdl89@users.noreply.github.com>

    Suppress operator for some normal state commands
---
 evil-commands.el |   7 ++-
 evil-common.el   | 185 ++++++++++++++++++++++++++++---------------------------
 2 files changed, 98 insertions(+), 94 deletions(-)

diff --git a/evil-commands.el b/evil-commands.el
index 65d17dd245..f17a7a7f5a 100644
--- a/evil-commands.el
+++ b/evil-commands.el
@@ -2367,6 +2367,7 @@ leave the cursor just after the new text."
   "Use REGISTER for the next command."
   :keep-visual t
   :repeat ignore
+  :suppress-operator t
   (interactive "<C>")
   (setq evil-this-register register))
 
@@ -2682,9 +2683,10 @@ Adds a `^' overlay as an input prompt."
           (when (evil-replace-state-p) (delete-char chars-to-delete)))
       (when insert-prompt (delete-overlay insert-prompt)))))
 
-(defun evil-open-above (count)
+(evil-define-command evil-open-above (count)
   "Insert a new line above point and switch to Insert state.
 The insertion will be repeated COUNT times."
+  :suppress-operator t
   (interactive "p")
   (unless (eq evil-want-fine-undo t)
     (evil-start-undo-step))
@@ -2696,9 +2698,10 @@ The insertion will be repeated COUNT times."
   (when evil-auto-indent
     (indent-according-to-mode)))
 
-(defun evil-open-below (count)
+(evil-define-command evil-open-below (count)
   "Insert a new line below point and switch to Insert state.
 The insertion will be repeated COUNT times."
+  :suppress-operator t
   (interactive "p")
   (unless (eq evil-want-fine-undo t)
     (evil-start-undo-step))
diff --git a/evil-common.el b/evil-common.el
index c0282ce4ab..58949f3b7b 100644
--- a/evil-common.el
+++ b/evil-common.el
@@ -1995,6 +1995,97 @@ with regard to indentation."
     (insert (if use-hard-newlines hard-newline "\n"))
     (back-to-indentation)))
 
+;;; Interactive forms
+
+(defun evil-match-interactive-code (interactive &optional pos)
+  "Match an interactive code at position POS in string INTERACTIVE.
+Return the first matching entry in `evil-interactive-alist', or nil."
+  (let ((length (length interactive))
+        (pos (or pos 0)))
+    (catch 'done
+      (dolist (entry evil-interactive-alist)
+        (let* ((string (car entry))
+               (end (+ (length string) pos)))
+          (when (and (<= end length)
+                     (string= string
+                              (substring interactive pos end)))
+            (throw 'done entry)))))))
+
+(defun evil-concatenate-interactive-forms (&rest forms)
+  "Concatenate interactive list expressions FORMS.
+Return a single expression where successive expressions
+are joined, if possible."
+  (let (result)
+    (when forms
+      (while (cdr forms)
+        (cond
+         ((null (car forms))
+          (pop forms))
+         ((and (eq (car (car forms)) 'list)
+               (eq (car (cadr forms)) 'list))
+          (setq forms (cons (append (car forms)
+                                    (cdr (cadr forms)))
+                            (cdr (cdr forms)))))
+         (t
+          (push (pop forms) result))))
+      (when (car forms)
+        (push (pop forms) result))
+      (setq result (nreverse result))
+      (cond
+       ((null result))
+       ((null (cdr result))
+        (car result))
+       (t
+        `(append ,@result))))))
+
+(defun evil-interactive-string (string)
+  "Evaluate the interactive string STRING.
+The string may contain extended interactive syntax.
+The return value is a cons cell (FORM . PROPERTIES),
+where FORM is a single list-expression to be passed to
+a standard `interactive' statement, and PROPERTIES is a
+list of command properties as passed to `evil-define-command'."
+  (let ((length (length string))
+        (pos 0)
+        code expr forms match plist prompt properties)
+    (while (< pos length)
+      (if (eq (aref string pos) ?\n)
+          (setq pos (1+ pos))
+        (setq match (evil-match-interactive-code string pos))
+        (if (null match)
+            (user-error "Unknown interactive code: `%s'"
+                        (substring string pos))
+          (setq code (car match)
+                expr (car (cdr match))
+                plist (cdr (cdr match))
+                pos (+ pos (length code)))
+          (when (functionp expr)
+            (setq prompt
+                  (substring string pos
+                             (or (string-match "\n" string pos)
+                                 length))
+                  pos (+ pos (length prompt))
+                  expr `(funcall ,expr ,prompt)))
+          (setq forms (append forms (list expr))
+                properties (append properties plist)))))
+    (cons `(append ,@forms) properties)))
+
+(defun evil-interactive-form (&rest args)
+  "Evaluate interactive forms ARGS.
+The return value is a cons cell (FORM . PROPERTIES),
+where FORM is a single list-expression to be passed to
+a standard `interactive' statement, and PROPERTIES is a
+list of command properties as passed to `evil-define-command'."
+  (let (forms properties)
+    (dolist (arg args)
+      (if (not (stringp arg))
+          (setq forms (append forms (list arg)))
+        (setq arg (evil-interactive-string arg)
+              forms (append forms (cdr (car arg)))
+              properties (append properties (cdr arg)))))
+    (cons (apply #'evil-concatenate-interactive-forms forms)
+          properties)))
+
 ;;; Markers
 
 (defun evil-global-marker-p (char)
@@ -2002,11 +2093,12 @@ with regard to indentation."
   (or (and (>= char ?A) (<= char ?Z))
       (assq char (default-value 'evil-markers-alist))))
 
-(defun evil-set-marker (char &optional pos advance)
+(evil-define-command evil-set-marker (char &optional pos advance)
   "Set the marker denoted by CHAR to position POS.
 POS defaults to the current position of point.
 If ADVANCE is t, the marker advances when inserting text at it;
 otherwise, it stays behind."
+  :suppress-operator t
   (interactive (list (read-char)))
   (catch 'done
     (let ((marker (evil-get-marker char t)) alist)
@@ -2815,97 +2907,6 @@ is negative this is a more recent kill."
   (interactive "p")
   (evil-paste-pop (- count)))
 
-;;; Interactive forms
-
-(defun evil-match-interactive-code (interactive &optional pos)
-  "Match an interactive code at position POS in string INTERACTIVE.
-Return the first matching entry in `evil-interactive-alist', or nil."
-  (let ((length (length interactive))
-        (pos (or pos 0)))
-    (catch 'done
-      (dolist (entry evil-interactive-alist)
-        (let* ((string (car entry))
-               (end (+ (length string) pos)))
-          (when (and (<= end length)
-                     (string= string
-                              (substring interactive pos end)))
-            (throw 'done entry)))))))
-
-(defun evil-concatenate-interactive-forms (&rest forms)
-  "Concatenate interactive list expressions FORMS.
-Return a single expression where successive expressions
-are joined, if possible."
-  (let (result)
-    (when forms
-      (while (cdr forms)
-        (cond
-         ((null (car forms))
-          (pop forms))
-         ((and (eq (car (car forms)) 'list)
-               (eq (car (cadr forms)) 'list))
-          (setq forms (cons (append (car forms)
-                                    (cdr (cadr forms)))
-                            (cdr (cdr forms)))))
-         (t
-          (push (pop forms) result))))
-      (when (car forms)
-        (push (pop forms) result))
-      (setq result (nreverse result))
-      (cond
-       ((null result))
-       ((null (cdr result))
-        (car result))
-       (t
-        `(append ,@result))))))
-
-(defun evil-interactive-string (string)
-  "Evaluate the interactive string STRING.
-The string may contain extended interactive syntax.
-The return value is a cons cell (FORM . PROPERTIES),
-where FORM is a single list-expression to be passed to
-a standard `interactive' statement, and PROPERTIES is a
-list of command properties as passed to `evil-define-command'."
-  (let ((length (length string))
-        (pos 0)
-        code expr forms match plist prompt properties)
-    (while (< pos length)
-      (if (eq (aref string pos) ?\n)
-          (setq pos (1+ pos))
-        (setq match (evil-match-interactive-code string pos))
-        (if (null match)
-            (user-error "Unknown interactive code: `%s'"
-                        (substring string pos))
-          (setq code (car match)
-                expr (car (cdr match))
-                plist (cdr (cdr match))
-                pos (+ pos (length code)))
-          (when (functionp expr)
-            (setq prompt
-                  (substring string pos
-                             (or (string-match "\n" string pos)
-                                 length))
-                  pos (+ pos (length prompt))
-                  expr `(funcall ,expr ,prompt)))
-          (setq forms (append forms (list expr))
-                properties (append properties plist)))))
-    (cons `(append ,@forms) properties)))
-
-(defun evil-interactive-form (&rest args)
-  "Evaluate interactive forms ARGS.
-The return value is a cons cell (FORM . PROPERTIES),
-where FORM is a single list-expression to be passed to
-a standard `interactive' statement, and PROPERTIES is a
-list of command properties as passed to `evil-define-command'."
-  (let (forms properties)
-    (dolist (arg args)
-      (if (not (stringp arg))
-          (setq forms (append forms (list arg)))
-        (setq arg (evil-interactive-string arg)
-              forms (append forms (cdr (car arg)))
-              properties (append properties (cdr arg)))))
-    (cons (apply #'evil-concatenate-interactive-forms forms)
-          properties)))
-
 ;;; Types
 
 (defun evil-type (object &optional default)



reply via email to

[Prev in Thread] Current Thread [Next in Thread]