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

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

[elpa] externals/objed 6ae9bff 042/166: When repeating backward/forward


From: Clemens Radermacher
Subject: [elpa] externals/objed 6ae9bff 042/166: When repeating backward/forward until proceed to object boundary
Date: Sun, 29 Dec 2019 08:20:57 -0500 (EST)

branch: externals/objed
commit 6ae9bff820128d0894cb3cdf7a4f0d06c8f50dfa
Author: Clemens Radermacher <address@hidden>
Commit: Clemens Radermacher <address@hidden>

    When repeating backward/forward until proceed to object boundary
---
 objed.el | 36 +++++++++++++++++++++---------------
 1 file changed, 21 insertions(+), 15 deletions(-)

diff --git a/objed.el b/objed.el
index 0e73751..16d529d 100644
--- a/objed.el
+++ b/objed.el
@@ -1783,27 +1783,33 @@ Shrinks to inner objects on repeat if possible."
 
 At bracket or string self insert ARG times."
   (interactive "p")
-  (if (or (objed--at-object-p 'bracket)
-          (objed--at-object-p 'string))
-      (self-insert-command arg)
-    (when (save-excursion
-            (objed-context-object)
-            (objed--toggle-state))
-      (objed--change-to :iend (point) :end (point))
-      (goto-char (objed--beg)))))
+  (if (eq last-command this-command)
+      (progn (objed--toggle-state)
+             (goto-char (objed--beg)))
+    (if (or (objed--at-object-p 'bracket)
+            (objed--at-object-p 'string))
+        (self-insert-command arg)
+      (when (save-excursion
+              (objed-context-object)
+              (objed--toggle-state))
+        (objed--change-to :iend (point) :end (point))
+        (goto-char (objed--beg))))))
 
 (defun objed-forward-until-context (arg)
   "Goto object inner end and activate part moved over.
 
 At bracket or string self insert ARG times."
   (interactive "p")
-  (if (or (objed--at-object-p 'bracket)
-          (objed--at-object-p 'string))
-      (self-insert-command arg)
-    (when (save-excursion (objed-context-object)
-                          (objed--toggle-state))
-      (objed--change-to :ibeg (point) :beg (point))
-      (goto-char (objed--end)))))
+  (if (eq last-command this-command)
+      (progn (objed--toggle-state)
+             (goto-char (objed--end)))
+    (if (or (objed--at-object-p 'bracket)
+            (objed--at-object-p 'string))
+        (self-insert-command arg)
+      (when (save-excursion (objed-context-object)
+                            (objed--toggle-state))
+        (objed--change-to :ibeg (point) :beg (point))
+        (goto-char (objed--end))))))
 
 (defun objed-current-or-previous-context (&optional arg)
   "Move to end of object at point and activate it.



reply via email to

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