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

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

[elpa] master 2d613eb 068/110: avy.el (avy-action-zap-to-char): Add and


From: Oleh Krehel
Subject: [elpa] master 2d613eb 068/110: avy.el (avy-action-zap-to-char): Add and bind to "z"
Date: Sat, 11 May 2019 10:15:46 -0400 (EDT)

branch: master
commit 2d613eb050d94c1cdfb403da7446883ce6d35baa
Author: Oleh Krehel <address@hidden>
Commit: Oleh Krehel <address@hidden>

    avy.el (avy-action-zap-to-char): Add and bind to "z"
    
    Fixes #234
---
 avy.el | 9 ++++++++-
 1 file changed, 8 insertions(+), 1 deletion(-)

diff --git a/avy.el b/avy.el
index 7dbbb34..bf82845 100644
--- a/avy.el
+++ b/avy.el
@@ -182,7 +182,8 @@ If the commands isn't on the list, `avy-style' is used."
     (?m . avy-action-mark)
     (?n . avy-action-copy)
     (?y . avy-action-yank)
-    (?i . avy-action-ispell))
+    (?i . avy-action-ispell)
+    (?z . avy-action-zap-to-char))
   "List of actions for `avy-handler-default'.
 
 Each item is (KEY . ACTION).  When KEY not on `avy-keys' is
@@ -687,6 +688,12 @@ Set `avy-style' according to COMMMAND as well."
     (ring-ref avy-ring 0)))
   t)
 
+(defun avy-action-zap-to-char (pt)
+  "Kill from point up to PT."
+  (if (> pt (point))
+      (kill-region (point) (1+ pt))
+    (kill-region pt (1+ (point)))))
+
 (defun avy-action-teleport (pt)
   "Kill sexp starting on PT and yank into the current location."
   (avy-action-kill-stay pt)



reply via email to

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