branch: externals/objed
commit d0fb9c64d853252c63b34a9f2feaf0e94927456a
Author: Clemens Radermacher <[email protected]>
Commit: Clemens Radermacher <[email protected]>
Allow wrap for identifier navigation
---
objed-objects.el | 14 ++++++++++++--
objed.el | 10 ++++++----
2 files changed, 18 insertions(+), 6 deletions(-)
diff --git a/objed-objects.el b/objed-objects.el
index 22c29d5..12f74aa 100644
--- a/objed-objects.el
+++ b/objed-objects.el
@@ -2545,7 +2545,16 @@ non-nil the indentation block can contain empty lines."
(goto-char (car bds))
(when (or (eq real-this-command #'objed-next-identifier)
(eq real-this-command #'objed-goto-next-identifier))
- (run-at-time 0 nil (apply-partially #'message "No next
identifier"))))))))
+ (objed-first-identifier)
+ (objed--flash-object 'match)))))))
+
+(defun objed--flash-object (face &optional time)
+ "Flash current object using FACE for TIME (defaults to 0.4)."
+ (let ((cookie (face-remap-add-relative
+ 'objed-hl face)))
+ (run-at-time (or time .3) nil
+ (lambda ()
+ (face-remap-remove-relative cookie)))))
(defun objed--prev-identifier ()
"Move to previous identifier."
@@ -2563,7 +2572,8 @@ non-nil the indentation block can contain empty lines."
(goto-char (car bds))
(when (or (eq real-this-command #'objed-prev-identifier)
(eq real-this-command #'objed-goto-prev-identifier))
- (run-at-time 0 nil (apply-partially #'message "No previous
identifier")))))))))
+ (objed-last-identifier)
+ (objed--flash-object 'match))))))))
diff --git a/objed.el b/objed.el
index 3de48e9..48f7b55 100644
--- a/objed.el
+++ b/objed.el
@@ -2287,8 +2287,9 @@ On repeat or at boundary move to next."
(goto-char (point-min))
(when (re-search-forward format nil t)
(goto-char (match-beginning 0))
- (when (= (point) ib)
- (message "No previous indentifier"))))))
+ (if (= (point) ib)
+ (message "No other instance found")
+ (message "Moved to first insance"))))))
;;;###autoload
(defun objed-last-identifier ()
@@ -2302,8 +2303,9 @@ On repeat or at boundary move to next."
(when format
(goto-char (point-max))
(re-search-backward format nil t)
- (when (= (point) ib)
- (message "No next indentifier")))))
+ (if (= (point) ib)
+ (message "No other instance found")
+ (message "Moved to last insance")))))
;;;###autoload
(defun objed-next-identifier ()