branch: externals/objed
commit e6bed2ed18ba5cbeb5a62203850e812da137b77b
Author: Clemens Radermacher <[email protected]>
Commit: Clemens Radermacher <[email protected]>
Further improve regex object
---
objed-objects.el | 18 +++++++++++-------
1 file changed, 11 insertions(+), 7 deletions(-)
diff --git a/objed-objects.el b/objed-objects.el
index 0eb1996..f947c80 100644
--- a/objed-objects.el
+++ b/objed-objects.el
@@ -74,13 +74,17 @@
(ibounds ())
(opos (point)))
(save-mark-and-excursion
- (when (and (if (looking-at bregex)
- (re-search-forward bregex nil t)
- (re-search-forward eregex nil t)
- (goto-char (or (match-beginning 1)
- (match-beginning 0)))) ; possibly exit start
-
- ;; goto possible start
+ ;; try to move into object when at boundary
+ (if (looking-at bregex)
+ (goto-char (or (match-end 1)
+ (match-end 0)))
+ (if (looking-back eregex (line-beginning-position))
+ (goto-char (or (match-beginning 1)
+ (match-beginning 0)))
+ (re-search-forward eregex nil t)
+ (goto-char (or (match-beginning 1)
+ (match-beginning 0)))))
+ (when (and ;; goto possible start
(re-search-backward bregex nil t)
(push (or (match-end 1)
(match-end 0))