]> code.delx.au - gnu-emacs-elpa/blob - packages/realgud/realgud/debugger/trepan/track-mode.el
b4b2ddff2fae3daa845139caf88c5119204fdc66
[gnu-emacs-elpa] / packages / realgud / realgud / debugger / trepan / track-mode.el
1 ;;; Copyright (C) 2010, 2012-2015 Rocky Bernstein <rocky@gnu.org>
2 ;;; Ruby "trepan" Debugger tracking a comint or eshell buffer.
3
4 (eval-when-compile (require 'cl))
5 (require 'load-relative)
6 (require-relative-list '(
7 "../../common/cmds"
8 "../../common/menu"
9 "../../common/track"
10 "../../common/track-mode"
11 )
12 "realgud-")
13 (require-relative-list '("core" "init") "realgud:trepan-")
14 (require-relative-list '("../../lang/ruby") "realgud-lang-")
15
16 (declare-function realgud-track-mode 'realgud-track-mode)
17 (declare-function realgud-track-mode-hook 'realgud-track-mode)
18 (declare-function realgud-track-mode-setup 'realgud-track-mode)
19 (declare-function realgud:track-set-debugger 'realgud-track-mode)
20 (declare-function realgud-goto-line-for-pt 'realgud-track-mode)
21
22 (realgud-track-mode-vars "trepan")
23
24 (define-key realgud-track-mode-map
25 (kbd "C-c !!") 'realgud:goto-lang-backtrace-line)
26 (define-key realgud-track-mode-map
27 (kbd "C-c !b") 'realgud:goto-debugger-backtrace-line)
28
29 (declare-function realgud:ruby-populate-command-keys 'realgud-lang-ruby)
30
31 (defun realgud:trepan-goto-control-frame-line (pt)
32 "Display the location mentioned by a control-frame line
33 described by PT."
34 (interactive "d")
35 (realgud-goto-line-for-pt pt "control-frame"))
36
37 (defun realgud:trepan-goto-syntax-error-line (pt)
38 "Display the location mentioned in a Syntax error line
39 described by PT."
40 (interactive "d")
41 (realgud-goto-line-for-pt pt "syntax-error"))
42
43 (realgud:ruby-populate-command-keys trepan-track-mode-map)
44
45 (define-key trepan-track-mode-map
46 (kbd "C-c !c") 'realgud:trepan-goto-control-frame-line)
47 (define-key trepan-track-mode-map
48 (kbd "C-c !s") 'realgud:trepan-goto-syntax-error-line)
49
50 (defun trepan-track-mode-hook()
51 (if trepan-track-mode
52 (progn
53 (use-local-map trepan-track-mode-map)
54 (message "using trepan mode map")
55 )
56 (message "trepan track-mode-hook disable called"))
57 )
58
59 (define-minor-mode trepan-track-mode
60 "Minor mode for tracking trepan source locations inside a process shell via realgud. trepan is a Ruby debugger.
61
62 If called interactively with no prefix argument, the mode is toggled. A prefix argument, captured as ARG, enables the mode if the argument is positive, and disables it otherwise.
63
64 \\{trepan-track-mode-map}
65 "
66 :init-value nil
67 ;; :lighter " trepan" ;; mode-line indicator from realgud-track is sufficient.
68 ;; The minor mode bindings.
69 :global nil
70 :group 'realgud:trepan
71 :keymap trepan-track-mode-map
72 (realgud:track-set-debugger "trepan")
73 (if trepan-track-mode
74 (progn
75 (realgud-track-mode-setup 't)
76 (trepan-track-mode-hook))
77 (progn
78 (setq realgud-track-mode nil)
79 ))
80 )
81
82 (provide-me "realgud:trepan-")