[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[nongnu] elpa/evil-matchit 5ff747a1ef 125/244: When jumping find the fir
From: |
ELPA Syncer |
Subject: |
[nongnu] elpa/evil-matchit 5ff747a1ef 125/244: When jumping find the first matching keyword in the current line |
Date: |
Thu, 6 Jan 2022 02:58:55 -0500 (EST) |
branch: elpa/evil-matchit
commit 5ff747a1eff026bc89298f620e1df59da6fe1cd6
Author: Tomasz KoĆodziejski <tkolodziejski@gmail.com>
Commit: Tomasz KoĆodziejski <tkolodziejski@gmail.com>
When jumping find the first matching keyword in the current line
Make ocaml's jump behave more like vim's %:
"Find the next item in this line after or under the cursor and jump to its
match."
---
evil-matchit-ocaml.el | 23 +++++++++++++++++------
1 file changed, 17 insertions(+), 6 deletions(-)
diff --git a/evil-matchit-ocaml.el b/evil-matchit-ocaml.el
index 53cff0d482..7f84c7ffa9 100644
--- a/evil-matchit-ocaml.el
+++ b/evil-matchit-ocaml.el
@@ -8,13 +8,15 @@
())
"Ocaml keywords.")
+(defvar evilmi-ocaml-all-keywords
+ (apply 'append (apply 'append evilmi-ocaml-keywords)))
+
(defvar evilmi-ocaml-keywords-regex
- (let ((all-keywords (apply 'append (apply 'append evilmi-ocaml-keywords))))
- (format "\\<\\(%s\\)\\>" (mapconcat 'identity all-keywords "\\|")))
+ (format "\\<\\(%s\\)\\>" (mapconcat 'identity evilmi-ocaml-all-keywords
"\\|"))
"Regexp to find next/previous keyword.")
;; jumps to next keyword. Returs nil if there's no next word
-(defun evilmi-ocaml-next-word (direction)
+(defun evilmi-ocaml-next-keyword (direction)
(if (= direction 0)
(let ((new-point (save-excursion
(forward-char)
@@ -46,7 +48,7 @@
(defun evilmi-ocaml-go (tag-info level direction)
(if (= level 0)
(point)
- (if (evilmi-ocaml-next-word direction)
+ (if (evilmi-ocaml-next-keyword direction)
(progn
(setq keyword (evilmi-ocaml-get-word))
@@ -61,8 +63,17 @@
nil)))
(defun evilmi-ocaml-goto-word-beginning ()
- (let ((bounds (bounds-of-thing-at-point 'word)))
- (if bounds (goto-char (car bounds)))))
+ (let ((bounds (bounds-of-thing-at-point 'word))
+ (word (thing-at-point 'word))
+ (line-end (line-end-position)))
+ (if bounds (goto-char (car bounds)))
+ (let ((next-keyword
+ (save-excursion
+ (if (find word evilmi-ocaml-all-keywords :test 'equal)
+ (point)
+ (evilmi-ocaml-next-keyword 0)
+ (if (< (point) line-end) (point))))))
+ (if next-keyword (goto-char next-keyword)))))
;;;###autoload
(defun evilmi-ocaml-get-tag ()
- [nongnu] elpa/evil-matchit 296c31f93d 073/244: Fix matching multiple arguments and varibles with underscores in do/end blocks., (continued)
- [nongnu] elpa/evil-matchit 296c31f93d 073/244: Fix matching multiple arguments and varibles with underscores in do/end blocks., ELPA Syncer, 2022/01/06
- [nongnu] elpa/evil-matchit 9a1b6ac1f9 076/244: can jump between brackets in visual-state #42, ELPA Syncer, 2022/01/06
- [nongnu] elpa/evil-matchit 11352e24ff 083/244: support more pattern in lua-mode, ELPA Syncer, 2022/01/06
- [nongnu] elpa/evil-matchit e831d42aa5 085/244: relax regex for python matching, ELPA Syncer, 2022/01/06
- [nongnu] elpa/evil-matchit 3c9d97f3d3 090/244: Merge pull request #60 from robbyoconnor/patch-1, ELPA Syncer, 2022/01/06
- [nongnu] elpa/evil-matchit 14e23187df 093/244: Put the melpa badges on the same line, ELPA Syncer, 2022/01/06
- [nongnu] elpa/evil-matchit 8b80b3df94 098/244: correct inner text-object in python-mode v2.1.2, ELPA Syncer, 2022/01/06
- [nongnu] elpa/evil-matchit 1a5c4454a7 111/244: support verilog, ELPA Syncer, 2022/01/06
- [nongnu] elpa/evil-matchit ceb13ad1b3 131/244: use more generic when processing C, ELPA Syncer, 2022/01/06
- [nongnu] elpa/evil-matchit df642d953d 139/244: add a few APIs, ELPA Syncer, 2022/01/06
- [nongnu] elpa/evil-matchit 5ff747a1ef 125/244: When jumping find the first matching keyword in the current line,
ELPA Syncer <=
- [nongnu] elpa/evil-matchit 18cf34bc62 150/244: Update evil-matchit-verilog.el, ELPA Syncer, 2022/01/06
- [nongnu] elpa/evil-matchit f87f03bbf4 169/244: add generic rule to jump between brackets, ELPA Syncer, 2022/01/06
- [nongnu] elpa/evil-matchit 00ab601346 161/244: support "define_method(method) do |*args|", ELPA Syncer, 2022/01/06
- [nongnu] elpa/evil-matchit 77c4a0a1d9 175/244: Ocaml: double semicolon matches let., ELPA Syncer, 2022/01/06
- [nongnu] elpa/evil-matchit 2ea15db747 185/244: improve ruby matching algorithm (fixed item 1 of #114), ELPA Syncer, 2022/01/06
- [nongnu] elpa/evil-matchit e44de538b9 196/244: clean code & doc, ELPA Syncer, 2022/01/06
- [nongnu] elpa/evil-matchit 574d3c4e45 209/244: emacs 24.4 does not have font-lock-ensure, ELPA Syncer, 2022/01/06
- [nongnu] elpa/evil-matchit 2337748d26 214/244: autoload evilmi-prompt-line-p, ELPA Syncer, 2022/01/06
- [nongnu] elpa/evil-matchit 43a626541d 025/244: support script language, v1.1.0, ELPA Syncer, 2022/01/06
- [nongnu] elpa/evil-matchit 7ff2b954c0 015/244: user can customize key binding, v0.0.6, ELPA Syncer, 2022/01/06