1 ;;; Copyright (C) 2010, 2014 Rocky Bernstein <rocky@gnu.org>
2 ;; reset state on quit or restart
4 (require 'load-relative)
6 (require-relative-list '("bp" "fringe" "helper") "realgud-")
7 (require-relative-list '("buffer/helper" "buffer/command" "buffer/source")
10 (declare-function loc-changes-clear-buffer 'loc-changes)
11 (declare-function realgud-bp-remove-icons 'realgud-buffer-command)
12 (declare-function realgud-cmdbuf? 'realgud-buffer-command)
13 (declare-function realgud-get-cmdbuf-from-srcbuf 'realgud-buffer-helper)
14 (declare-function realgud-fringe-erase-history-arrows
15 'realgud-buffer-command)
17 (defun realgud:reset (&optional opt-buffer)
18 "Reset state prior to quitting or restarting"
20 (let* ((buf (or opt-buffer (current-buffer)))
22 (cond ((realgud-cmdbuf? buf) buf)
23 ((realgud-get-cmdbuf-from-srcbuf buf))
26 (with-current-buffer cmdbuf
27 (realgud-fringe-erase-history-arrows)
28 (let ((buf-list (realgud-sget 'cmdbuf-info 'srcbuf-list)))
29 (dolist (buf buf-list buf-list)
30 (with-current-buffer buf
31 (loc-changes-clear-buffer)
32 (realgud-fringe-erase-history-arrows)
33 ;; FIXME: iterate over specific breakpoints.
34 (realgud-bp-remove-icons (point-min) (point-max))
36 (message "buffer %s" buf)
38 (setq realgud-cmdbuf-info nil)
41 (error "Unable to find command buffer from %s" buf)
45 (provide-me "realgud-")