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

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

[nongnu] elpa/evil-nerd-commenter 78569a4c0b 015/235: work around a bug


From: ELPA Syncer
Subject: [nongnu] elpa/evil-nerd-commenter 78569a4c0b 015/235: work around a bug in evil-visual-line
Date: Thu, 6 Jan 2022 02:59:31 -0500 (EST)

branch: elpa/evil-nerd-commenter
commit 78569a4c0b784f65cd0673614b4d13a681c6bf74
Author: chen bin <chenbin.sh@gmail.com>
Commit: chen bin <chenbin.sh@gmail.com>

    work around a bug in evil-visual-line
---
 README.org                 | 26 +++++++++------------
 evil-nerd-commenter-pkg.el |  2 +-
 evil-nerd-commenter.el     | 58 +++++++++++++++++++++++++++++++++++++---------
 pkg.sh                     |  2 +-
 4 files changed, 60 insertions(+), 28 deletions(-)

diff --git a/README.org b/README.org
index 99b2a8f0f5..325d15784c 100644
--- a/README.org
+++ b/README.org
@@ -1,9 +1,16 @@
-* evil-nerd-commenter (current version 0.0.4)
+* evil-nerd-commenter (current version 0.0.5)
 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.
+
+Though this program could be used *independently*, I highly recommend you use 
it with [[http://gitorious.org/evil][evil]]
+and [[https://github.com/cofi/evil-leader][evil-leader]].
+
+Evil and evil-leader make you take advantage of power of Vi to comment lines 
in shocking speed.
+For example, you can press key `99,ci` to comment out 99 lines.
+
 * Why evil-nerd-commenter is better? 
 ** A simple use case on the efficiency
 Say you want to comment out nine lines. Instead pressing "C-space M-9 C-n 
M-;", now you can press "M-9 M-;" or ",9ci".
@@ -28,14 +35,14 @@ The advantage of use "M-;" is you can set mark on the first 
line and scroll seve
 
 I prefer vi key binds. So I also use 
[[http://emacswiki.org/emacs/Evil][evil-mode]] and evil-leader.
 
-Here is my configuration for evil-mode (OPTIONAL, some people don't use 
evil-mode at all because they don't like vi key bindings):
+Here is my configuration for evil-mode (*OPTIONAL!* some people don't use 
evil-mode at all because they don't like vi key bindings):
 #+BEGIN_SRC lisp
 (require 'evil)
 (require 'evil-leader)
 (setq evil-leader/leader "," evil-leader/in-all-states t)
 (evil-leader/set-key
   "ci" 'evilnc-comment-or-uncomment-lines
-  "cc" 'evilnc-comment-or-uncomment-to-the-line
+  "cl" 'evilnc-comment-or-uncomment-to-the-line
   )
 #+END_SRC
 * Usage
@@ -56,15 +63,4 @@ If you use [[http://emacswiki.org/emacs/Evil][evil-mode]] 
and get the package ev
 Example 4:
 "C-u 56 M-x evilnc-comment-or-uncomment-to-the-line", comment/uncomment *from 
current line* to line 56.
 * Contact me
-You can report bugs at [[https://github.com/redguardtoo/evil-nerd]]-commenter. 
My email is <chenbin.sh@gmail.com>.
-* License
-Copyright (C) 2012 Chen Bin
-
-Author: Chen Bin <chenbin.sh@gmail.com>
-
-This program is free software; you can redistribute it and/or modify it under 
the terms of the GNU General Public License as published by the Free Software 
Foundation, either version 3 of the License, or (at your option) any later 
version.
-
-This program is distributed in the hope that it will be useful, but WITHOUT 
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS 
FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.
-
-You should have received a copy of the GNU General Public License along with 
this program. If not, see [[http://www.gnu.org/licenses/]].
-
+You can report bugs at [[https://github.com/redguardtoo/evil-nerd]]-commenter. 
My email is <chenbin.sh@gmail.com>.
\ No newline at end of file
diff --git a/evil-nerd-commenter-pkg.el b/evil-nerd-commenter-pkg.el
index 774e64af0e..93e3ef195a 100644
--- a/evil-nerd-commenter-pkg.el
+++ b/evil-nerd-commenter-pkg.el
@@ -1,2 +1,2 @@
-(define-package "evil-nerd-commenter" "0.0.4"
+(define-package "evil-nerd-commenter" "0.0.5"
                 "Comment/uncomment lines efficiently. Like Nerd Commenter in 
Vim")
diff --git a/evil-nerd-commenter.el b/evil-nerd-commenter.el
index 93ee158a3f..0c453822ab 100644
--- a/evil-nerd-commenter.el
+++ b/evil-nerd-commenter.el
@@ -1,22 +1,49 @@
 ;;; evil-nerd-commenter --- Comment/uncomment lines efficiently. Like Nerd 
Commenter in Vim
 
-;; Copyright (C) 2012 Chen Bin
-;; Author: Chen Bin <chenbin DOT sh AT gmail>
+;; Copyright (C) 2013 Chen Bin
+
+;; Author: Chen Bin <chenbin.sh@gmail.com>
 ;; URL: http://github.com/redguardtoo/evil-nerd-commenter
+;; Version: 0.0.5
 ;; Keywords: commenter vim line evil
-;; Version: 0.0.4
-
+;;
 ;; This file is not part of GNU Emacs.
 
-;; This file is free software (GPLv3 License)
+;;; License:
 
-;; How to set it up:
-;; 1. "evilnc-default-hotkeys" will assign hotkey "M-;" for emacs normal mode 
and "<Leader>ci" for evil-mode.
-;; 2. Calling (evilnc-default-hotkeys) is NOT needed if you define your own 
hotkey.
+;; This file is part of evil-nerd-commenter
+;;
+;; evil-nerd-commenter is free software: you can redistribute it and/or
+;; modify it under the terms of the GNU General Public License as published
+;; by the Free Software Foundation, either version 3 of the License, or
+;; (at your option) any later version.
 ;;
-;; How to use:
-;; 1. "evilnc-comment-or-uncomment-lines" - comment/uncomment lines.
-;; 2. "evilnc-comment-or-uncomment-to-the-line" - comment/uncomment from 
current line to the specified line
+;; evil-nerd-commenter is distributed in the hope that it will be useful,
+;; but WITHOUT ANY WARRANTY; without even the implied warranty of
+;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+;; GNU General Public License for more details.
+;;
+;; You should have received a copy of the GNU General Public License
+;; along with this program.  If not, see <http://www.gnu.org/licenses/>.
+
+;;; Commentary:
+;;
+;; This program emulates nerd-commenter.vim by Marty Grenfell.
+;; It help you comment/uncomment multiple lines without selecting them.
+;;
+;; `M-x evilnc-default-hotkeys` assigns hotkey `M-;` to 
`evilnc-comment-or-uncomment-lines'
+;; `M-x evilnc-comment-or-uncomment-lines` comment or uncomment lines.
+;; `M-x evilnc-comment-or-uncomment-to-the-line` will comment/uncomment from 
current line to
+;; the specified line number. The line number is passed as parameter of the 
command.
+;; For example, `C-u 99 evilnc-comment-or-uncomment-to-the-line` will comment 
code from
+;; current line to line 99.
+;;
+;; Though this program could be used *independently*, I highly recommend you 
use it with
+;; evil (http://gitorious.org/evil) and evil-leader 
(https://github.com/cofi/evil-leader).
+;;
+;; Evil and evil-leader make you take advantage of power of Vi to comment 
lines in shocking speed.
+;; For example, you can press key `99,ci` to comment out 99 lines.
+
 
 ;;; Code:
 
@@ -103,6 +130,13 @@
       (let ((b (region-beginning))
             (e (region-end))
             )
+        ;; another work around for evil-visual-line bug:
+        ;; in evil-mode, if we use hot key V `M-x evil-visual-line` to select 
line
+        ;; the (line-beginning-position) of the line which is after the last 
selected
+        ;; line is always (region-end)! Don't know why.
+        (if (and (> e b) (= e (line-beginning-position)) (boundp 'evil-state) 
(string= evil-state 'visual))
+            (setq e (1- e))
+            )
         (goto-char b)
         (setq b (line-beginning-position))
         (goto-char e)
@@ -120,3 +154,5 @@
   )
 
 (provide 'evil-nerd-commenter)
+
+;;; evil-nerd-commenter.el ends here
\ No newline at end of file
diff --git a/pkg.sh b/pkg.sh
index 0deb2a7a5a..8b19962f4e 100755
--- a/pkg.sh
+++ b/pkg.sh
@@ -1,5 +1,5 @@
 #!/bin/bash
-pkg=evil-nerd-commenter-0.0.4
+pkg=evil-nerd-commenter-0.0.5
 mkdir $pkg
 cp README.org $pkg
 cp *.el $pkg



reply via email to

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