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.

112 lines
3.8 KiB

  1. ;; Copyright (C) 2015-2016, 2018-2019 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. ;; `bashdb' Main interface to bashdb via Emacs
  14. (require 'load-relative)
  15. (require-relative-list '("../../common/cmds"
  16. "../../common/helper")
  17. "realgud-")
  18. (require-relative-list '("../../common/run") "realgud:")
  19. (require-relative-list '("core" "track-mode") "realgud:bashdb-")
  20. ;; This is needed, or at least the docstring part of it is needed to
  21. ;; get the customization menu to work in Emacs 25.
  22. (defgroup realgud:bashdb nil
  23. "The realgud interface to bashdb"
  24. :group 'realgud
  25. :version "25.3")
  26. (declare-function realgud-command 'realgud:cmds)
  27. ;; -------------------------------------------------------------------
  28. ;; User-definable variables
  29. ;;
  30. (defcustom realgud:bashdb-command-name
  31. ;;"bashdb --emacs 3"
  32. "bashdb"
  33. "File name for executing the bash debugger and command options.
  34. This should be an executable on your path, or an absolute file name."
  35. :type 'string
  36. :group 'realgud:bashdb)
  37. ;; -------------------------------------------------------------------
  38. ;; The end.
  39. ;;
  40. (declare-function bashdb-track-mode 'realgud-bashdb-track-mode)
  41. (declare-function bashdb-query-cmdline 'realgud:bashdb-core)
  42. (declare-function bashdb-parse-cmd-args 'realgud:bashdb-core)
  43. (declare-function realgud:run-debugger 'realgud:run)
  44. ;;;###autoload
  45. (defun realgud:bashdb (&optional opt-cmd-line no-reset)
  46. "Invoke the bashdb shell debugger and start the Emacs user interface.
  47. String OPT-CMD-LINE specifies how to run bash. You will be prompted
  48. for a command line is one isn't supplied.
  49. OPT-CMD-LINE is treated like a shell string; arguments are
  50. tokenized by `split-string-and-unquote'. The tokenized string is
  51. parsed by `bashdb-parse-cmd-args' and path elements found by that
  52. are expanded using `realgud:expand-file-name-if-exists'.
  53. Normally, command buffers are reused when the same debugger is
  54. reinvoked inside a command buffer with a similar command. If we
  55. discover that the buffer has prior command-buffer information and
  56. NO-RESET is nil, then that information which may point into other
  57. buffers and source buffers which may contain marks and fringe or
  58. marginal icons is reset. See `loc-changes-clear-buffer' to clear
  59. fringe and marginal icons.
  60. "
  61. (interactive)
  62. (realgud:run-debugger "bashdb"
  63. 'bashdb-query-cmdline
  64. 'bashdb-parse-cmd-args
  65. 'realgud:bashdb-minibuffer-history
  66. opt-cmd-line no-reset)
  67. )
  68. (defun realgud:bashdb-large (&optional opt-cmd-line no-reset)
  69. "Use this is the program you are debugging is large, say over 1,000 lines or so.
  70. "
  71. (interactive)
  72. (let ((cmd-buf
  73. (realgud:run-debugger "bashdb"
  74. 'bashdb-query-cmdline
  75. 'bashdb-parse-cmd-args
  76. 'realgud:bashdb-minibuffer-history
  77. opt-cmd-line no-reset)
  78. ))
  79. (if cmd-buf
  80. (let ((process (get-buffer-process cmd-buf)))
  81. (if (and process (eq 'run (process-status process)))
  82. (with-current-buffer cmd-buf
  83. (sleep-for 1)
  84. (realgud-command "frame 0" nil nil nil)
  85. )))
  86. )
  87. ))
  88. ;;;###autoload
  89. (defalias 'bashdb 'realgud:bashdb)
  90. ;;;###autoload
  91. (defalias 'bashdb-large 'realgud:bashdb-large)
  92. (provide-me "realgud-")