branch: externals/objed
commit f9c3819f90908baf76fbd461cdb918a3cb098088
Author: Clemens Radermacher <[email protected]>
Commit: Clemens Radermacher <[email protected]>
Tweak sexp object again
---
objed-objects.el | 35 +++++++++++++++++++++++------------
1 file changed, 23 insertions(+), 12 deletions(-)
diff --git a/objed-objects.el b/objed-objects.el
index db2df7d..6521826 100644
--- a/objed-objects.el
+++ b/objed-objects.el
@@ -1573,19 +1573,30 @@ comments."
(let* ((opos (point))
(objed--block-p t)
(real-this-command 'forward-sexp)
+ (instring (objed--in-string-p nil t))
(other nil)
- (atp (or (save-excursion
- (ignore-errors
- (forward-sexp 1)
- (setq other (point))
- (forward-sexp -1)
- (= (point) opos)))
- (save-excursion
- (ignore-errors
- (forward-sexp -1)
- (setq other (point))
- (forward-sexp 1)
- (= (point) opos))))))
+ (atp (or (when (or (bobp)
+ ;; prevent the annoying "feature" that sexp
+ ;; movement works across strings
+ (not instring)
+ (not (eq (char-syntax (char-after)) ?\")))
+ (save-excursion
+ (ignore-errors
+ (forward-sexp 1)
+ (setq other (point))
+ (forward-sexp -1)
+ (= (point) opos))))
+ (when (or (eobp)
+ ;; prevent the annoying "feature" that sexp
+ ;; movement works across strings
+ (not instring)
+ (not (eq (char-syntax (char-before)) ?\")))
+ (save-excursion
+ (ignore-errors
+ (forward-sexp -1)
+ (setq other (point))
+ (forward-sexp 1)
+ (= (point) opos)))))))
(when atp
(cons (min opos other)