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.

58 lines
2.0 KiB

  1. ;; Copyright (C) 2010, 2014, 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. ;; 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. ;; reset state on quit or restart
  12. (require 'load-relative)
  13. (require 'loc-changes)
  14. (require-relative-list '("bp" "fringe" "helper") "realgud-")
  15. (require-relative-list '("buffer/helper" "buffer/command" "buffer/source")
  16. "realgud-buffer-")
  17. (declare-function loc-changes-clear-buffer 'loc-changes)
  18. (declare-function realgud-bp-remove-icons 'realgud-buffer-command)
  19. (declare-function realgud-cmdbuf? 'realgud-buffer-command)
  20. (declare-function realgud-get-cmdbuf-from-srcbuf 'realgud-buffer-helper)
  21. (declare-function realgud-fringe-erase-history-arrows
  22. 'realgud-buffer-command)
  23. (defun realgud:reset (&optional opt-buffer)
  24. "Reset state prior to quitting or restarting"
  25. (interactive)
  26. (let* ((buf (or opt-buffer (current-buffer)))
  27. (cmdbuf
  28. (cond ((realgud-cmdbuf? buf) buf)
  29. ((realgud-get-cmdbuf-from-srcbuf buf))
  30. ('t nil))))
  31. (if cmdbuf
  32. (with-current-buffer cmdbuf
  33. (realgud-fringe-erase-history-arrows)
  34. (let ((buf-list (realgud-sget 'cmdbuf-info 'srcbuf-list)))
  35. (dolist (buf buf-list buf-list)
  36. (with-current-buffer buf
  37. (loc-changes-clear-buffer)
  38. (realgud-fringe-erase-history-arrows)
  39. ;; FIXME: iterate over specific breakpoints.
  40. (realgud-bp-remove-icons (point-min) (point-max))
  41. )
  42. (message "buffer %s" buf)
  43. ))
  44. (setq realgud-cmdbuf-info nil)
  45. )
  46. ;; else
  47. (error "Unable to find command buffer from %s" buf)
  48. ))
  49. )
  50. (provide-me "realgud-")