changeset 51101:821f85e23a1f

* simple.el (kill-whole-line): New function. * bindings.el (global-map): Bind it.
author Kai Großjohann <kgrossjo@eu.uu.net>
date Mon, 19 May 2003 15:47:14 +0000
parents 79e27b3ef7ef
children d604b76d3bbd
files lisp/ChangeLog lisp/bindings.el lisp/simple.el
diffstat 3 files changed, 25 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
--- a/lisp/ChangeLog	Mon May 19 14:52:43 2003 +0000
+++ b/lisp/ChangeLog	Mon May 19 15:47:14 2003 +0000
@@ -1,3 +1,8 @@
+2003-05-19  Kai Gro,A_(Bjohann  <kai.grossjohann@gmx.net>
+
+	* simple.el (kill-whole-line): New function.
+	* bindings.el (global-map): Bind it.
+
 2003-05-19  Richard M. Stallman  <rms@gnu.org>
 
 	* net/goto-addr.el (goto-address-fontify-maximum-size):
--- a/lisp/bindings.el	Mon May 19 14:52:43 2003 +0000
+++ b/lisp/bindings.el	Mon May 19 15:47:14 2003 +0000
@@ -743,6 +743,7 @@
 ;(define-key global-map [delete] 'backward-delete-char)
 
 ;; natural bindings for terminal keycaps --- defined in X keysym order
+(define-key global-map [S-backspace]    'kill-whole-line)
 (define-key global-map [home]		'beginning-of-line)
 (define-key global-map [C-home]		'beginning-of-buffer)
 (define-key global-map [M-home]		'beginning-of-buffer-other-window)
--- a/lisp/simple.el	Mon May 19 14:52:43 2003 +0000
+++ b/lisp/simple.el	Mon May 19 15:47:14 2003 +0000
@@ -2205,6 +2205,25 @@
 		       (goto-char end))))
 		 (point))))
 
+(defun kill-whole-line (&optional arg)
+  "Kill current line.
+With prefix arg, kill that many lines from point.
+If arg is negative, kill backwards.
+If arg is zero, kill current line but exclude the trailing newline."
+  (interactive "P")
+  (setq arg (prefix-numeric-value arg))
+  (cond ((zerop arg)
+	 (kill-region (point) (progn (forward-visible-line 0) (point)))
+	 (kill-region (point) (progn (end-of-visible-line) (point))))
+	((< arg 0)
+	 (kill-line 1)
+	 (kill-line (1+ arg))
+	 (unless (bobp) (forward-visible-line -1)))
+	(t
+	 (kill-line 0)
+	 (if (eobp)
+	     (signal 'end-of-buffer nil)
+	   (kill-line arg)))))
 
 (defun forward-visible-line (arg)
   "Move forward by ARG lines, ignoring currently invisible newlines only.