[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[nongnu] elpa/evil-matchit dbaae2b753 127/244: Merge pull request #81 fr
From: |
ELPA Syncer |
Subject: |
[nongnu] elpa/evil-matchit dbaae2b753 127/244: Merge pull request #81 from neojski/ocaml |
Date: |
Thu, 6 Jan 2022 02:58:55 -0500 (EST) |
branch: elpa/evil-matchit
commit dbaae2b7537aadb2e44a8915745ee190768b4b2a
Merge: bed39041b1 4a24de3862
Author: Chen Bin <chenbin.sh@gmail.com>
Commit: GitHub <noreply@github.com>
Merge pull request #81 from neojski/ocaml
Ocaml improvements
---
evil-matchit-ocaml.el | 52 ++++++++++++++++++++++++++++++++++++++++++++-------
1 file changed, 45 insertions(+), 7 deletions(-)
diff --git a/evil-matchit-ocaml.el b/evil-matchit-ocaml.el
index 3c2af0577f..8626d17247 100644
--- a/evil-matchit-ocaml.el
+++ b/evil-matchit-ocaml.el
@@ -1,3 +1,31 @@
+;;; evil-matchit-ocaml.el -- tuareg-mode plugin of evil-matchit
+
+;; Copyright (C) 2014-2017 Chen Bin <chenbin.sh@gmail.com>
+
+;; Author: Tomasz KoĆodziejski <tkolodziejski@gmail.com>
+
+;; This file is not part of GNU Emacs.
+
+;;; License:
+
+;; This file is part of evil-matchit
+;;
+;; evil-matchit is free software: you can redistribute it and/or
+;; modify it under the terms of the GNU General Public License as published
+;; by the Free Software Foundation, either version 3 of the License, or
+;; (at your option) any later version.
+;;
+;; evil-matchit is distributed in the hope that it will be useful,
+;; but WITHOUT ANY WARRANTY; without even the implied warranty of
+;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+;; GNU General Public License for more details.
+;;
+;; You should have received a copy of the GNU General Public License
+;; along with this program. If not, see <http://www.gnu.org/licenses/>.
+
+
+;;; Code:
+
(defvar evilmi-ocaml-keywords
'((("struct" "begin" "sig" "object") ("end"))
(("if") ("then"))
@@ -8,13 +36,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 +76,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,9 +91,17 @@
nil)))
(defun evilmi-ocaml-goto-word-beginning ()
- ;; this is so that when the cursor is on the first character we don't jump
to previous word
- (forward-char)
- (search-backward-regexp "\\<"))
+ (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 c675e740a7 101/244: can simple jump in latex-mode, #70, (continued)
- [nongnu] elpa/evil-matchit c675e740a7 101/244: can simple jump in latex-mode, #70, ELPA Syncer, 2022/01/06
- [nongnu] elpa/evil-matchit 34c51f68fd 102/244: jump in diff-mode, ELPA Syncer, 2022/01/06
- [nongnu] elpa/evil-matchit 64791bc376 105/244: clean code, ELPA Syncer, 2022/01/06
- [nongnu] elpa/evil-matchit 51d46747e3 108/244: support Facebook React JSX, ELPA Syncer, 2022/01/06
- [nongnu] elpa/evil-matchit 8a56092b38 110/244: can handle `render()` in jsx, code cleaned, ELPA Syncer, 2022/01/06
- [nongnu] elpa/evil-matchit bed39041b1 123/244: support markdown, ELPA Syncer, 2022/01/06
- [nongnu] elpa/evil-matchit 7d65b4167b 156/244: clean plugins setup code, ELPA Syncer, 2022/01/06
- [nongnu] elpa/evil-matchit b63f840ee7 124/244: When on whitespace following a keyword don't jump backwards, ELPA Syncer, 2022/01/06
- [nongnu] elpa/evil-matchit 20270ab6b0 135/244: support one liner, ELPA Syncer, 2022/01/06
- [nongnu] elpa/evil-matchit 51d8b268e5 138/244: Merge pull request #86 from yqrashawn/support-tsx, ELPA Syncer, 2022/01/06
- [nongnu] elpa/evil-matchit dbaae2b753 127/244: Merge pull request #81 from neojski/ocaml,
ELPA Syncer <=
- [nongnu] elpa/evil-matchit dea3fca13b 168/244: clean code dependency, ELPA Syncer, 2022/01/06
- [nongnu] elpa/evil-matchit 64b572d2e4 166/244: Merge pull request #107 from porras/patch-2, ELPA Syncer, 2022/01/06
- [nongnu] elpa/evil-matchit 2a53963ffc 182/244: support php-mode, ELPA Syncer, 2022/01/06
- [nongnu] elpa/evil-matchit 076ace3ee2 188/244: README, ELPA Syncer, 2022/01/06
- [nongnu] elpa/evil-matchit ec0ea006e9 184/244: improve html tag matching algorithm, ELPA Syncer, 2022/01/06
- [nongnu] elpa/evil-matchit 943bf5fb2b 189/244: ruby code might use tab, ELPA Syncer, 2022/01/06
- [nongnu] elpa/evil-matchit b363d12390 202/244: fix evil-matchit-diff, ELPA Syncer, 2022/01/06
- [nongnu] elpa/evil-matchit 7cd10d332d 191/244: extra logic to find html open tag, ELPA Syncer, 2022/01/06
- [nongnu] elpa/evil-matchit 3076a8ca5d 232/244: org-mode can use simple rule, ELPA Syncer, 2022/01/06
- [nongnu] elpa/evil-matchit 8fba4f12e1 208/244: minor issue in emacs lisp comment, ELPA Syncer, 2022/01/06