[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[elpa] externals/objed 94436f0 6/9: Fallback to previous object if no ne
From: |
Clemens Radermacher |
Subject: |
[elpa] externals/objed 94436f0 6/9: Fallback to previous object if no next found |
Date: |
Sun, 24 Mar 2019 19:51:46 -0400 (EDT) |
branch: externals/objed
commit 94436f0924e6ade551af2b9832312b17eb16754c
Author: Clemens Radermacher <address@hidden>
Commit: Clemens Radermacher <address@hidden>
Fallback to previous object if no next found
---
objed-objects.el | 22 +++++++++++++++++++---
objed.el | 6 +++---
2 files changed, 22 insertions(+), 6 deletions(-)
diff --git a/objed-objects.el b/objed-objects.el
index 2115acf..76d8c7c 100644
--- a/objed-objects.el
+++ b/objed-objects.el
@@ -967,9 +967,25 @@ STATE is the state for the object and defaults to whole.
If ODATA
is non-nil it is used as object position data, otherwise
calculate the data of the object at current position using
`objed--get'."
- (setq objed--object o)
- (setq objed--obj-state (or state 'whole))
- (setq objed--current-obj (or odata (objed--get))))
+ (let ((odata (let* ((objed--object o)
+ (objed--obj-state (or state 'whole))
+ (tryb t))
+ (or odata
+ ;; FIXME: all default objects should throw an error
+ ;; if try-next, try-prev fails.
+ (condition-case nil
+ (or (objed--get)
+ (setq tryb nil)
+ (objed--get t))
+ (error
+ (when tryb
+ (objed--get t))))))))
+ (if odata
+ (setq objed--object o
+ objed--obj-state (or state 'whole)
+ objed--current-obj odata)
+ (prog1 nil
+ (message "No %s found." o)))))
(defun objed--distant-p (o)
diff --git a/objed.el b/objed.el
index 390ff40..4a558f2 100644
--- a/objed.el
+++ b/objed.el
@@ -1230,13 +1230,13 @@ or object position data."
;; if anything went wrong make sure to start with clean state
(when objed--buffer
(objed--reset))
- ;; (unless objed--buffer
- (setq objed--current-obj nil)
- (setq objed--obj-state 'whole)
+ ;; (setq objed--current-obj nil)
+ ;; (setq objed--obj-state 'whole)
(setq objed--buffer (current-buffer))
(add-hook 'pre-command-hook 'objed--push-state nil t)
(add-hook 'post-command-hook 'objed--check-buffer)
+
(pcase-dolist
(`(,var . ,val)
`((hl-line-range-function . objed-hl-function)
- [elpa] externals/objed updated (fee7fb9 -> 4798b5b), Clemens Radermacher, 2019/03/24
- [elpa] externals/objed 567f5e2 2/9: Update bindings, Clemens Radermacher, 2019/03/24
- [elpa] externals/objed f94f230 1/9: Init expand object (when called via M-o), Clemens Radermacher, 2019/03/24
- [elpa] externals/objed 326fdc7 7/9: Improve ace-object, Clemens Radermacher, 2019/03/24
- [elpa] externals/objed 4be5dd7 3/9: Describe changes for 0.8, Clemens Radermacher, 2019/03/24
- [elpa] externals/objed 94436f0 6/9: Fallback to previous object if no next found,
Clemens Radermacher <=
- [elpa] externals/objed 5c450d1 4/9: Improve shrink context, Clemens Radermacher, 2019/03/24
- [elpa] externals/objed 4798b5b 9/9: Version bump, Clemens Radermacher, 2019/03/24
- [elpa] externals/objed 5fbc821 5/9: Fix name clash of mail object with mail command, Clemens Radermacher, 2019/03/24
- [elpa] externals/objed 5714dc0 8/9: Ignore errors when collecting objects, Clemens Radermacher, 2019/03/24