emacs-elpa-diffs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[nongnu] elpa/evil-nerd-commenter 906f532241 092/235: M-; should start a


From: ELPA Syncer
Subject: [nongnu] elpa/evil-nerd-commenter 906f532241 092/235: M-; should start a comment on an empty line #34 v1.5.3
Date: Thu, 6 Jan 2022 02:59:38 -0500 (EST)

branch: elpa/evil-nerd-commenter
commit 906f5322416f59d5e377ceb2386577ebe4ed3f82
Author: Chen Bin <chenbin.sh@gmail.com>
Commit: Chen Bin <chenbin.sh@gmail.com>

    M-; should start a comment on an empty line #34 v1.5.3
---
 README.org                 |  2 +-
 evil-nerd-commenter-pkg.el |  2 +-
 evil-nerd-commenter.el     | 30 +++++++++++++++++-------------
 pkg.sh                     |  2 +-
 4 files changed, 20 insertions(+), 16 deletions(-)

diff --git a/README.org b/README.org
index d9881a773c..7b5fe82840 100644
--- a/README.org
+++ b/README.org
@@ -1,4 +1,4 @@
-* evil-nerd-commenter (v1.5.2)
+* evil-nerd-commenter (v1.5.3)
 
 *This program could be used independently WITHOUT evil-mode!*
 
diff --git a/evil-nerd-commenter-pkg.el b/evil-nerd-commenter-pkg.el
index ac254f630a..22ffe8009c 100644
--- a/evil-nerd-commenter-pkg.el
+++ b/evil-nerd-commenter-pkg.el
@@ -1,2 +1,2 @@
-(define-package "evil-nerd-commenter" "1.5.2"
+(define-package "evil-nerd-commenter" "1.5.3"
                 "Comment/uncomment lines efficiently. Like Nerd Commenter in 
Vim")
diff --git a/evil-nerd-commenter.el b/evil-nerd-commenter.el
index f59d8d3703..3894bac2b2 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.5.2
+;; Version: 1.5.3
 ;; Keywords: commenter vim line evil
 ;;
 ;; This file is not part of GNU Emacs.
@@ -397,17 +397,21 @@ or 'C-u 3 M-x 
evilnc-quick-comment-or-uncomment-to-the-line' to comment to the l
    whole lines. Then we comment/uncomment the expanded region. NUM is ignored."
   (interactive "p")
   ;; 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)
-                                             
(evilnc--comment-or-uncomment-region b e)
-                                             )
-                                          NUM)))
+  ;; support negative number
+  (cond
+   ((and (= 1 NUM) (string-match "^[ \t]*$" (buffer-substring-no-properties 
(line-beginning-position) (line-end-position))))
+    ;; comment on current empty line
+    (comment-dwim nil))
+   (t
+    (save-excursion
+      (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)
+                                               
(evilnc--comment-or-uncomment-region b e))
+                                            NUM))
+    )))
 
 ;;;###autoload
 (defun evilnc-copy-and-comment-lines (&optional NUM)
@@ -471,7 +475,7 @@ or 'C-u 3 M-x 
evilnc-quick-comment-or-uncomment-to-the-line' to comment to the l
 ;;;###autoload
 (defun evilnc-version ()
   (interactive)
-  (message "1.5.2"))
+  (message "1.5.3"))
 
 ;;;###autoload
 (defun evilnc-default-hotkeys ()
diff --git a/pkg.sh b/pkg.sh
index 995252c22a..c6c84011da 100755
--- a/pkg.sh
+++ b/pkg.sh
@@ -1,5 +1,5 @@
 #!/bin/bash
-pkg=evil-nerd-commenter-1.5.2
+pkg=evil-nerd-commenter-1.5.3
 mkdir $pkg
 cp README.org $pkg
 cp *.el $pkg



reply via email to

[Prev in Thread] Current Thread [Next in Thread]