branch: externals/objed
commit 6f06795e412cd916c6d2f10f0a918b749a8bd83e
Author: Clemens Radermacher <[email protected]>
Commit: Clemens Radermacher <[email protected]>
Add commands which move to prev/next object, ignoring context
---
objed-objects.el | 10 +++++++++-
objed.el | 13 +++++++++++++
2 files changed, 22 insertions(+), 1 deletion(-)
diff --git a/objed-objects.el b/objed-objects.el
index a4f5940..dfe831c 100644
--- a/objed-objects.el
+++ b/objed-objects.el
@@ -409,13 +409,21 @@ OBJ is the object to use and defaults to
`objed--current-obj'."
(let ((obj (or obj objed--current-obj)))
(objed--apply #'max obj)))
+(defvar objed--basic-objects
+ '(sexp line identifier word char region buffer)
+ "Basic objects.
+
+Basic object are objects which have no next/previous or which
+have their own movement commands.")
+
+
(defun objed--basic-p ()
"Return non-nil if current object is a basic object.
From basic objects `objed' starts expanding to context objects.
Thus this should be objects which have their own movement
commands."
- (memq objed--object '(sexp line identifier word char region buffer)))
+ (memq objed--object objed--basic-objects))
(defun objed--current (&optional obj)
"Get the current range of interest.
diff --git a/objed.el b/objed.el
index e2407df..bc69932 100644
--- a/objed.el
+++ b/objed.el
@@ -1824,6 +1824,19 @@ postitive prefix argument ARG move to the nth previous
object."
(when (eq pos (point))
(error "No previous %s" objed--object)))))
+(defun objed-previous (&optional arg)
+ "Move to ARG previous object of current type."
+ (interactive "p")
+ (let ((objed--basic-objects nil))
+ (objed-current-or-previous-context arg)))
+
+
+(defun objed-next (&optional arg)
+ "Move to ARG next object of current type."
+ (interactive "p")
+ (let ((objed--basic-objects nil))
+ (objed-current-or-next-context arg)))
+
(defun objed-current-or-next-context (&optional arg)
"Move to beginning of object at point and activate it.