comparison lisp/utils/delbs.el @ 140:585fb297b004 r20-2b4

Import from CVS: tag r20-2b4
author cvs
date Mon, 13 Aug 2007 09:32:43 +0200
parents
children
comparison
equal deleted inserted replaced
139:2b5203979d01 140:585fb297b004
1 ;;; delbs.el --- a small lisp package to allow you to swap around DEL/BS keys
2
3 ;; Copyright (C) 1997 Gary Foster
4
5 ;; Author: Gary Foster <Gary.Foster@corp.sun.com>
6 ;; Keywords: lisp, terminals
7
8 ;; This file is part of XEmacs.
9
10 ;; XEmacs is free software; you can redistribute it and/or modify it
11 ;; under the terms of the GNU General Public License as published by
12 ;; the Free Software Foundation; either version 2, or (at your option)
13 ;; any later version.
14
15 ;; XEmacs is distributed in the hope that it will be useful, but
16 ;; WITHOUT ANY WARRANTY; without even the implied warranty of
17 ;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
18 ;; General Public License for more details.
19
20 ;; You should have received a copy of the GNU General Public License
21 ;; along with XEmacs; see the file COPYING. If not, write to the Free
22 ;; Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
23 ;; 02111-1307, USA.
24
25 ;;; Synched up with: not in FSF.
26
27 ;;; Commentary:
28
29 ;; This package should, *theoretically*, serve to quieten the DEL/BS rwars
30 ;; a little. By using this package, you can have DEL and BS both do the
31 ;; same function (normally delete one char to the left) or you can have
32 ;; then bound separately (DEL --> delete-char, BS --> delete-backward-char)
33 ;; with all appropriate Meta bindings in each mode.
34 ;;
35 ;; Author: Gary Foster <Gary.Foster@corp.sun.com>
36 ;; Credits due to: Per Abrahamsen <abraham@dina.kvl.dk>
37
38 ;;; Code:
39
40 (defun delbs-enable-delete-forward ()
41 "Set up the delete key to delete forward, and backspace to delete backward."
42 (interactive)
43 (define-key key-translation-map [backspace] "\C-?")
44 (define-key key-translation-map [delete] "\C-d")
45 (define-key key-translation-map [(meta backspace)] "\M-\C-?")
46 (define-key key-translation-map [(meta delete)] "\M-d"))
47
48 (defun delbs-disable-delete-forward ()
49 "Return the DEL/BS key mappings to the XEmacs default"
50 (interactive)
51 (define-key key-translation-map [backspace] [backspace])
52 (define-key key-translation-map [delete] [delete])
53 (define-key key-translation-map [(meta backspace)] [(meta backspace)])
54 (define-key key-translation-map [(meta delete)] [(meta delete)]))
55
56 (provide 'delbs)
57
58 ;;; delbs.el ends here