[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[elpa] externals/objed 7374a35 128/166: Improve sexp fallback
From: |
Clemens Radermacher |
Subject: |
[elpa] externals/objed 7374a35 128/166: Improve sexp fallback |
Date: |
Sun, 29 Dec 2019 08:21:13 -0500 (EST) |
branch: externals/objed
commit 7374a354e27c514af5b41765912a2dc1a20c9e22
Author: Clemens Radermacher <address@hidden>
Commit: Clemens Radermacher <address@hidden>
Improve sexp fallback
---
objed-objects.el | 6 +++++-
objed.el | 35 +++++++++++++++++++++--------------
2 files changed, 26 insertions(+), 15 deletions(-)
diff --git a/objed-objects.el b/objed-objects.el
index bead3f7..32e4345 100644
--- a/objed-objects.el
+++ b/objed-objects.el
@@ -1829,7 +1829,11 @@ comments."
(when (/= pos (point))
(cons pos
(point)))))))))
- bounds)
+ (when bounds
+ (objed-make-object
+ :obounds bounds
+ :ibeg (1+ (car bounds))
+ :iend (1- (cdr bounds)))))
:try-next
(or (ignore-errors
(forward-sexp 1)
diff --git a/objed.el b/objed.el
index 6e8d7b1..1aa3b8e 100644
--- a/objed.el
+++ b/objed.el
@@ -1853,17 +1853,20 @@ to an object containing the current one."
(and (or (not (= 0 (skip-syntax-forward "'")))
(not (= 0 (skip-syntax-backward "'"))))
(objed--at-p '(bracket string)))
- (if (equal (bounds-of-thing-at-point 'symbol)
- (objed--bounds))
- 'word
- 'identifier))))
+ (cond ((or (looking-at "\\<[a-z]")
+ (looking-back "[a-z]\\>" (1- (point))))
+ 'word)
+ ((or (looking-at "\\_<[a-z]")
+ (looking-back "[a-z]\\_>" (1- (point))))
+ 'identifier)))))
-(defun objed--switch-to-sexp-fallback (&optional pos)
+(defun objed--maybe-switch-to-sexp-fallback (&optional pos)
"Switch to sexp fallback at POS."
- (let ((fallback (objed--sexp-fallback pos)))
- (when fallback
- (objed--switch-to fallback))))
+ (when (eq objed--object 'sexp)
+ (let ((fallback (objed--sexp-fallback pos)))
+ (when fallback
+ (objed--switch-to fallback)))))
(defun objed--toggle-state ()
"Toggle state of object."
@@ -2011,8 +2014,8 @@ Default to sexp at point."
Switches between inner and whole object state."
(interactive)
- (when (eq objed--object 'sexp)
- (objed--switch-to-sexp-fallback))
+ (unless (objed--inner-p)
+ (objed--maybe-switch-to-sexp-fallback))
(let ((boo (eq (point) (objed--beg)))
(eoo (eq (point) (objed--end))))
(objed--toggle-state)
@@ -3663,8 +3666,10 @@ If nil ‘eval-region’ is used instead.")
(defun objed-forward-slurp-sexp ()
"Slurp following sexp into current object."
(interactive)
- (when (eq objed--object 'sexp)
- (objed--switch-to-sexp-fallback))
+ (unless (memq last-command
+ '(objed-forward-slurp-sexp
+ objed-forward-barf-sexp))
+ (objed--maybe-switch-to-sexp-fallback))
(objed--markify-current-object)
(let ((iend (objed--iend))
(oend (objed--oend)))
@@ -3680,8 +3685,10 @@ If nil ‘eval-region’ is used instead.")
(defun objed-forward-barf-sexp ()
"Barf last sexp out of current object."
(interactive)
- (when (eq objed--object 'sexp)
- (objed--switch-to-sexp-fallback))
+ (unless (memq last-command
+ '(objed-forward-slurp-sexp
+ objed-forward-barf-sexp))
+ (objed--maybe-switch-to-sexp-fallback))
(objed--markify-current-object)
(let ((iend (objed--iend))
(oend (objed--oend)))
- [elpa] externals/objed 6a2663e 138/166: Don't bind C-o by default, (continued)
- [elpa] externals/objed 6a2663e 138/166: Don't bind C-o by default, Clemens Radermacher, 2019/12/29
- [elpa] externals/objed dc23da4 153/166: Add objed-exit-hook #57, Clemens Radermacher, 2019/12/29
- [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 <=
- [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, 2019/12/29
- [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