From: Kai Großjohann Date: Mon, 19 May 2003 15:47:14 +0000 (+0000) Subject: * simple.el (kill-whole-line): New function. X-Git-Tag: ttn-vms-21-2-B4~10069 X-Git-Url: http://git.eshelyaron.com/gitweb/?a=commitdiff_plain;h=348de80b31f6de0a286d83d2808beb47954d74f5;p=emacs.git * simple.el (kill-whole-line): New function. * bindings.el (global-map): Bind it. --- diff --git a/lisp/ChangeLog b/lisp/ChangeLog index e90f4445ce0..11eab58f2fe 100644 --- a/lisp/ChangeLog +++ b/lisp/ChangeLog @@ -1,3 +1,8 @@ +2003-05-19 Kai Gro,A_(Bjohann + + * simple.el (kill-whole-line): New function. + * bindings.el (global-map): Bind it. + 2003-05-19 Richard M. Stallman * net/goto-addr.el (goto-address-fontify-maximum-size): diff --git a/lisp/bindings.el b/lisp/bindings.el index f95a3f588c2..7568c89c858 100644 --- a/lisp/bindings.el +++ b/lisp/bindings.el @@ -743,6 +743,7 @@ language you are using." ;(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) diff --git a/lisp/simple.el b/lisp/simple.el index c726bf745bc..64b56d5dfbb 100644 --- a/lisp/simple.el +++ b/lisp/simple.el @@ -2205,6 +2205,25 @@ even beep.)" (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.