emacs-elpa-diffs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[elpa] externals/objed f9c3819 020/166: Tweak sexp object again


From: Clemens Radermacher
Subject: [elpa] externals/objed f9c3819 020/166: Tweak sexp object again
Date: Sun, 29 Dec 2019 08:20:53 -0500 (EST)

branch: externals/objed
commit f9c3819f90908baf76fbd461cdb918a3cb098088
Author: Clemens Radermacher <address@hidden>
Commit: Clemens Radermacher <address@hidden>

    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)



reply via email to

[Prev in Thread] Current Thread [Next in Thread]