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.

85 lines
2.5 KiB

  1. ;; Copyright (C) 2013-2016 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. ;;; Golang SSA gub tracking a comint buffer.
  8. (require 'load-relative)
  9. (require-relative-list '(
  10. "../../common/cmds"
  11. "../../common/menu"
  12. "../../common/track"
  13. "../../common/track-mode"
  14. )
  15. "realgud-")
  16. (require-relative-list '("core" "init") "realgud:gub-")
  17. (realgud-track-mode-vars "gub")
  18. (declare-function realgud-goto-line-for-pt 'realgud-track-mode)
  19. (declare-function realgud-track-mode 'realgud-track-mode)
  20. (declare-function realgud:track-set-debugger 'realgud-track-mode)
  21. (declare-function realgud-track-mode-setup 'realgud-track-mode)
  22. (defun realgud:gub-goto-location (pt)
  23. "Display the location mentioned in a location
  24. described by PT."
  25. (interactive "d")
  26. (realgud-goto-line-for-pt pt "general-location"))
  27. (defun realgud:gub-goto-panic-location (pt)
  28. "Display the location mentioned in a location
  29. described by PT."
  30. (interactive "d")
  31. (realgud-goto-line-for-pt pt "panic-backtrace"))
  32. (define-key gub-track-mode-map
  33. (kbd "C-c !!") 'realgud:goto-lang-backtrace-line)
  34. (define-key gub-track-mode-map
  35. (kbd "C-c !b") 'realgud:goto-debugger-backtrace-line)
  36. (define-key gub-track-mode-map
  37. (kbd "C-c !s") 'realgud:gub-goto-location)
  38. (define-key gub-track-mode-map
  39. (kbd "C-c !p") 'realgud:gub-goto-panic-location)
  40. (defun gub-track-mode-hook()
  41. (if gub-track-mode
  42. (progn
  43. (use-local-map gub-track-mode-map)
  44. (message "using gub mode map")
  45. )
  46. (message "gub track-mode-hook disable called"))
  47. )
  48. (define-minor-mode gub-track-mode
  49. "Minor mode for tracking gub source locations inside a process shell via realgud. gub is a Go language debugger.
  50. 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.
  51. \\{gub-track-mode-map}
  52. "
  53. :init-value nil
  54. ;; :lighter " gub" ;; mode-line indicator from realgud-track is sufficient.
  55. ;; The minor mode bindings.
  56. :global nil
  57. :group 'realgud:gub
  58. :keymap gub-track-mode-map
  59. (realgud:track-set-debugger "gub")
  60. (if gub-track-mode
  61. (progn
  62. (realgud-track-mode-setup 't)
  63. (gub-track-mode-hook))
  64. (progn
  65. (setq realgud-track-mode nil)
  66. ))
  67. )
  68. (provide-me "realgud:gub-")