branch: elpa/evil-matchit commit 437f67689cc4685b92428986b5823093aa0be054 Author: Chen Bin <chenbin...@gmail.com> Commit: Chen Bin <chenbin...@gmail.com>
fix f90-mode bug, add fortran unit test --- evil-matchit-sdk.el | 4 ++-- evil-matchit.el | 6 ++--- pkg.sh | 2 +- tests/evil-matchit-tests.el | 56 +++++++++++++++++++++++++++++++++++++++++++++ 4 files changed, 62 insertions(+), 6 deletions(-) diff --git a/evil-matchit-sdk.el b/evil-matchit-sdk.el index 0f96387ba1..6a28ead799 100644 --- a/evil-matchit-sdk.el +++ b/evil-matchit-sdk.el @@ -129,8 +129,8 @@ If IS-FORWARD is t, jump forward; or else jump backward." (defun evilmi-sdk-adjust-jumpto (is-forward rlt) ;; normal-state hack! - (unless (eq evil-state 'visual) - (if is-forward (setq rlt (- rlt 1)))) + (when (and (not (eq evil-state 'visual)) rlt is-forward) + (setq rlt (- rlt 1))) (if evilmi-debug (message "evilmi-sdk-adjust-jumpto => %s" rlt)) rlt) diff --git a/evil-matchit.el b/evil-matchit.el index 2f3bfa0b31..4f30491963 100644 --- a/evil-matchit.el +++ b/evil-matchit.el @@ -4,7 +4,7 @@ ;; Author: Chen Bin <chenbin DOT sh AT gmail DOT com> ;; URL: http://github.com/redguardtoo/evil-matchit -;; Version: 2.3.6 +;; Version: 2.3.7 ;; Keywords: matchit vim evil ;; Package-Requires: ((evil "1.2.0") (emacs "24.4")) ;; @@ -186,7 +186,7 @@ Some people prefer using \"m\" instead.") '(simple diff)) ;; Fortran - (evilmi-load-plugin-rules '(f90 fortran-mode) '(fortran)) + (evilmi-load-plugin-rules '(f90-mode fortran-mode) '(fortran)) ;; CMake (http://www.cmake.org) (evilmi-load-plugin-rules '(cmake-mode) '(cmake)) @@ -307,7 +307,7 @@ If IS-INNER is t, the region is inner text object." (defun evilmi-version() "Print version." (interactive) - (message "2.3.6")) + (message "2.3.7")) (defvar evil-matchit-mode-map (make-sparse-keymap) "Keymap used by the minor mode.") diff --git a/pkg.sh b/pkg.sh index 94e35e8450..37a74b3bf4 100755 --- a/pkg.sh +++ b/pkg.sh @@ -1,6 +1,6 @@ #!/bin/bash name=evil-matchit -version=2.3.6 +version=2.3.7 pkg=$name-$version mkdir $pkg cp README.org $pkg diff --git a/tests/evil-matchit-tests.el b/tests/evil-matchit-tests.el index d0e786fcc5..6a247246e0 100644 --- a/tests/evil-matchit-tests.el +++ b/tests/evil-matchit-tests.el @@ -287,5 +287,61 @@ (should (string= "line2" (evilmi-sdk-curline))) (should (eq major-mode 'diff-mode)))) +(ert-deftest evilmi-test-fortran () + (with-temp-buffer + (insert "PROGRAM cows\n" + "IMPLICIT NONE\n" + "INTEGER :: func_name\n" + "PRINT *,func_name(2, 1.3)\n" + "END PROGRAM\n") + (f90-mode) + + (goto-char (point-min)) + ;; jump to end tag + (evilmi-jump-items) + (should (string= "END PROGRAM" (evilmi-sdk-curline))) + ;; jump back to open tags + (evilmi-jump-items) + (should (string= "PROGRAM cows" (evilmi-sdk-curline))) + + ;; lower case conditional statement + (erase-buffer) + (insert "if (x < x1) then\n" + " print 1\n" + "else\n" + " print 2\n" + "end if\n") + (goto-char (point-min)) + (evilmi-jump-items) + (should (string= "else" (evilmi-sdk-curline))) + (evilmi-jump-items) + (should (string= "end if" (evilmi-sdk-curline))) + (evilmi-jump-items) + (should (string= "if (x < x1) then" (evilmi-sdk-curline))) + + ;; upper case conditional statement + (erase-buffer) + (insert "IF (x < 50) THEN\n" + " Grade = 'F'\n" + "ELSE IF (x < 60) THEN\n" + " Grade = 'D'\n" + "ELSE IF (x < 70) THEN\n" + " Grade = 'C'\n" + "ELSE\n" + " Grade = 'A'\n" + "END IF\n") + (goto-char (point-min)) + (evilmi-jump-items) + (should (string= "ELSE IF (x < 60) THEN" (evilmi-sdk-curline))) + (evilmi-jump-items) + (should (string= "ELSE IF (x < 70) THEN" (evilmi-sdk-curline))) + (evilmi-jump-items) + (should (string= "ELSE" (evilmi-sdk-curline))) + (evilmi-jump-items) + (should (string= "END IF" (evilmi-sdk-curline))) + + ;; upper case conditional statement + (should (eq major-mode 'f90-mode)))) + (ert-run-tests-batch-and-exit) ;;; evil-matchit-tests.el ends here