pc-mode.el 1.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657
  1. ;;; pc-mode.el --- emulate certain key bindings used on PCs
  2. ;; Copyright (C) 1995, 2001-2012 Free Software Foundation, Inc.
  3. ;; Maintainer: FSF
  4. ;; Keywords: emulations
  5. ;; Obsolete-since: 24.1
  6. ;; This file is part of GNU Emacs.
  7. ;; GNU Emacs is free software: you can redistribute it and/or modify
  8. ;; it under the terms of the GNU General Public License as published by
  9. ;; the Free Software Foundation, either version 3 of the License, or
  10. ;; (at your option) any later version.
  11. ;; GNU Emacs is distributed in the hope that it will be useful,
  12. ;; but WITHOUT ANY WARRANTY; without even the implied warranty of
  13. ;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  14. ;; GNU General Public License for more details.
  15. ;; You should have received a copy of the GNU General Public License
  16. ;; along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>.
  17. ;;; Commentary:
  18. ;;; Code:
  19. ;;;###autoload
  20. (defun pc-bindings-mode ()
  21. "Set up certain key bindings for PC compatibility.
  22. The keys affected are:
  23. Delete (and its variants) delete forward instead of backward.
  24. C-Backspace kills backward a word (as C-Delete normally would).
  25. M-Backspace does undo.
  26. Home and End move to beginning and end of line
  27. C-Home and C-End move to beginning and end of buffer.
  28. C-Escape does list-buffers."
  29. (interactive)
  30. (define-key function-key-map [delete] "\C-d")
  31. (define-key function-key-map [M-delete] [?\M-d])
  32. (define-key function-key-map [C-delete] [?\M-d])
  33. (global-set-key [C-M-delete] 'kill-sexp)
  34. (global-set-key [C-backspace] 'backward-kill-word)
  35. (global-set-key [M-backspace] 'undo)
  36. (global-set-key [C-escape] 'list-buffers)
  37. (global-set-key [home] 'beginning-of-line)
  38. (global-set-key [end] 'end-of-line)
  39. (global-set-key [C-home] 'beginning-of-buffer)
  40. (global-set-key [C-end] 'end-of-buffer))
  41. (provide 'pc-mode)
  42. ;;; pc-mode.el ends here