[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[elpa] externals/objed 4d1a445 141/166: Add public object bounds functio
From: |
Clemens Radermacher |
Subject: |
[elpa] externals/objed 4d1a445 141/166: Add public object bounds functions |
Date: |
Sun, 29 Dec 2019 08:21:16 -0500 (EST) |
branch: externals/objed
commit 4d1a4453a50fe21fd2de0ddb24871d14f33220b3
Author: Clemens Radermacher <address@hidden>
Commit: Clemens Radermacher <address@hidden>
Add public object bounds functions
---
objed-objects.el | 45 ++++++++++++++++++++++++++++++++++++++++++---
1 file changed, 42 insertions(+), 3 deletions(-)
diff --git a/objed-objects.el b/objed-objects.el
index 95f3b69..8d1f057 100644
--- a/objed-objects.el
+++ b/objed-objects.el
@@ -438,7 +438,7 @@ Either the symbol `whole' or `inner'.")
(defvar objed--marked-ovs nil
"List of overlays of marked objects.")
-;; * Get object positions
+;; * Internal object access functions
(defun objed--inside-object-p (obj)
"Return non-nil if point point inside object OBJ."
@@ -450,7 +450,6 @@ Either the symbol `whole' or `inner'.")
(when (and obj (not (objed--distant-p obj)))
obj)))
-
(defun objed--beg (&optional obj)
"Get beginning position of object.
@@ -459,7 +458,6 @@ defaults to `objed--current-obj'."
(let ((obj (or obj objed--current-obj)))
(caar obj)))
-
(defun objed--end (&optional obj)
"Get end position of object.
@@ -468,6 +466,18 @@ defaults to `objed--current-obj'."
(let ((obj (or obj objed--current-obj)))
(cadr (car obj))))
+(defun objed--object-at-point (obj &optional state)
+ "Return object data for OBJ and STATE a point.
+
+Does return nil when there is no such object."
+ (let* ((objed--object obj)
+ (objed--obj-state (or state 'whole))
+ (o (ignore-errors (objed--object :get-obj))))
+ (when o
+ (if (eq state 'inner)
+ (nreverse o)
+ o))))
+
(defun objed--other (&optional obj)
"Return object position opposite to point.
@@ -525,6 +535,7 @@ otherwise the its the head of object OBJ which defaults to
(t
(car obj)))))
+
(defun objed--bounds (&optional obj)
"Get the current object bounds.
@@ -896,6 +907,34 @@ Position POS defaults to point."
(cdr (assq inv buffer-invisibility-spec)))
(cl-return t))))))
+;; * Public access functions for objects
+
+(defun objed-bounds-at-point (obj &optional state)
+ "Return beg and end position of object at point.
+
+The positions are returned as a cons: (beg . end). OBJ is a
+symbol of a known object. STATE is either `whole' or `inner' and
+defaults to `whole'.
+
+Does return nil when there is no such object at point."
+ (let ((o (objed--object-at-point obj state)))
+ (when o
+ (cons (objed--beg o)
+ (objed--end o)))))
+
+
+(defun objed-bounds-at (pos obj &optional state)
+ "Return beg and end position of object at POS.
+
+The positions are returned as a cons: (beg . end). OBJ is a
+symbol of a known object. STATE is either `whole' or `inner' and
+defaults to `whole'.
+
+Does return nil when there is no such object at point."
+ (save-excursion
+ (goto-char pos)
+ (objed-bounds-at-point obj state)))
+
;; * Object creation/manipulation
- [elpa] externals/objed faa9fb0 158/166: Allow defining objects without ending regexp (#58), (continued)
- [elpa] externals/objed faa9fb0 158/166: Allow defining objects without ending regexp (#58), Clemens Radermacher, 2019/12/29
- [elpa] externals/objed 2a25ff2 081/166: Make toggle smarter for sexp objects, Clemens Radermacher, 2019/12/29
- [elpa] externals/objed 2f50485 102/166: Add css defun object, Clemens Radermacher, 2019/12/29
- [elpa] externals/objed d3ab36c 108/166: Add kill-this-buffer to command alist, Clemens Radermacher, 2019/12/29
- [elpa] externals/objed be4c3cd 114/166: Make indenting defuns repeatable, too, Clemens Radermacher, 2019/12/29
- [elpa] externals/objed 4a22002 120/166: Improve reformat command, Clemens Radermacher, 2019/12/29
- [elpa] externals/objed 9267f38 125/166: Improve open line command, Clemens Radermacher, 2019/12/29
- [elpa] externals/objed cab7cee 130/166: Update hl init, Clemens Radermacher, 2019/12/29
- [elpa] externals/objed 7374a35 128/166: Improve sexp fallback, Clemens Radermacher, 2019/12/29
- [elpa] externals/objed 42a553e 139/166: Don't override M-o binding, Clemens Radermacher, 2019/12/29
- [elpa] externals/objed 4d1a445 141/166: Add public object bounds functions,
Clemens Radermacher <=
- [elpa] externals/objed b6b7c3f 144/166: Disable during a company completion, Clemens Radermacher, 2019/12/29
- [elpa] externals/objed 70cf23e 145/166: Merge pull request #51 from flatwhatson/fix-company, Clemens Radermacher, 2019/12/29
- [elpa] externals/objed 2a06126 143/166: Add functions to map over objects, Clemens Radermacher, 2019/12/29
- [elpa] externals/objed fea1148 148/166: Fixes #54, identifier movement for symbols with regex chars, Clemens Radermacher, 2019/12/29
- [elpa] externals/objed cc46438 146/166: Syntactic changes, Clemens Radermacher, 2019/12/29
- [elpa] externals/objed fdea65d 151/166: Adding `objed-switch-alist` #57, Clemens Radermacher, 2019/12/29
- [elpa] externals/objed c3cd6ab 150/166: Merge pull request #55 from r-darwish/patch-1, Clemens Radermacher, 2019/12/29
- [elpa] externals/objed e079a76 152/166: Add objed-init-hook #57, Clemens Radermacher, 2019/12/29
- [elpa] externals/objed a5684df 156/166: Add objed-switch-functions (#57), Clemens Radermacher, 2019/12/29
- [elpa] externals/objed 18eb298 161/166: Add objed-define-local-object-keys*, Clemens Radermacher, 2019/12/29