This comes from SXEmacs so I'm not going to commit without another
Reviewer's go ahead.
Also, the key bindings here... they were the first ones that came to
me, I have no attachment to them so if you can think of better ones,
cool.:-)
21.5 patch:
ChangeLog files diff command: cvs -q diff -U 0
Files affected: lisp/ChangeLog
Source files diff command: cvs -q diff -uN
Files affected: lisp/simple.el lisp/keydefs.el
Index: lisp/ChangeLog
===================================================================
RCS file: /pack/xemacscvs/XEmacs/xemacs/lisp/ChangeLog,v
retrieving revision 1.653
diff -u -p -U0 -r1.653 ChangeLog
--- lisp/ChangeLog 17 Mar 2005 09:26:07 -0000 1.653
+++ lisp/ChangeLog 23 Mar 2005 04:04:11 -0000
@@ -0,0 +1,12 @@
+2005-03-23 Steve Youngs <steve(a)sxemacs.org>
+
+ From Johann Oskarsson <johann(a)myrkraverk.com>
+
+ * simple.el (delete-word): New.
+ (backward-delete-word): New.
+ Delete words without messing with the kill-ring.
+
+ * keydefs.el: Keybindings for above...
+ `M-D' -- `delete-word'
+ `C-BS' -- `backward-delete-word'
+
Index: lisp/keydefs.el
===================================================================
RCS file: /pack/xemacscvs/XEmacs/xemacs/lisp/keydefs.el,v
retrieving revision 1.18
diff -u -p -u -r1.18 keydefs.el
--- lisp/keydefs.el 28 Apr 2003 16:18:23 -0000 1.18
+++ lisp/keydefs.el 23 Mar 2005 04:02:53 -0000
@@ -299,6 +299,7 @@ Keymap for characters following C-c.")
(define-key global-map "\M-f" 'forward-word)
(define-key global-map "\M-b" 'backward-word)
(define-key global-map "\M-d" 'kill-word)
+(define-key global-map "\M-D" 'delete-word)
(define-key global-map "\M-<" 'beginning-of-buffer)
(define-key global-map "\M->" 'end-of-buffer)
@@ -405,6 +406,7 @@ Keymap for characters following C-c.")
;; Default binding of "Control-h" is help.
(define-key global-map 'backspace 'delete-backward-char)
(define-key global-map '(meta backspace) 'backward-kill-word)
+(define-key global-map '(control backspace) 'backward-delete-word)
(define-key global-map [(control x) backspace] 'backward-kill-sentence)
(define-key global-map "\M-\C-z" 'activate-region)
Index: lisp/simple.el
===================================================================
RCS file: /pack/xemacscvs/XEmacs/xemacs/lisp/simple.el,v
retrieving revision 1.50
diff -u -p -u -r1.50 simple.el
--- lisp/simple.el 23 Feb 2005 22:25:16 -0000 1.50
+++ lisp/simple.el 23 Mar 2005 04:02:55 -0000
@@ -2745,6 +2745,19 @@ With argument, do this that many times."
(interactive "*p")
(kill-word (- (or count 1))))
+(defun delete-word (&optional count)
+ "Delete characters forward until encountering the end of a word.
+With optional argument COUNT, do this that many times."
+ (interactive "*p")
+ (delete-region (point) (save-excursion (forward-word count) (point))))
+
+(defun backward-delete-word (&optional count)
+ "Delete characters backward until encountering the end of a word.
+With argument, do this that many times."
+ (interactive "*p")
+ (delete-word (- (or count 1))))
+
+
(defun current-word (&optional strict)
"Return the word point is on (or a nearby word) as a string.
If optional arg STRICT is non-nil, return nil unless point is within
--
|---<Steve Youngs>---------------<GnuPG KeyID: A94B3003>---|
| I am Dyslexic of Borg. |
| Fusistance is retile. Your arse will be laminated. |
|------------------------------------<steve(a)sxemacs.org>---|