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

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

[elpa] externals/objed 5a1c9f7 122/216: Improve char switching with obje


From: Stefan Monnier
Subject: [elpa] externals/objed 5a1c9f7 122/216: Improve char switching with objec-ace
Date: Tue, 8 Jan 2019 12:29:24 -0500 (EST)

branch: externals/objed
commit 5a1c9f73eefb7c57bc64c03e06a323a2329e7129
Author: Clemera <address@hidden>
Commit: Clemera <address@hidden>

    Improve char switching with objec-ace
---
 objed.el | 36 ++++++++++++++++++++----------------
 1 file changed, 20 insertions(+), 16 deletions(-)

diff --git a/objed.el b/objed.el
index 28fdaf2..884af42 100644
--- a/objed.el
+++ b/objed.el
@@ -458,6 +458,7 @@ To avoid loading `avy' set this var before activating 
`objed-mode.'"
 (declare-function which-key--create-buffer-and-show "ext:which-key")
 (declare-function avy--process "ext:avy")
 (declare-function avy--style-fn "ext:avy")
+(declare-function avy-goto-char "ext:avy")
 (declare-function edit-indirect-region "ext:edit-indirect")
 (declare-function electric-pair-syntax-info "ext:elec-pair")
 
@@ -1768,22 +1769,25 @@ textual content of an object via the content object."
 (defun objed-ace ()
   "Jump to an object with `avy'."
   (interactive)
-  (unless (and objed--avy-avail-p
-               objed-use-avy-if-available-p)
-    (user-error objed--avy-err-msg))
-  (let* ((avy-action #'goto-char)
-         (avy-style 'at-full)
-         (avy-all-windows t)
-         (posns (objed--collect-object-positions
-                 (window-start) (window-end))))
-    (cond (posns
-           (if (> (length posns) 1)
-               (avy--process
-                posns (avy--style-fn avy-style))
-             (goto-char (caar posns)))
-           (objed--update-current-object))
-          (t
-           (message "No objects found.")))))
+  (if (eq objed--object 'char)
+      (progn (call-interactively #'avy-goto-char)
+             (objed--update-current-object))
+    (unless (and objed--avy-avail-p
+                 objed-use-avy-if-available-p)
+      (user-error objed--avy-err-msg))
+    (let* ((avy-action #'goto-char)
+           (avy-style 'at-full)
+           (avy-all-windows t)
+           (posns (objed--collect-object-positions
+                   (window-start) (window-end))))
+      (cond (posns
+             (if (> (length posns) 1)
+                 (avy--process
+                  posns (avy--style-fn avy-style))
+               (goto-char (caar posns)))
+             (objed--update-current-object))
+            (t
+             (message "No objects found."))))))
 
 (defun objed-occur ()
   "Complete initial lines and jump to object."



reply via email to

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