emacs-elpa-diffs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[elpa] externals/realgud a6783f5 129/140: Add breakpoint buffer tracking


From: Rocky Bernstein
Subject: [elpa] externals/realgud a6783f5 129/140: Add breakpoint buffer tracking to source window
Date: Sat, 25 May 2019 19:35:49 -0400 (EDT)

branch: externals/realgud
commit a6783f5d7172c0c7d9a2fa93e3793b8f5f3f104b
Author: rocky <address@hidden>
Commit: rocky <address@hidden>

    Add breakpoint buffer tracking to source window
---
 realgud/common/buffer/breakpoint.el | 20 ++++++++++----------
 realgud/common/buffer/command.el    | 11 ++++++++---
 realgud/common/follow.el            |  1 +
 3 files changed, 19 insertions(+), 13 deletions(-)

diff --git a/realgud/common/buffer/breakpoint.el 
b/realgud/common/buffer/breakpoint.el
index da49db2..23cb047 100644
--- a/realgud/common/buffer/breakpoint.el
+++ b/realgud/common/buffer/breakpoint.el
@@ -94,6 +94,7 @@
     (with-current-buffer-safe cmdbuf
       (let ((brkpt-pat (realgud-cmdbuf-pat "debugger-breakpoint"))
            (brkpt-pos-ring)
+           (bp-list (realgud-cmdbuf-info-bp-list realgud-cmdbuf-info))
            (sleep-count 0)
            )
        (unless brkpt-pat
@@ -126,7 +127,7 @@
              (if divert-string
                  (let* ((duple
                          (realgud:breakpoint-add-text-properties
-                          brkpt-pat cmdbuf divert-string))
+                          brkpt-pat cmdbuf divert-string bp-list))
                         (string-with-props
                          (ansi-color-filter-apply (car duple)))
                         (brkpt-num-pos-list (cadr duple))
@@ -246,14 +247,11 @@ non-digit will start entry number from the beginning 
again."
               (setq acc "")))))
     (message "`realgud-goto-breakpoint-n' must be bound to a number key")))
 
-(defun realgud:breakpoint-add-text-properties(brkpt-pat cmdbuf &optional 
opt-string)
-  "Parse OPT-STRING or the current buffer and add frame properties: frame 
number,
-filename, line number, whether the frame is selected as text properties."
+(defun realgud:breakpoint-add-text-properties(brkpt-pat cmdbuf string bp-list)
+  "Parse STRING or the current buffer and add frame properties: breakpoint 
number,
+filename, and line number as text properties."
 
-  (let* ((string (or opt-string
-                   (buffer-substring (point-min) (point-max))
-                   ))
-        (stripped-string (ansi-color-filter-apply string))
+  (let* ((stripped-string (ansi-color-filter-apply string))
         (brkpt-regexp (realgud-loc-pat-regexp brkpt-pat))
         (brkpt-group-pat (realgud-loc-pat-num brkpt-pat))
         (file-group-pat (realgud-loc-pat-file-group brkpt-pat))
@@ -265,6 +263,7 @@ filename, line number, whether the frame is selected as 
text properties."
         )
     (while (string-match brkpt-regexp stripped-string last-pos)
       (let ((brkpt-num-str) (brkpt-num) (line-num) (filename)
+           (loc)
            ;; From https://github.com/realgud/realgud/pull/192
            ;; Each brkpt of breakpoint is searched via string-match
            ;; invocation and a position of the current brkpt is
@@ -284,13 +283,14 @@ filename, line number, whether the frame is selected as 
text properties."
                               (match-beginning brkpt-group-pat)
                               (match-end brkpt-group-pat)))
              (setq brkpt-num (string-to-number brkpt-num-str))
+             (setq loc (seq-find (lambda (elt) (equal brkpt-num 
(realgud-loc-num elt))) bp-list))
              (setq brkpt-num-pos (match-beginning brkpt-group-pat))
              (cl-pushnew brkpt-num-pos brkpt-num-pos-list)
              (add-text-properties (match-beginning brkpt-group-pat)
                                   (match-end brkpt-group-pat)
                                   (list 'mouse-face 'highlight
                                         'help-echo "mouse-2: goto this brkpt"
-                                        'brkpt brkpt-num)
+                                        'mark (realgud-loc-marker loc))
                                   string)
              )
          ; else
@@ -330,7 +330,7 @@ filename, line number, whether the frame is selected as 
text properties."
        (when (and (stringp filename) (numberp line-num))
          (let ((loc (realgud:file-loc-from-line filename line-num cmdbuf)))
            (put-text-property whole-match-begin whole-match-end
-                              'loc loc string)
+                              'mark loc string)
            ))
        (put-text-property whole-match-begin whole-match-end
                           'brkpt-num  brkpt-num string)
diff --git a/realgud/common/buffer/command.el b/realgud/common/buffer/command.el
index 66b381d..f8bf7ee 100644
--- a/realgud/common/buffer/command.el
+++ b/realgud/common/buffer/command.el
@@ -203,13 +203,18 @@
 ;; FIXME: this is a cheat. We are inserting
 ;; and afterwards inserting ""
 (defun realgud:cmdbuf-bp-list-describe (info)
-  (let ((bp-list (delete-dups (realgud-cmdbuf-info-bp-list info))))
+  (let ((bp-list (realgud-cmdbuf-info-bp-list info))
+       ;; For reasons I don't understand bp-list has duplicates
+       (bp-nums nil))
     (cond (bp-list
           (insert "** Breakpoint list (bp-list)\n")
           (dolist (loc bp-list "")
             (let ((bp-num (realgud-loc-num loc)))
-              (insert (format "*** Breakpoint %d\n" bp-num))
-              (realgud:org-mode-append-loc loc))))
+              (when (not (cl-member bp-num bp-nums))
+                (insert (format "*** Breakpoint %d\n" bp-num))
+                (realgud:org-mode-append-loc loc)
+                (setq bp-nums (cl-adjoin bp-num bp-nums))
+              ))))
          ;; Since we are inserting, the below in fact
          ;; inserts nothing. The string return is
          ;; aspirational for when this is fixed
diff --git a/realgud/common/follow.el b/realgud/common/follow.el
index 65aa879..fe7e305 100644
--- a/realgud/common/follow.el
+++ b/realgud/common/follow.el
@@ -33,6 +33,7 @@
         (frame-num (get-text-property pos 'frame-num))
         )
     (cond ((markerp mark) (realgud:follow-mark mark) 't)
+         ((realgud-loc-p mark) (realgud:follow-mark (realgud-loc-marker mark)) 
't)
          ((stringp filename)
           (find-file-other-window filename))
          ((numberp frame-num) (realgud:cmd-frame frame-num))



reply via email to

[Prev in Thread] Current Thread [Next in Thread]