[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[nongnu] elpa/evil-nerd-commenter 9f15aec3ce 056/235: support negative a
From: |
ELPA Syncer |
Subject: |
[nongnu] elpa/evil-nerd-commenter 9f15aec3ce 056/235: support negative argument v1.2.6 |
Date: |
Thu, 6 Jan 2022 02:59:34 -0500 (EST) |
branch: elpa/evil-nerd-commenter
commit 9f15aec3ce18e49adeb9bab4681ade982542cc41
Author: Chen Bin <chenbin.sh@gmail.com>
Commit: Chen Bin <chenbin.sh@gmail.com>
support negative argument v1.2.6
---
README.org | 6 +++---
evil-nerd-commenter-pkg.el | 2 +-
evil-nerd-commenter.el | 33 ++++++++++++++++++++++-----------
pkg.sh | 2 +-
4 files changed, 27 insertions(+), 16 deletions(-)
diff --git a/README.org b/README.org
index dc8fe0f80b..fb0215c35d 100644
--- a/README.org
+++ b/README.org
@@ -1,4 +1,4 @@
-* evil-nerd-commenter (current version 1.2.5)
+* evil-nerd-commenter (current version 1.2.6)
*Please note this program could be used independently without evil-mode!*
@@ -87,9 +87,9 @@ If you don't use emacs package manager (Why?) to install
evil-nerd-commenter the
* Usage
Here are available commands. They are not dependent on
[[http://emacswiki.org/emacs/Evil][evil-mode]]:
-- evilnc-comment-or-uncomment-lines :: comment/uncomment lines.
+- evilnc-comment-or-uncomment-lines :: comment/uncomment lines. This command
supports negative arguments.
- evilnc-comment-or-uncomment-to-the-line :: comment/uncomment from current
line to the specified line.
-- evilnc-copy-and-comment-lines :: copy and paste lines, then comment out
original lines
+- evilnc-copy-and-comment-lines :: copy and paste lines, then comment out
original lines. This command supports negative arguments.
- evilnc-comment-or-uncomment-paragraphs :: comment/uncomment paragraphs which
separated by empty lines
- evilnc-toggle-comment-empty-lines :: toggle the flag to comment/uncomment
empty lines
- evilnc-copy-to-line :: Copy from the current line to the user specified
line, *for non-evil user only, you need set hot key for it*
diff --git a/evil-nerd-commenter-pkg.el b/evil-nerd-commenter-pkg.el
index d85ec5dd06..57015839ac 100644
--- a/evil-nerd-commenter-pkg.el
+++ b/evil-nerd-commenter-pkg.el
@@ -1,2 +1,2 @@
-(define-package "evil-nerd-commenter" "1.2.5"
+(define-package "evil-nerd-commenter" "1.2.6"
"Comment/uncomment lines efficiently. Like Nerd Commenter in
Vim")
diff --git a/evil-nerd-commenter.el b/evil-nerd-commenter.el
index 4e0ae52335..1570c0a957 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: 1.2.5
+;; Version: 1.2.6
;; Keywords: commenter vim line evil
;;
;; This file is not part of GNU Emacs.
@@ -265,28 +265,40 @@ Paragraphs are separated by empty lines."
;;;###autoload
(defun evilnc-comment-or-uncomment-lines (&optional NUM)
- "Comment or uncomment lines.
+ "Comment or uncomment NUM lines. NUM could be negative.
Case 1: If no region selected, comment/uncomment on current line. if NUM>1,
comment/uncomment
extra N-1 lines from next line
Case 2: If a region selected, the region is expand to make sure the region
contain
whole lines. Then we comment/uncomment the expanded region. NUM is ignored."
(interactive "p")
- (evilnc--operation-on-lines-or-region '(lambda (b e)
- (evilnc--fix-buggy-major-modes)
- (comment-or-uncomment-region b e)
- )
- NUM)
- )
+ ;; donot move the cursor
+ (save-excursion
+ ;; support negative number
+ (when (< NUM 0)
+ (forward-line (1+ NUM))
+ (setq NUM (- 0 NUM)))
+
+ (evilnc--operation-on-lines-or-region '(lambda (b e)
+ (evilnc--fix-buggy-major-modes)
+ (comment-or-uncomment-region b e)
+ )
+ NUM)))
;;;###autoload
(defun evilnc-copy-and-comment-lines (&optional NUM)
- "Copy and paste lines. Then comment original lines.
+ "Copy and paste NUM lines. Then comment the original lines. NUM could be
negative.
Case 1: If no region selected, operate on current line. if NUM>1,
comment/uncomment
extra N-1 lines from next line
Case 2: If a region selected, the region is expand to make sure the region
contain
whole lines. Then we operate the expanded region. NUM is ignored.
"
(interactive "p")
+
+ ;; support negative number
+ (when (< NUM 0)
+ (forward-line (1+ NUM))
+ (setq NUM (- 0 NUM)))
+
(evilnc--operation-on-lines-or-region
'(lambda (beg end)
(evilnc--fix-buggy-major-modes)
@@ -296,8 +308,7 @@ Paragraphs are separated by empty lines."
(insert-before-markers str)
(comment-region beg end)
))
- NUM)
- )
+ NUM))
;; {{ for non-evil user only
;;;###autoload
diff --git a/pkg.sh b/pkg.sh
index 0eb793b5e3..9db4fb37ca 100755
--- a/pkg.sh
+++ b/pkg.sh
@@ -1,5 +1,5 @@
#!/bin/bash
-pkg=evil-nerd-commenter-1.2.5
+pkg=evil-nerd-commenter-1.2.6
mkdir $pkg
cp README.org $pkg
cp *.el $pkg
- [nongnu] elpa/evil-nerd-commenter 8a3b13ed0b 018/235: updated README, (continued)
- [nongnu] elpa/evil-nerd-commenter 8a3b13ed0b 018/235: updated README, ELPA Syncer, 2022/01/06
- [nongnu] elpa/evil-nerd-commenter 59586d7e0b 027/235: updated doc on comment paragraphs, ELPA Syncer, 2022/01/06
- [nongnu] elpa/evil-nerd-commenter d279beb83d 035/235: Updated description, ELPA Syncer, 2022/01/06
- [nongnu] elpa/evil-nerd-commenter c9d325bb3f 037/235: Moved operator to evil section, ELPA Syncer, 2022/01/06
- [nongnu] elpa/evil-nerd-commenter 223d99372d 039/235: Added check for comment operator being bound, ELPA Syncer, 2022/01/06
- [nongnu] elpa/evil-nerd-commenter 229ed115d2 041/235: Streamlined evil section, ELPA Syncer, 2022/01/06
- [nongnu] elpa/evil-nerd-commenter c05e0ff2a4 045/235: Added "comment to line" evil example, ELPA Syncer, 2022/01/06
- [nongnu] elpa/evil-nerd-commenter 96093a934d 049/235: fixed: eval-expression hotkey occupied, ELPA Syncer, 2022/01/06
- [nongnu] elpa/evil-nerd-commenter dcaf985835 051/235: fixed: v1.2.2 and v1.2.1 cannot be installed, ELPA Syncer, 2022/01/06
- [nongnu] elpa/evil-nerd-commenter da42daecb7 055/235: new: copy and kill to specific line for non-evil users, v 1.2.5, ELPA Syncer, 2022/01/06
- [nongnu] elpa/evil-nerd-commenter 9f15aec3ce 056/235: support negative argument v1.2.6,
ELPA Syncer <=
- [nongnu] elpa/evil-nerd-commenter 2ac5d14f34 060/235: Merge pull request #21 from mswift42/master, ELPA Syncer, 2022/01/06
- [nongnu] elpa/evil-nerd-commenter cc31b0a602 059/235: Fixed type in save-excursion., ELPA Syncer, 2022/01/06
- [nongnu] elpa/evil-nerd-commenter adb8ba60de 062/235: minor wording update, ELPA Syncer, 2022/01/06
- [nongnu] elpa/evil-nerd-commenter 9450c91c71 063/235: Bufgix in evilnc--in-comment-p, ELPA Syncer, 2022/01/06
- [nongnu] elpa/evil-nerd-commenter d03db1baef 066/235: update doc on comment style, ELPA Syncer, 2022/01/06
- [nongnu] elpa/evil-nerd-commenter 277ea53931 067/235: Fixed uncommenting line "spilling" to next line, ELPA Syncer, 2022/01/06
- [nongnu] elpa/evil-nerd-commenter 5f09387d60 069/235: doc updated v1.2.9, ELPA Syncer, 2022/01/06
- [nongnu] elpa/evil-nerd-commenter c156331ed2 075/235: better comment to the line, ELPA Syncer, 2022/01/06
- [nongnu] elpa/evil-nerd-commenter a5ec49a54e 079/235: ad for evil-matchit, ELPA Syncer, 2022/01/06
- [nongnu] elpa/evil-nerd-commenter 336ce1ab67 083/235: readme on using evil-leader, ELPA Syncer, 2022/01/06