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

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

[nongnu] elpa/crux dd3f0e5 089/112: Add function crux-kill-and-join-forw


From: ELPA Syncer
Subject: [nongnu] elpa/crux dd3f0e5 089/112: Add function crux-kill-and-join-forward
Date: Wed, 11 Aug 2021 09:58:00 -0400 (EDT)

branch: elpa/crux
commit dd3f0e5da00bc1b934d8d3992f588412c0e8e06f
Author: thdox <thdox@free.fr>
Commit: Bozhidar Batsov <bozhidar.batsov@gmail.com>

    Add function crux-kill-and-join-forward
    
    This is complementary to crux-kill-line-backwards, but moving forward,
    and when called at end of line, it will join.
---
 README.md |  1 +
 crux.el   | 10 ++++++++++
 2 files changed, 11 insertions(+)

diff --git a/README.md b/README.md
index 146962a..64427e4 100644
--- a/README.md
+++ b/README.md
@@ -66,6 +66,7 @@ Command                                             | 
Suggested Keybinding(s)
 `crux-top-join-line`                                | <kbd>Super-j</kbd> or 
<kbd>C-^</kbd> | Join lines
 `crux-kill-whole-line`                              | <kbd>Super-k</kbd> | 
Kill whole line
 `crux-kill-line-backwards`                          | <kbd>C-Backspace</kbd> | 
Kill line backwards
+`crux-kill-and-join-forward`                        | <kbd>C-S-Backspace</kbd> 
or <kbd>C-k</kbd> | If at end of line, join with following; otherwise kill line.
 `crux-ispell-word-then-abbrev`                      | <kbd>C-c i</kbd> | Fix 
word using `ispell` and then save to `abbrev`.
 `crux-upcase-region`                                | <kbd>C-x C-u</kbd> | 
`upcase-region` when `transient-mark-mode` is on and region is active.
 `crux-downcase-region`                              | <kbd>C-x C-l</kbd> | 
`downcase-region` when `transient-mark-mode` is on and region is active.
diff --git a/crux.el b/crux.el
index d0a5931..fdf6bef 100644
--- a/crux.el
+++ b/crux.el
@@ -294,6 +294,16 @@ Passes ARG to command `kill-whole-line' when provided."
   (kill-line 0)
   (indent-according-to-mode))
 
+;;;###autoload
+(defun crux-kill-and-join-forward (&optional arg)
+  "If at end of line, join with following; otherwise kill line.
+Passes ARG to command `kill-line' when provided.
+Deletes whitespace at join."
+  (interactive "P")
+  (if (and (eolp) (not (bolp)))
+      (delete-indentation 1)
+    (kill-line arg)))
+
 (defun move-to-mode-line-start ()
   "Move to the beginning, skipping mode specific line start regex."
   (interactive)



reply via email to

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