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

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

[elpa] master 52d6b82 23/56: Closer to getting column info used


From: Rocky Bernstein
Subject: [elpa] master 52d6b82 23/56: Closer to getting column info used
Date: Sat, 27 May 2017 05:02:32 -0400 (EDT)

branch: master
commit 52d6b829fbf093074f63112998940c10002fc298
Author: rocky <address@hidden>
Commit: rocky <address@hidden>

    Closer to getting column info used
    
    Pass column parameter and rely less on command-buffer global settings
    but instead get those from the location structure.
---
 Makefile.am                      |  3 +++
 realgud/common/file.el           |  3 ++-
 realgud/common/track.el          | 48 ++++++++++++++++++++++++----------------
 realgud/debugger/jdb/core.el     |  4 ++--
 realgud/debugger/trepan/core.el  |  4 ++--
 realgud/debugger/trepan2/core.el |  4 ++--
 test/test-track.el               | 24 ++++++++++++++++++--
 7 files changed, 62 insertions(+), 28 deletions(-)

diff --git a/Makefile.am b/Makefile.am
index f525b99..5188ce8 100644
--- a/Makefile.am
+++ b/Makefile.am
@@ -1 +1,4 @@
 SUBDIRS = realgud
+
+check check-short:
+       $(MAKE) -C test $@
diff --git a/realgud/common/file.el b/realgud/common/file.el
index 7b265ac..ad4d022 100644
--- a/realgud/common/file.el
+++ b/realgud/common/file.el
@@ -123,7 +123,8 @@ problem as best as we can determine."
                                (goto-char (point-min))
                                ;; FIXME allow for byte offset
                                (forward-line (1- line-number))
