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

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

[elpa] externals/objed 70f20ec 1/9: Add objed-mode commands to move to f


From: Clemens Radermacher
Subject: [elpa] externals/objed 70f20ec 1/9: Add objed-mode commands to move to first last instance of identifier
Date: Fri, 1 Mar 2019 15:30:42 -0500 (EST)

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

    Add objed-mode commands to move to first last instance of identifier
---
 objed-objects.el | 28 +++++++++++++++++++++++++++-
 objed.el         |  5 +++++
 2 files changed, 32 insertions(+), 1 deletion(-)

diff --git a/objed-objects.el b/objed-objects.el
index 8955892..d04a3cd 100644
--- a/objed-objects.el
+++ b/objed-objects.el
@@ -2011,7 +2011,7 @@ non-nil the indentation block can contain empty lines."
 (defun objed-next-identifier ()
   "Move to next identifier."
   (interactive)
-   (let ((bds nil))
+  (let ((bds nil))
     (if (not (setq bds (bounds-of-thing-at-point 'symbol)))
         (re-search-forward  "\\_<" nil t)
       (let ((sym (and (or bds (setq bds (bounds-of-thing-at-point 'symbol)))
@@ -2044,6 +2044,32 @@ non-nil the indentation block can contain empty lines."
                       (eq real-this-command #'objed-prev-identifier))
               (run-at-time 0 nil (apply-partially #'message "First 
one!")))))))))
 
+(defun objed--get-ident-format ()
+  (let ((sym (or (symbol-at-point)
+                 (and (re-search-forward "\\_<" nil t)
+                      (symbol-at-point)))))
+    (when sym
+      (format "\\_<%s\\_>" sym))))
+
+;;;###autoload
+(defun objed-first-identifier ()
+  "Move to first instance of identifier at point."
+  (interactive)
+  (let ((ident (objed--get-ident-format)))
+    (when ident
+      (goto-char (point-min))
+      (when (re-search-forward ident nil t)
+        (goto-char (match-beginning 0))))))
+
+;;;###autoload
+(defun objed-last-identifier ()
+  "Move to last instance of identifier at point."
+  (interactive)
+  (let ((ident (objed--get-ident-format)))
+    (when ident
+      (goto-char (point-max))
+      (re-search-backward ident nil t))))
+
 
 (objed-define-object nil section
   :atp
diff --git a/objed.el b/objed.el
index a608440..be44287 100644
--- a/objed.el
+++ b/objed.el
@@ -233,6 +233,8 @@ function should return nil if objed should not initialize."
     (Info-prev-reference . face)
     (objed-next-identifier . identifier)
     (objed-prev-identifier . identifier)
+    (objed-first-identifier . identifier)
+    (objed-last-identifier . identifier)
     ;; editing entry commands
     (yank . region)
     (yank-pop . region)
@@ -3158,6 +3160,8 @@ whitespace they build a sequence."
     (define-key map (kbd "M-]") 'objed-end-of-object-at-point)
     (define-key map (kbd "C-,") 'objed-prev-identifier)
     (define-key map (kbd "C-.") 'objed-identifier-object)
+    (define-key map (kbd "C-<") 'objed-first-identifier)
+    (define-key map (kbd "C->") 'objed-last-identifier)
     map)
   "Keymap for /function`objed-mode'.")
 
@@ -3183,6 +3187,7 @@ and `avy' if they are available. This can be deactivated 
by
 setting the user options `objed-use-which-key-if-available-p' and
 `objed-use-avy-if-available-p' before loading."
   :global t
+  :keymap objed-mode-map
   :require 'objed
   (if objed-mode
       (progn



reply via email to

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