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.

118 lines
4.8 KiB

  1. ;; Copyright (C) 2015 Free Software Foundation, Inc
  2. ;; Author: Rocky Bernstein <rocky@gnu.org>
  3. ;; This program is free software; you can redistribute it and/or modify
  4. ;; it under the terms of the GNU General Public License as published by
  5. ;; the Free Software Foundation, either version 3 of the License, or
  6. ;; (at your option) any later version.
  7. ;; This program is distributed in the hope that it will be useful,
  8. ;; but WITHOUT ANY WARRANTY; without even the implied warranty of
  9. ;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  10. ;; GNU General Public License for more details.
  11. ;; You should have received a copy of the GNU General Public License
  12. ;; along with this program. If not, see <http://www.gnu.org/licenses/>.
  13. ;;; Debugger Backtrace buffer mode settings
  14. (require 'load-relative)
  15. (require-relative-list '("menu" "key") "realgud-")
  16. (require-relative-list '("buffer/command") "realgud-buffer-")
  17. (declare-function realgud-populate-debugger-menu 'realgud-menu)
  18. (declare-function realgud-populate-common-keys 'realgud-menu)
  19. (declare-function realgud-cmdbuf-pat 'realgud-menu)
  20. (defvar realgud:frames-menu nil
  21. "Frames menu in Backtrace menu.")
  22. ;; (setq realgud:frames-menu
  23. ;; (let ((map (make-sparse-keymap "Goto Specific Frames")))
  24. ;; (define-key map [frames-menu]
  25. ;; (list 'menu-item "Specific Frames" 'realgud:frames-menu))
  26. ;; (realgud-menu-item map "Frame 1" 'realgud-goto-frame-1)
  27. ;; (realgud-menu-item map "Frame 2" 'realgud-goto-frame-2)
  28. ;; (realgud-menu-item map "Frame 3" 'realgud-goto-frame-3)
  29. ;; )
  30. ;; map)
  31. (defvar realgud-backtrace-mode-map
  32. (let ((map (realgud-populate-debugger-menu (make-sparse-keymap))))
  33. (suppress-keymap map)
  34. (realgud-populate-common-keys map)
  35. (define-key map "." 'realgud-backtrace-moveto-frame-selected)
  36. (define-key map "r" 'realgud:backtrace-init)
  37. (define-key map [double-mouse-1] 'realgud:follow-event)
  38. (define-key map [mouse-2] 'realgud:follow-event)
  39. (define-key map [enter] 'realgud:follow-event)
  40. (define-key map [mouse-3] 'realgud:follow-event)
  41. (define-key map [enter] 'realgud:follow-event)
  42. (define-key map [return] 'realgud:follow-point)
  43. (define-key map [up] 'realgud-backtrace-moveto-frame-prev)
  44. (define-key map [down] 'realgud-backtrace-moveto-frame-next)
  45. (define-key map "l" 'realgud-recenter-arrow)
  46. (define-key map [frames-menu]
  47. (list 'menu-item "Specific Frames" 'realgud:frames-menu))
  48. ;; FIXME: these can go to a common routine. See also shortkey.el and
  49. ;; key.el
  50. (define-key map "<" 'realgud:cmd-newer-frame)
  51. (define-key map ">" 'realgud:cmd-older-frame)
  52. (define-key map "d" 'realgud:cmd-newer-frame)
  53. (define-key map "u" 'realgud:cmd-older-frame)
  54. (define-key map "q" 'realgud:cmd-quit)
  55. (define-key map "C" 'realgud-window-cmd-undisturb-src)
  56. (define-key map "F" 'realgud:window-bt)
  57. (define-key map "I" 'realgud:cmdbuf-info-describe)
  58. (define-key map "S" 'realgud-window-src-undisturb-cmd)
  59. (define-key map "n" 'realgud-backtrace-moveto-frame-next)
  60. (define-key map "p" 'realgud-backtrace-moveto-frame-prev)
  61. (define-key map "0" 'realgud-goto-frame-n)
  62. (define-key map "1" 'realgud-goto-frame-n)
  63. (define-key map "2" 'realgud-goto-frame-n)
  64. (define-key map "3" 'realgud-goto-frame-n)
  65. (define-key map "4" 'realgud-goto-frame-n)
  66. (define-key map "5" 'realgud-goto-frame-n)
  67. (define-key map "6" 'realgud-goto-frame-n)
  68. (define-key map "7" 'realgud-goto-frame-n)
  69. (define-key map "8" 'realgud-goto-frame-n)
  70. (define-key map "9" 'realgud-goto-frame-n)
  71. ;; --------------------
  72. ;; The "Stack window" submenu.
  73. ;; (let ((submenu realgud:frames-menu))
  74. ;; (define-key-after map [menu-bar debugger stack]
  75. ;; (cons "Stack window" submenu)
  76. ;; 'placeholder))
  77. map)
  78. "Keymap to navigate realgud stack frames.
  79. \\{realgud-backtrace-mode-map}")
  80. (defun realgud-backtrace-mode (&optional cmdbuf)
  81. "Major mode for displaying the stack frames.
  82. \\{realgud-frames-mode-map}"
  83. (interactive)
  84. (kill-all-local-variables)
  85. (setq buffer-read-only 't)
  86. (setq major-mode 'realgud-backtrace-mode)
  87. (setq mode-name "Realgud Stack Frames")
  88. ;; (set (make-local-variable 'realgud-secondary-buffer) t)
  89. (setq mode-line-process 'realgud-mode-line-process)
  90. (use-local-map realgud-backtrace-mode-map)
  91. ;; FIXME: make buffer specific
  92. (if cmdbuf
  93. (let* ((font-lock-keywords
  94. (with-current-buffer cmdbuf
  95. (realgud-cmdbuf-pat "font-lock-keywords"))))
  96. (if font-lock-keywords
  97. (set (make-local-variable 'font-lock-defaults)
  98. (list font-lock-keywords)))
  99. ))
  100. ;; (run-mode-hooks 'realgud-backtrace-mode-hook)
  101. )
  102. (provide-me "realgud-")