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

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

[elpa] externals/objed 68bae26 10/59: Give feedback if already at last/f


From: Clemens Radermacher
Subject: [elpa] externals/objed 68bae26 10/59: Give feedback if already at last/first identifier
Date: Sun, 24 Mar 2019 06:06:35 -0400 (EDT)

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

    Give feedback if already at last/first identifier
---
 objed.el | 26 +++++++++++++++++++-------
 1 file changed, 19 insertions(+), 7 deletions(-)

diff --git a/objed.el b/objed.el
index 4565fe8..655a04f 100644
--- a/objed.el
+++ b/objed.el
@@ -1916,20 +1916,32 @@ back to `objed-initial-object' if no match found."
 (defun objed-first-identifier ()
   "Move to first instance of identifier at point."
   (interactive)
-  (let ((ident (objed--get-ident-format)))
-    (when ident
+  (let ((ib (if (looking-at "\\_<") (point)
+              (save-excursion
+                (re-search-backward "\\_<")
+                (point))))
+        (format (objed--get-ident-format)))
+    (when format
       (goto-char (point-min))
-      (when (re-search-forward ident nil t)
-        (goto-char (match-beginning 0))))))
+      (when (re-search-forward format nil t)
+        (goto-char (match-beginning 0))
+        (when (= (point) ib)
+          (message "No previous indentifier"))))))
 
 ;;;###autoload
 (defun objed-last-identifier ()
   "Move to last instance of identifier at point."
   (interactive)
-  (let ((ident (objed--get-ident-format)))
-    (when ident
+  (let ((ib (if (looking-at "\\_<") (point)
+              (save-excursion
+                (re-search-backward "\\_<")
+                (point))))
+        (format (objed--get-ident-format)))
+    (when format
       (goto-char (point-max))
-      (re-search-backward ident nil t))))
+      (re-search-backward format nil t)
+      (when (= (point) ib)
+        (message "No next indentifier")))))
 
 ;;;###autoload
 (defun objed-next-identifier ()



reply via email to

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