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

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

[elpa] externals/objed 64ed598 130/216: Mark other instances if object c


From: Stefan Monnier
Subject: [elpa] externals/objed 64ed598 130/216: Mark other instances if object command is called repeatedly
Date: Tue, 8 Jan 2019 12:29:25 -0500 (EST)

branch: externals/objed
commit 64ed598c4e45e6e2487262be9652d1166c734f42
Author: Clemera <address@hidden>
Commit: Clemera <address@hidden>

    Mark other instances if object command is called repeatedly
---
 objed.el | 19 +++++++++++++------
 1 file changed, 13 insertions(+), 6 deletions(-)

diff --git a/objed.el b/objed.el
index 093f774..7fd00d4 100644
--- a/objed.el
+++ b/objed.el
@@ -605,12 +605,18 @@ update to given object."
     (cond (binding
            (funcall (cdr binding) name))
           (t
-           ;; object called as command via M-x
-           (when (not objed--buffer)
-              (objed--init name))
-           ;; TODO: do something useful if called twice?
-           ;; (eq name objed--object)
-           (when (objed--switch-to name)
+           (let ((current objed--object))
+             ;; object called as command via M-x
+             (when (not objed--buffer)
+               (objed--init name))
+             ;; if called twice mark instances in
+             ;; buffer/defun
+             (cond ((eq name current)
+                    (if (and (eq name 'identifier)
+                             (not objed--marked-ovs))
+                        (objed--mark-all-inside 'defun)
+                      (objed--mark-all-inside 'buffer)))
+                   (t (objed--switch-to name)))
              (goto-char (objed--beg)))))))
 
 
@@ -970,6 +976,7 @@ Use `objed-define-dispatch' to define a dispatch command.")
 
 (defun objed--mark-all-inside (name)
   "Mark all objects of current type inside object NAME."
+  (objed--unmark-all)
   (save-excursion
     (save-restriction
       ;; narrow to object we search for objects in



reply via email to

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