emacs-devel
[Top][All Lists]
Advanced

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

Re: Various simple.el patches


From: Kai Großjohann
Subject: Re: Various simple.el patches
Date: Sun, 18 May 2003 17:38:41 +0200
User-agent: Gnus/5.1003 (Gnus v5.10.3) Emacs/21.3.50 (gnu/linux)

Richard Stallman <address@hidden> writes:

>     What about S-<backspace>?
>
> I guess I have no objection.

Good :-)  Here is a proposed patch.  I'm not sure if I did it right.
Somehow I get the feeling that using kill-line was not the right
thing to do.  I'm just so lazy...

cvs server: Diffing lisp
Index: lisp/bindings.el
===================================================================
RCS file: /cvsroot/emacs/emacs/lisp/bindings.el,v
retrieving revision 1.116
diff -u -r1.116 bindings.el
--- lisp/bindings.el    13 Apr 2003 06:30:59 -0000      1.116
+++ lisp/bindings.el    18 May 2003 15:38:24 -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)
Index: lisp/simple.el
===================================================================
RCS file: /cvsroot/emacs/emacs/lisp/simple.el,v
retrieving revision 1.602
diff -u -r1.602 simple.el
--- lisp/simple.el      16 May 2003 21:17:52 -0000      1.602
+++ lisp/simple.el      18 May 2003 15:38:35 -0000
@@ -2205,6 +2205,22 @@
                       (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 (progn (forward-visible-line 0) (point))
+                     (progn (end-of-visible-line) (point))))
+       ((< arg 0)
+        (forward-visible-line 1)
+        (kill-line arg))
+       (t
+        (forward-visible-line 0)
+        (kill-line arg))))
 
 (defun forward-visible-line (arg)
   "Move forward by ARG lines, ignoring currently invisible newlines only.
cvs server: Diffing lisp/calc
cvs server: Diffing lisp/calendar
cvs server: Diffing lisp/emacs-lisp
cvs server: Diffing lisp/emulation
cvs server: Diffing lisp/eshell
cvs server: Diffing lisp/gnus
cvs server: Diffing lisp/international
cvs server: Diffing lisp/language
cvs server: Diffing lisp/mail
cvs server: Diffing lisp/mh-e
cvs server: Diffing lisp/net
cvs server: Diffing lisp/obsolete
cvs server: Diffing lisp/play
cvs server: Diffing lisp/progmodes
cvs server: Diffing lisp/term
cvs server: Diffing lisp/textmodes
cvs server: Diffing lisp/toolbar


-- 
This line is not blank.





reply via email to

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