branch: externals/objed
commit cb1a6ca1c8c71da5fd479b59f0967f12bca60d9a
Author: Clemens Radermacher <[email protected]>
Commit: Clemens Radermacher <[email protected]>
Add continuation object feature
---
objed.el | 24 +++++++++++++++++++++---
1 file changed, 21 insertions(+), 3 deletions(-)
diff --git a/objed.el b/objed.el
index 43e2d2c..ae7e4e8 100644
--- a/objed.el
+++ b/objed.el
@@ -3486,9 +3486,15 @@ and RANGE hold the object position data."
;; let op exit itself if it wants to
(ignore))
(t
- (if (and text (objed--line-p text))
- (objed--init 'line)
- (objed--init 'char))))
+ (let ((co (and (= (car range) (cadr range)) ; object vanished
+ (objed--get-continuation-object objed--object))))
+ (if co
+ (objed--update-current-object co)
+ ;; stay active with most appr. obj
+ ;; use a line when we acted on lines
+ (if (and text (objed--line-p text))
+ (objed--switch-to 'line)
+ (objed--switch-to 'char))))))
;; cleanup
(when objed--extend-cookie
(face-remap-remove-relative objed--extend-cookie)
@@ -3501,6 +3507,18 @@ and RANGE hold the object position data."
(set-marker (cadr range) nil))))
+(defun objed--get-continuation-object (obj)
+ "Rerturn continuation object for object OBJ."
+ ;; objects which
+ (cond ((memq obj '(bracket string comment))
+ (let ((objed--object 'sexp))
+ (objed-make-object :beg (point)
+ :end (objed--end (objed--get)))))
+ (t
+ (objed-make-object :beg (point)
+ :end (objed--end (objed--get))))))
+
+
(defun objed-quit ()
"Quit and deactivate.