Personal emacs config
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

139 lines
5.8 KiB

  1. ;; Author: Rocky Bernstein <rocky@gnu.org>
  2. ;; Version: 1.1
  3. ;; Keywords: internal
  4. ;; URL: http://github.com/rocky/emacs-load-relative
  5. ;; Compatibility: GNU Emacs 24.x
  6. ;; Copyright (C) 2015, 2017, 2019 Free Software Foundation, Inc
  7. ;; This program 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. ;; This program 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 this program. If not, see <http://www.gnu.org/licenses/>.
  17. (provide 'key)
  18. ;;; key.el ends here
  19. (require 'load-relative)
  20. (require-relative "custom" nil "realgud-")
  21. (defcustom realgud-populate-common-fn-keys-function
  22. 'realgud-populate-common-fn-keys-standard
  23. "The function to call to populate key bindings common to all realgud windows.
  24. This includes the secondary windows, the debugger shell, and all
  25. realgud source buffers when the debugger is active.
  26. This variable can be bound to the following:
  27. * `realgud-populate-common-fn-keys-none' -- Don't bind any keys.
  28. * `realgud-populate-common-fn-keys-standard' -- Bind the function
  29. * Any other value is expected to be a callable function that takes one
  30. argument, the keymap, and populates it with suitable keys."
  31. :type 'function
  32. :group 'realgud)
  33. ;; -------------------------------------------------------------------
  34. ;; Key bindings
  35. ;;
  36. (defun realgud-populate-common-fn-keys-standard (&optional map)
  37. "Bind the debugger function key layout used by many debuggers.
  38. \\{realgud-example-map-standard}"
  39. (define-key map [f5] 'realgud:cmd-continue)
  40. (define-key map [S-f5] 'realgud:cmd-quit)
  41. ;; (define-key map [f9] 'realgud-toggle-source-breakpoint)
  42. (define-key map [f9] 'realgud:cmd-break)
  43. ;; (define-key map [C-f9] 'realgud-toggle-source-breakpoint-enabled)
  44. (define-key map [f10] 'realgud:cmd-next)
  45. (define-key map [f11] 'realgud:cmd-step)
  46. (define-key map [S-f11] 'realgud:cmd-finish)
  47. (define-key map [M-down] 'realgud-track-hist-newer)
  48. (define-key map [A-down] 'realgud-track-hist-newer)
  49. (define-key map [M-kp-2] 'realgud-track-hist-newer)
  50. (define-key map [M-up] 'realgud-track-hist-older)
  51. (define-key map [A-up] 'realgud-track-hist-older)
  52. (define-key map [M-kp-8] 'realgud-track-hist-older)
  53. (define-key map [M-kp-up] 'realgud-track-hist-older)
  54. (define-key map [M-kp-down] 'realgud-track-hist-newer)
  55. (define-key map [M-print] 'realgud-track-hist-older)
  56. (define-key map [M-S-down] 'realgud-track-hist-newest)
  57. (define-key map [M-S-up] 'realgud-track-hist-oldest)
  58. (define-key map "\C-c " 'realgud:cmd-break)
  59. )
  60. (defun realgud-populate-common-fn-keys-none (&optional map)
  61. "Do not any debugger function keys"
  62. )
  63. ;; TODO: add eclipse, and netbeans
  64. (defun realgud-populate-common-keys (map)
  65. "Define the keys that are used by all debugger buffers, including
  66. source-code buffers
  67. The variable `realgud-populate-common-fn-keys-function' controls the layout."
  68. (define-key map "\C-x\C-a\C-q" 'realgud-short-key-mode)
  69. (if realgud-populate-common-fn-keys-function
  70. (funcall realgud-populate-common-fn-keys-function map)))
  71. (defun realgud-populate-src-buffer-map-plain (map)
  72. "Bind ordinary text characters used in debugger source-code buffers.
  73. This does not touch change menus; for that see `realgud-populate-debugger-menu'.
  74. Nor does it touch prefix keys; for that see `realgud-populate-keys-standard'"
  75. ;; Common Debugger functions
  76. (let ((prefix-map (make-sparse-keymap)))
  77. (define-key map "b" 'realgud:cmd-break)
  78. (define-key map "D" 'realgud:cmd-delete)
  79. (define-key map "X" 'realgud:cmd-clear)
  80. (define-key map "-" 'realgud:cmd-disable)
  81. (define-key map "+" 'realgud:cmd-enable)
  82. (define-key map "T" 'realgud:cmd-backtrace)
  83. (define-key map [delete] 'realgud:cmd-delete)
  84. (define-key map [enter] 'realgud:cmd-repeat-last)
  85. (define-key map (kbd "RET") 'realgud:cmd-repeat-last)
  86. (define-key map " " 'realgud:cmd-step)
  87. (define-key map "f" 'realgud:cmd-finish)
  88. (define-key map "n" 'realgud:cmd-next)
  89. (define-key map "q" 'realgud:cmd-quit)
  90. (define-key map "k" 'realgud:cmd-kill)
  91. (define-key map "r" 'realgud:cmd-restart)
  92. (define-key map "R" 'realgud:cmd-restart)
  93. (define-key map "s" 'realgud:cmd-step)
  94. (define-key map "!" 'realgud:cmd-shell)
  95. ;; FIXME: these can go to a common routine. See also shortkey.el
  96. ;; and backtrace-mode.el
  97. (define-key map "<" 'realgud:cmd-newer-frame)
  98. (define-key map ">" 'realgud:cmd-older-frame)
  99. (define-key map "d" 'realgud:cmd-newer-frame)
  100. (define-key map "B" 'realgud:window-brkpt)
  101. (define-key map "u" 'realgud:cmd-older-frame)
  102. (define-key map "C" 'realgud-window-cmd-undisturb-src)
  103. (define-key map "F" 'realgud:window-bt)
  104. (define-key map "Q" 'realgud:cmd-terminate)
  105. (define-key map "S" 'realgud-window-src-undisturb-cmd)
  106. (define-key map "U" 'realgud:cmd-until)
  107. (define-key map "h" 'realgud:cmd-until-here)
  108. (define-key map [M-down] 'realgud-track-hist-newer)
  109. (define-key map [M-kp-2] 'realgud-track-hist-newer)
  110. (define-key map [M-up] 'realgud-track-hist-older)
  111. (define-key map [M-kp-8] 'realgud-track-hist-older)
  112. (define-key map [M-kp-up] 'realgud-track-hist-older)
  113. (define-key map [M-kp-down] 'realgud-track-hist-newer)
  114. (define-key map [M-print] 'realgud-track-hist-older)
  115. (define-key map [M-S-down] 'realgud-track-hist-newest)
  116. (define-key map [M-S-up] 'realgud-track-hist-oldest)
  117. ))
  118. (provide-me "realgud-")