-                               (move-to-column (1- column-number))
+                               (if (> column-number 0)
+                                   (move-to-column (1- column-number)))
                                (make-realgud-loc
                                      :num           bp-num
                                      :cmd-marker    cmd-marker
diff --git a/realgud/common/track.el b/realgud/common/track.el
index ed96e88..070d9b0 100644
--- a/realgud/common/track.el
+++ b/realgud/common/track.el
@@ -154,7 +154,17 @@ finding a new location/s.  The parameter TEXT appears 
because it
 is part of the comint-output-filter-functions API. Instead we use
 marks set in buffer-local variables to extract text"
   (if (and realgud-track-mode (realgud-cmdbuf? (current-buffer)))
-      (realgud-track-loc text (point-marker))
+      (let ((loc-regexp (realgud-sget 'cmdbuf-info 'loc-regexp))
+           (file-group (realgud-sget 'cmdbuf-info 'file-group))
+           (line-group (realgud-sget 'cmdbuf-info 'line-group))
+           (column-group (realgud-sget 'cmdbuf-info 'column-group))
+           (alt-file-group (realgud-sget 'cmdbuf-info 'alt-file-group))
+           (alt-line-group (realgud-sget 'cmdbuf-info 'alt-line-group))
+           (text-group (realgud-sget 'cmdbuf-info 'text-group))
+           )
+       (realgud-track-loc text (point-marker) loc-regexp file-group
+                          line-group column-group text-group
+                          ))
     ))
 
 (defun realgud:track-complain-if-not-in-cmd-buffer (&optional buf errorp)
@@ -183,13 +193,22 @@ evaluating (realgud-cmdbuf-info-loc-regexp 
realgud-cmdbuf-info)"
   (interactive "r")
   (if (> from to) (psetq to from from to))
   (let* ((text (buffer-substring-no-properties from to))
-        (loc (realgud-track-loc text cmd-mark))
+        (cmdbuf (or opt-cmdbuf (current-buffer)))
+        (loc-regexp (realgud-sget 'cmdbuf-info 'loc-regexp))
+        (file-group (realgud-sget 'cmdbuf-info 'file-group))
+        (line-group (realgud-sget 'cmdbuf-info 'line-group))
+        (column-group (realgud-sget 'cmdbuf-info 'column-group))
+        (alt-file-group (realgud-sget 'cmdbuf-info 'alt-file-group))
+        (alt-line-group (realgud-sget 'cmdbuf-info 'alt-line-group))
+        (text-group (realgud-sget 'cmdbuf-info 'text-group))
+        (loc (realgud-track-loc text cmd-mark loc-regexp file-group
+                                line-group column-group text-group
+                                ))
         ;; If we see a selected frame number, it is stored
         ;; in frame-num. Otherwise, nil.
         (frame-num)
         (text-sans-loc)
         (bp-loc)
-        (cmdbuf (or opt-cmdbuf (current-buffer)))
         )
     (unless (realgud:track-complain-if-not-in-cmd-buffer cmdbuf t)
        (if (not (equal "" text))
@@ -374,9 +393,10 @@ encountering a new loc."
        ))
   )
 
-(defun realgud-track-loc(text cmd-mark &optional opt-regexp opt-file-group
-                          opt-line-group opt-col-group no-warn-on-no-match?
-                          opt-ignore-file-re)
+(defun realgud-track-loc(text cmd-mark loc-regexp file-group
+                             line-group column-group text-group
+                             &optional no-warn-on-no-match?
+                             opt-ignore-file-re)
   "Do regular-expression matching to find a file name and line number inside
 string TEXT. If we match, we will turn the result into a realgud-loc struct.
 Otherwise return nil."
@@ -391,19 +411,8 @@ Otherwise return nil."
 
   (unless (realgud:track-complain-if-not-in-cmd-buffer)
       (let
-         ((loc-regexp (or opt-regexp
-                          (realgud-sget 'cmdbuf-info 'loc-regexp)))
-          (file-group (or opt-file-group
-                          (realgud-sget 'cmdbuf-info 'file-group)))
-          (line-group (or opt-line-group
-                          (realgud-sget 'cmdbuf-info 'line-group)))
-          (column-group (or opt-col-group
-                            (realgud-sget 'cmdbuf-info 'column-group)))
-          (alt-file-group (realgud-sget 'cmdbuf-info 'alt-file-group))
+         ((alt-file-group (realgud-sget 'cmdbuf-info 'alt-file-group))
           (alt-line-group (realgud-sget 'cmdbuf-info 'alt-line-group))
-          ;; FIXME: should pass as parameter
-          (text-group)
-          ;; (text-group (realgud-sget 'cmdbuf-info 'text-group))
           (ignore-file-re (or opt-ignore-file-re
                               (realgud-sget 'cmdbuf-info 'ignore-file-re)))
           (callback-loc-fn (realgud-sget 'cmdbuf-info 'callback-loc-fn))
@@ -430,7 +439,7 @@ Otherwise return nil."
                                      source-str)))
                  (cond (callback-loc-fn
                         (funcall callback-loc-fn text
-                                 filename lineno source-str
+                                 filename lineno column source-str
                                  ignore-file-re cmd-mark))
                        ('t
                         (unless line-str
@@ -726,6 +735,7 @@ find a location. non-nil if we can find a location.
                                (realgud-loc-pat-file-group loc-pat)
                                (realgud-loc-pat-line-group loc-pat)
                                (realgud-loc-pat-column-group loc-pat)
+                               (realgud-loc-pat-text-group loc-pat)
                                nil
                                (realgud-loc-pat-ignore-file-re loc-pat)
                                ))
diff --git a/realgud/debugger/jdb/core.el b/realgud/debugger/jdb/core.el
index 4392fc1..5f927cb 100644
--- a/realgud/debugger/jdb/core.el
+++ b/realgud/debugger/jdb/core.el
@@ -97,10 +97,10 @@ that works."
      ))
   )
 
-(defun realgud:jdb-loc-fn-callback(text filename lineno source-str
+(defun realgud:jdb-loc-fn-callback(text filename lineno column source-str
                                        ignore-file-re cmd-mark)
   (realgud:file-loc-from-line filename lineno nil
-                             cmd-mark source-str nil
+                             cmd-mark source-str column
                              ignore-file-re 'realgud:jdb-find-file))
 
 (defun realgud:jdb-parse-cmd-args (orig-args)
diff --git a/realgud/debugger/trepan/core.el b/realgud/debugger/trepan/core.el
index de3cb35..93bd402 100644
--- a/realgud/debugger/trepan/core.el
+++ b/realgud/debugger/trepan/core.el
@@ -76,9 +76,9 @@ future, we may also consult RUBYPATH."
       ))
     ))
 
-(defun realgud:trepan-loc-fn-callback(text filename lineno source-str
+(defun realgud:trepan-loc-fn-callback(text filename lineno column source-str
                                           ignore-file-re cmd-mark)
-  (realgud:file-loc-from-line filename lineno nil
+  (realgud:file-loc-from-line filename lineno column
                              cmd-mark source-str nil nil
                              'realgud:trepan-find-file))
 
diff --git a/realgud/debugger/trepan2/core.el b/realgud/debugger/trepan2/core.el
index 93a4ad4..2c2c282 100644
--- a/realgud/debugger/trepan2/core.el
+++ b/realgud/debugger/trepan2/core.el
@@ -85,9 +85,9 @@ we may also consult PYTHONPATH."
       ))
     ))
 
-(defun realgud:trepan2-loc-fn-callback(text filename lineno source-str
+(defun realgud:trepan2-loc-fn-callback(text filename lineno column source-str
                                            ignore-file-re cmd-mark)
-  (realgud:file-loc-from-line filename lineno nil
+  (realgud:file-loc-from-line filename lineno column
                              cmd-mark source-str nil nil
                              'realgud:trepan2-find-file))
 
diff --git a/test/test-track.el b/test/test-track.el
index d50e283..d167cb8 100644
--- a/test/test-track.el
+++ b/test/test-track.el
@@ -24,11 +24,18 @@
 (test-simple-start)
 
 (eval-when-compile
+  (defvar alt-file-group)
+  (defvar alt-line-group)
+  (defvar column-group)
   (defvar debugger-output)
+  (defvar file-group)
+  (defvar line-group)
   (defvar line-number)
+  (defvar loc-regexp)
   (defvar realgud-pat-hash)
   (defvar test-filename)
   (defvar test-loc)
+  (defvar text-group)
 )
 
 ;; Some setup usually done in setting up the buffer.
@@ -38,13 +45,26 @@
 
 ;; FIXME/WARNING the below is customized for trepan
 (realgud-cmdbuf-init (current-buffer) "trepan"
-                 (gethash "trepan" realgud-pat-hash))
+                    (gethash "trepan" realgud-pat-hash))
+
+(setq loc-regexp (realgud-sget 'cmdbuf-info 'loc-regexp))
+(setq file-group (realgud-sget 'cmdbuf-info 'file-group))
+(setq line-group (realgud-sget 'cmdbuf-info 'line-group))
+(setq column-group (realgud-sget 'cmdbuf-info 'column-group))
+(setq alt-file-group (realgud-sget 'cmdbuf-info 'alt-file-group))
+(setq alt-line-group (realgud-sget 'cmdbuf-info 'alt-line-group))
+(setq text-group (realgud-sget 'cmdbuf-info 'text-group))
 
 (setq test-filename (symbol-file 'test-simple))
 (setq line-number 7)
 (setq debugger-output (format "-> (%s:%d)\nrequire 'foo'\n(trepan):\n"
                              test-filename line-number))
-(setq test-loc (realgud-track-loc debugger-output nil))
+(setq test-loc
+      (realgud-track-loc debugger-output nil
+                        loc-regexp file-group
+                        line-group column-group text-group
+                        ))
+
 (assert-t (realgud-loc-p test-loc)   "loc extracted")
 (assert-equal "(trepan):\n"
              (realgud-track-loc-remaining debugger-output)



reply via email to

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