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

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

[elpa] externals/objed 13e7829 093/166: Fix word object navigation with


From: Clemens Radermacher
Subject: [elpa] externals/objed 13e7829 093/166: Fix word object navigation with objed-next/prev for inner subwords
Date: Sun, 29 Dec 2019 08:21:07 -0500 (EST)

branch: externals/objed
commit 13e7829b5207d7bce9aca7fefdef17d91ed8ef37
Author: Clemens Radermacher <address@hidden>
Commit: Clemens Radermacher <address@hidden>

    Fix word object navigation with objed-next/prev for inner subwords
---
 objed-objects.el | 33 ++++++++++++++++++++++-----------
 objed.el         |  7 ++++++-
 2 files changed, 28 insertions(+), 12 deletions(-)

diff --git a/objed-objects.el b/objed-objects.el
index 0a02ad2..99a4fa0 100644
--- a/objed-objects.el
+++ b/objed-objects.el
@@ -1659,6 +1659,19 @@ comments."
   (search-backward " " nil t))
 
 
+(defun objed--inner-word-bounds ()
+  "Return bounds of subword at point."
+  (let* ((subword-mode t)
+         (superword-mode nil)
+         (find-word-boundary-function-table
+          subword-find-word-boundary-function-table))
+    (if (eq this-command 'forward-word)
+        (save-excursion
+          (forward-word -1)
+          (bounds-of-thing-at-point 'word))
+      (bounds-of-thing-at-point 'word))))
+
+
 (objed-define-object nil word
   :atp
   (looking-at "\\<")
@@ -1669,17 +1682,15 @@ comments."
   :get-obj
   (if (eobp)
       (objed-make-empty-object)
-    (objed-make-object
-     :obounds (bounds-of-thing-at-point 'word)
-     :ibounds (let* ((subword-mode t)
-                     (superword-mode nil)
-                     (find-word-boundary-function-table
-                      subword-find-word-boundary-function-table))
-                (if (eq this-command 'forward-word)
-                    (save-excursion
-                      (forward-word -1)
-                      (bounds-of-thing-at-point 'word))
-                  (bounds-of-thing-at-point 'word)))))
+    (if (objed--inner-p)
+        ;; don't confuse objed-next/prev which
+        ;; use the outer bounds for navigation
+        ;; but a word can contain multiple innner words
+        (objed-make-object
+         :obounds (objed--inner-word-bounds))
+      (objed-make-object
+         :obounds (bounds-of-thing-at-point 'word)
+         :ibounds (objed--inner-word-bounds))))
   :try-next
   (if (objed--inner-p)
       (let* ((subword-mode t)
diff --git a/objed.el b/objed.el
index 16d0829..0917ba7 100644
--- a/objed.el
+++ b/objed.el
@@ -265,7 +265,7 @@ be used to restore previous states."
     reposition-window
     eval-defun
     eval-last-sexp
-    kmacro-start-macro
+    kmacro-start-macrop
     kmacro-start-macro-or-insert-counter
     kmacro-end-or-call-macro
     kmacro-call-macro
@@ -1980,6 +1980,11 @@ Switches between inner and whole object state."
   (let ((boo (eq (point) (objed--beg)))
         (eoo (eq (point) (objed--end))))
     (objed--toggle-state)
+    ;; for words force update because
+    ;; a word can contain multiple inner
+    ;; objects (CamelCaseSubWords)
+    (when (eq objed--object 'word)
+      (objed--update-current-object))
     (cond (boo
            (goto-char (objed--beg)))
           ((and eoo



reply via email to

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