[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[nongnu] elpa/evil-nerd-commenter 5d9635cc11 028/235: better support for
From: |
ELPA Syncer |
Subject: |
[nongnu] elpa/evil-nerd-commenter 5d9635cc11 028/235: better support for commenting multiple paragraph, v1.0.0 |
Date: |
Thu, 6 Jan 2022 02:59:32 -0500 (EST) |
branch: elpa/evil-nerd-commenter
commit 5d9635cc11ab71356bb8cda36b148210de179839
Author: Chen Bin <Chen.Bin@optus.com.au>
Commit: Chen Bin <Chen.Bin@optus.com.au>
better support for commenting multiple paragraph, v1.0.0
---
README.org | 14 +++++++++---
evil-nerd-commenter-pkg.el | 2 +-
evil-nerd-commenter.el | 55 +++++++++++++++++++++++++++-------------------
pkg.sh | 2 +-
4 files changed, 45 insertions(+), 28 deletions(-)
diff --git a/README.org b/README.org
index 19f4c1de37..5fd452e8c5 100644
--- a/README.org
+++ b/README.org
@@ -1,9 +1,9 @@
-* evil-nerd-commenter (current version 0.0.10)
+* evil-nerd-commenter (current version 1.0.0)
As a developer, I often need comment/uncomment lines for debugging or adding
some short comment in the code block.
As I know, the [[http://www.vim.org/scripts/script.php?script_id=1218][Nerd
Commenter]] for Vim is the most efficient way to doing this thing.
Unfortunately, there is no similar plugin in Emacs.
-That's why I develop this Nerd Commenter simulator for Emacs people. Besides,
I'm also adding my own utilities into this plugin. For example, I added a
command to comment *AND* copy lines in version 0.0.10.
+That's why I develop this Nerd Commenter simulator for Emacs people. Besides,
I'm also adding my own utilities into this plugin. For example, I added a
command to comment *AND* copy lines in version 1.0.0.
Though this program could be used *independently*, I highly recommend you use
it with [[http://gitorious.org/evil][evil]].
@@ -89,7 +89,15 @@ Example 5:
"C-u 2 M-x evilnc-copy-and-comment-lines", copy 2 lines and paste them below
the original line. Then comment out original lines. The focus will be moved to
the new lines.
Example 6:
-"C-u 2 M-x evilnc-comment-or-uncomment-paragraphs", comment out two paragraphs.
+"C-u 2 M-x evilnc-comment-or-uncomment-paragraphs", comment out two
paragraphs. This is useful if you have large hunk of data to be commented out:
+#+BEGIN_SRC javascript
+var myJson={
+ "key1":"v1",
+ "key2":"v2",
+ "key3":"v3"
+}
+#+END_SRC
+
* Contact me
You can report bugs at [[https://github.com/redguardtoo/evil-nerd-commenter]].
My email is <chenbin.sh@gmail.com>.
diff --git a/evil-nerd-commenter-pkg.el b/evil-nerd-commenter-pkg.el
index 46403c9bac..d70f75a7f2 100644
--- a/evil-nerd-commenter-pkg.el
+++ b/evil-nerd-commenter-pkg.el
@@ -1,2 +1,2 @@
-(define-package "evil-nerd-commenter" "0.0.10"
+(define-package "evil-nerd-commenter" "1.0.0"
"Comment/uncomment lines efficiently. Like Nerd Commenter in
Vim")
diff --git a/evil-nerd-commenter.el b/evil-nerd-commenter.el
index 978f8f530c..5acab177fe 100644
--- a/evil-nerd-commenter.el
+++ b/evil-nerd-commenter.el
@@ -4,7 +4,7 @@
;; Author: Chen Bin <chenbin.sh@gmail.com>
;; URL: http://github.com/redguardtoo/evil-nerd-commenter
-;; Version: 0.0.10
+;; Version: 1.0.0
;; Keywords: commenter vim line evil
;;
;; This file is not part of GNU Emacs.
@@ -110,8 +110,8 @@
)
-(defun evilnc--comment-or-uncomment-one-paragraph ()
- (let (b e (forward-search-done nil))
+(defun evilnc--get-one-paragraph-region ()
+ (let (b e)
(save-excursion
(setq b (re-search-backward "^[ \t]*$" nil t))
(if b (progn
@@ -122,23 +122,16 @@
)
)
(save-excursion
+
(setq e (re-search-forward "^[ \t]*$" nil t))
(if e (progn
(forward-line -1)
(setq e (line-end-position))
)
- (progn
- (setq e (point-max))
- (setq forward-search-done t)
- )
+ (setq e (point-max))
)
)
- ;; (message "b e: %d %d" b e)
- (when (<= b e)
- (evilnc--fix-buggy-major-modes)
- (comment-or-uncomment-region b e)
- )
- (if forward-search-done nil e)
+ (list b e)
)
)
@@ -150,31 +143,47 @@
Paragraphs are separated by empty lines."
(interactive "p")
(let ((i 0)
- rlt)
+ rlt
+ (b (point-max))
+ (e 0)
+ )
(catch 'break
(while (< i NUM)
(incf i)
- (setq rlt (evilnc--comment-or-uncomment-one-paragraph))
+ (setq rlt (evilnc--get-one-paragraph-region))
+ (setq b (if (< (nth 0 rlt) b) (nth 0 rlt) b))
+ (setq e (if (> (nth 1 rlt) e) (nth 1 rlt) e))
;; prepare for the next paragraph
(if (and rlt (< i NUM))
(progn
- ;; rlt should be the end of last non-empty line
- (goto-char rlt)
+ ;; e should be the end of last non-empty line
+ (goto-char e)
- ;; (beginning-of-line)
;; move to an empty line
(forward-line)
- ;; record the empty line position for furture use
- (setq rlt (line-beginning-position))
;; move to next non-empty line
(re-search-forward "^[ \t]*[^ \t]" nil t)
- (if (<= (line-beginning-position) rlt) (throw 'break i))
+
+ (if (<= (line-beginning-position) e)
+ (progn
+ (throw 'break i)
+ )
+ )
)
- (throw 'break i)
+ (progn
+ (throw 'break i)
+ )
)
- )))
+ ))
+ (when (<= b e)
+ (save-excursion
+ (evilnc--fix-buggy-major-modes)
+ (comment-or-uncomment-region b e)
+ )
+ )
+ )
)
;;;###autoload
diff --git a/pkg.sh b/pkg.sh
index c03ee738bc..a54ec6e501 100755
--- a/pkg.sh
+++ b/pkg.sh
@@ -1,5 +1,5 @@
#!/bin/bash
-pkg=evil-nerd-commenter-0.0.10
+pkg=evil-nerd-commenter-1.0.0
mkdir $pkg
cp README.org $pkg
cp *.el $pkg
- [nongnu] elpa/evil-nerd-commenter befd4da216 117/235: Comment operator should not be filling registers and kill-ring, (continued)
- [nongnu] elpa/evil-nerd-commenter befd4da216 117/235: Comment operator should not be filling registers and kill-ring, ELPA Syncer, 2022/01/06
- [nongnu] elpa/evil-nerd-commenter 9220e93853 128/235: Merge pull request #56 from syohex/correct-package-headers, ELPA Syncer, 2022/01/06
- [nongnu] elpa/evil-nerd-commenter 7a441580ae 141/235: Save position in org-mode src blocks., ELPA Syncer, 2022/01/06
- [nongnu] elpa/evil-nerd-commenter 80f503be1e 161/235: typo in doc, ELPA Syncer, 2022/01/06
- [nongnu] elpa/evil-nerd-commenter 16dcffac65 163/235: Fix doc-string typo and length, ELPA Syncer, 2022/01/06
- [nongnu] elpa/evil-nerd-commenter 4dca3cc33d 012/235: Merge pull request #4 from darth10/patch-1, ELPA Syncer, 2022/01/06
- [nongnu] elpa/evil-nerd-commenter b4b18c8190 017/235: you can copy and comment lines in one command, upgraded to version 0.0.6, ELPA Syncer, 2022/01/06
- [nongnu] elpa/evil-nerd-commenter 01556c89ba 021/235: add live demo, ELPA Syncer, 2022/01/06
- [nongnu] elpa/evil-nerd-commenter 2b68b829fe 023/235: fixed regression since 0.0.6: cannot comment region, ELPA Syncer, 2022/01/06
- [nongnu] elpa/evil-nerd-commenter 94f87db048 025/235: updated README, ELPA Syncer, 2022/01/06
- [nongnu] elpa/evil-nerd-commenter 5d9635cc11 028/235: better support for commenting multiple paragraph, v1.0.0,
ELPA Syncer <=
- [nongnu] elpa/evil-nerd-commenter 425294cc71 032/235: Replaced default evil setup with , operator, ELPA Syncer, 2022/01/06
- [nongnu] elpa/evil-nerd-commenter 944fc7417d 031/235: Added comment operator (modelled after delete/change operator)., ELPA Syncer, 2022/01/06
- [nongnu] elpa/evil-nerd-commenter d016f26471 036/235: Changed word to WORD (which goes through symbolic characters), ELPA Syncer, 2022/01/06
- [nongnu] elpa/evil-nerd-commenter 516fe784dc 040/235: Updated snippet to reflect code, ELPA Syncer, 2022/01/06
- [nongnu] elpa/evil-nerd-commenter 5263a96f3b 042/235: Made , work in visual mode as well, ELPA Syncer, 2022/01/06
- [nongnu] elpa/evil-nerd-commenter e1d39be8e3 044/235: Added additional evil example, ELPA Syncer, 2022/01/06
- [nongnu] elpa/evil-nerd-commenter 237040205e 046/235: Made definition of evilnc-comment-operator a callable function, evilnc-define-comment-operator. Only does anything if 'evil-define-operator bound and 'evilnc-comment-operator isn't., ELPA Syncer, 2022/01/06
- [nongnu] elpa/evil-nerd-commenter fbd9d01a8c 043/235: Added visual map to readme recommendations, ELPA Syncer, 2022/01/06
- [nongnu] elpa/evil-nerd-commenter b9cfe0c7a6 054/235: some evil tips, ELPA Syncer, 2022/01/06
- [nongnu] elpa/evil-nerd-commenter 69a8710e3d 053/235: v1.2.4, updated doc on set up, ELPA Syncer, 2022/01/06