branch: elpa/evil-nerd-commenter
commit e4741fb3e03a7f90fd9781f42aff95354b340276
Author: Chen Bin <[email protected]>
Commit: Chen Bin <[email protected]>
Latest web-mode remove web-mode-is-comment v1.5.13
---
README.org | 6 +++---
evil-nerd-commenter.el | 13 ++++++++++---
pkg.sh | 2 +-
3 files changed, 14 insertions(+), 7 deletions(-)
diff --git a/README.org b/README.org
index a8e9171892..0a33bab8e0 100644
--- a/README.org
+++ b/README.org
@@ -1,6 +1,6 @@
-* evil-nerd-commenter (v1.5.12)
+* evil-nerd-commenter (v1.5.13)
-*This program can be used independently WITHOUT
[[http://www.emacswiki.org/Evil][Evil]]!*
+This program can be used *independently WITHOUT
[[http://www.emacswiki.org/Evil][Evil]]!*
A [[http://www.vim.org/scripts/script.php?script_id=1218][Nerd Commenter]]
emulation, help you comment code efficiently. For example, you can press key
`,,99j` or `99,ci` to comment out 99 lines.
@@ -89,7 +89,7 @@ If you don't use package manager please insert below code
into your ~/.emacs:
* Usage
** Available commands and hotkeys
-Here are available commands. They are not dependent on
[[http://emacswiki.org/emacs/Evil][evil-mode]]:
+Here are available commands. They are NOT dependent on
[[http://emacswiki.org/emacs/Evil][evil-mode]]:
*** evilnc-comment-or-uncomment-lines (RECOMMENDED)
comment/uncomment lines. This command supports negative arguments.
diff --git a/evil-nerd-commenter.el b/evil-nerd-commenter.el
index 43a77823bd..8d078bb0bb 100644
--- a/evil-nerd-commenter.el
+++ b/evil-nerd-commenter.el
@@ -108,6 +108,13 @@
(re-search-forward "[\n\C-m]" nil 'end (1- line))
(forward-line (1- line)))))
+;; Since web-mode changes, the best way is to replace it with my own API
+(defun evilnc--web-mode-is-comment (&optional pos)
+ (unless pos (setq pos (point)))
+ (not (null (or (eq (get-text-property pos 'tag-type) 'comment)
+ (eq (get-text-property pos 'block-token) 'comment)
+ (eq (get-text-property pos 'part-token) 'comment)))))
+
(defun evilnc--fix-buggy-major-modes ()
"fix major modes whose comment regex is buggy.
@see http://lists.gnu.org/archive/html/bug-gnu-emacs/2013-03/msg00891.html"
@@ -296,12 +303,12 @@
(goto-char beg)
(goto-char (line-end-position))
(re-search-backward "^\\|[^[:space:]]")
- (web-mode-is-comment))
- (web-mode-is-comment (/ (+ beg end) 2))
+ (evilnc--web-mode-is-comment))
+ (evilnc--web-mode-is-comment (/ (+ beg end) 2))
(save-excursion
(goto-char end)
(back-to-indentation)
- (web-mode-is-comment))
+ (evilnc--web-mode-is-comment))
)
;; don't know why, but we need goto the middle of comment
;; in order to uncomment, or else trailing spaces will be appended
diff --git a/pkg.sh b/pkg.sh
index 4f44efd229..5707a77170 100755
--- a/pkg.sh
+++ b/pkg.sh
@@ -1,5 +1,5 @@
#!/bin/bash
-pkg=evil-nerd-commenter-1.5.12
+pkg=evil-nerd-commenter-1.5.13
mkdir $pkg
cp README.org $pkg
cp *.el $pkg