branch: elpa/evil-nerd-commenter
commit cf1f57921dbf34bd6b42be0839b9645c20514401
Author: Chen Bin <[email protected]>
Commit: Chen Bin <[email protected]>
can comment html paragraphs
---
README.org | 8 ++++++--
evil-nerd-commenter.el | 52 +++++++++++++++++++++++++++++++++++++-------------
pkg.sh | 2 +-
3 files changed, 46 insertions(+), 16 deletions(-)
diff --git a/README.org b/README.org
index fb5c1be217..09d7a57a07 100644
--- a/README.org
+++ b/README.org
@@ -1,4 +1,4 @@
-* evil-nerd-commenter (v3.3.0)
+* evil-nerd-commenter (v3.3.1)
[[http://melpa.org/#/evil-nerd-commenter][file:http://melpa.org/packages/evil-nerd-commenter-badge.svg]]
[[http://stable.melpa.org/#/evil-nerd-commenter][file:http://stable.melpa.org/packages/evil-nerd-commenter-badge.svg]]
@@ -96,7 +96,7 @@ For example, say current line number is 497. =C-u 3 M-x
evilnc-quick-comment-or-
The hotkey is ",cl" or ",ll" in evil-mode and =C-c l= (C means Ctrl key) in
emacs normal mode.
*** evilnc-comment-or-uncomment-paragraphs
-comment/uncomment paragraphs which separated by empty lines
+comment/uncomment paragraphs which is separated by empty lines.
*** evilnc-copy-and-comment-lines
Copy and paste lines, then comment out original lines. This command supports
negative arguments.
@@ -122,6 +122,10 @@ If user manually selects region, the region could cross
multiple sibling tags an
JSX from ReactJS like ={/* ... */}= is the default comment syntax.
Customize =evilnc-html-comment-end= and =evilnc-html-comment-end= to use
different syntax.
+
+Or you can use =evilnc-comment-or-uncomment-html-paragraphs= to
comment/uncomment paragraphs containing html tags.
+
+Paragraph is text separated by empty lines.
*** evilnc-toggle-comment-empty-lines
Toggle the flag to comment/uncomment empty lines.
diff --git a/evil-nerd-commenter.el b/evil-nerd-commenter.el
index 8c5b786890..f1a129fe7f 100644
--- a/evil-nerd-commenter.el
+++ b/evil-nerd-commenter.el
@@ -4,7 +4,7 @@
;; Author: Chen Bin <[email protected]>
;; URL: http://github.com/redguardtoo/evil-nerd-commenter
-;; Version: 3.3.0
+;; Version: 3.3.1
;; Package-Requires: ((emacs "24.4"))
;; Keywords: commenter vim line evil
;;
@@ -82,6 +82,8 @@
;; "\\" 'evilnc-comment-operator)
;;
;; `evilnc-comment-or-uncomment-html-tag' comment/uncomment html tag(s).
+;; `evilnc-comment-or-uncomment-html-paragraphs' comment/uncomment paragraphs
+;; containing html tags.
;;
;; You can setup `evilnc-original-above-comment-when-copy-and-comment'
;; to decide which style to use when `evilnc-copy-and-comment-lines'
@@ -421,7 +423,7 @@ DO-COMMENT decides we comment or uncomment."
(setq line-cnt (1- line-cnt))))))
(defun evilnc--comment-or-uncomment-region (beg end)
- "Comment or uncommment region from BEG to END."
+ "Comment or uncomment region from BEG to END."
(cond
((eq major-mode 'web-mode)
;; elixir is not supported in web-mode for now
@@ -457,12 +459,8 @@ If UNITS is 16, line 16, line 116, and line 216 are good
candidates."
;; ==== below this line are public commands
-;;;###autoload
-(defun evilnc-comment-or-uncomment-paragraphs (&optional num)
- "Comment or uncomment NUM paragraph(s).
-A paragraph is a continuation non-empty lines.
-Paragraphs are separated by empty lines."
- (interactive "p")
+(defun evilnc-do-paragraphs (action num)
+ "Apply ACTION on NUM paragraphs."
(let* ((i 0)
rlt
(b (point-max))
@@ -492,8 +490,19 @@ Paragraphs are separated by empty lines."
(when (<= b e)
(save-excursion
- (evilnc--fix-buggy-major-modes)
- (evilnc--comment-or-uncomment-region b e)))))
+ (funcall action b e)))))
+
+;;;###autoload
+(defun evilnc-comment-or-uncomment-paragraphs (&optional num)
+ "Comment or uncomment NUM paragraph(s).
+A paragraph is a continuation non-empty lines.
+Paragraphs are separated by empty lines."
+ (interactive "p")
+ (evilnc-do-paragraphs
+ (lambda (b e)
+ (evilnc--fix-buggy-major-modes)
+ (evilnc--comment-or-uncomment-region b e))
+ num))
;;;###autoload
(defun evilnc-comment-or-uncomment-to-the-line (&optional LINENUM)
@@ -515,7 +524,7 @@ Paragraphs are separated by empty lines."
;;;###autoload
(defun evilnc-quick-comment-or-uncomment-to-the-line (&optional units)
"Comment/uncomment to line number by last digit(s) whose value is UNITS.
-For exmaple, you can use either \
+For example, you can use either \
\\<M-53>\\[evilnc-quick-comment-or-uncomment-to-the-line] \
or \\<M-3>\\[evilnc-quick-comment-or-uncomment-to-the-line] \
to comment to the line 6453"
@@ -677,7 +686,7 @@ Then we operate the expanded region. NUM is ignored."
(defun evilnc-version ()
"The version number."
(interactive)
- (message "3.3.0"))
+ (message "3.3.1"))
(defvar evil-normal-state-map)
(defvar evil-visual-state-map)
@@ -839,7 +848,7 @@ In this case, only one tag is selected.
If user manually selects region, the region could cross multiple sibling tags
and automatically expands to include complete tags.
-So user only need press \"v\" key in `evil-mode' to select multiple tags.
+So user only need press \"v\" key in \"evil-mode\" to select multiple tags.
JSX from ReactJS like \"{/* ... */}\" is the default comment syntax.
Customize `evilnc-html-comment-end' and `evilnc-html-comment-end' to used
@@ -877,6 +886,23 @@ different syntax."
;; the whole tags is already selected
(evilnc-html-comment-region beg end)))))
+;;;###autoload
+(defun evilnc-comment-or-uncomment-html-paragraphs (&optional num)
+ "Comment or uncomment NUM paragraphs contain html tag.
+A paragraph is a continuation non-empty lines.
+Paragraphs are separated by empty lines."
+ (interactive "p")
+ (save-excursion
+ (evilnc-do-paragraphs
+ (lambda (b e)
+ ;; {{ select region from b to e
+ (set-mark b)
+ (goto-char e)
+ (activate-mark)
+ ;; }}
+ (evilnc-comment-or-uncomment-html-tag))
+ num)))
+
;; Attempt to define the operator on first load.
;; Will only work if evil has been loaded
(eval-after-load 'evil
diff --git a/pkg.sh b/pkg.sh
index f0579adbeb..62dda91015 100755
--- a/pkg.sh
+++ b/pkg.sh
@@ -1,6 +1,6 @@
#!/bin/bash
name=evil-nerd-commenter
-version=3.3.0
+version=3.3.1
pkg=$name-$version
mkdir $pkg
cp *.el $pkg