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

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

[elpa] master ba7a8b1 045/215: bang on trepanjs and nodejs.


From: Rocky Bernstein
Subject: [elpa] master ba7a8b1 045/215: bang on trepanjs and nodejs.
Date: Sat, 30 Jul 2016 14:48:52 +0000 (UTC)

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

    bang on trepanjs and nodejs.
    cmds.el: Allow for debug commands not to be implemented
---
 realgud/common/cmds.el            |   58 +++++++++++++++++++++++++------------
 realgud/debugger/nodejs/core.el   |    5 ++--
 realgud/debugger/nodejs/init.el   |    8 +++--
 realgud/debugger/trepanjs/core.el |   11 ++++---
 4 files changed, 51 insertions(+), 31 deletions(-)

diff --git a/realgud/common/cmds.el b/realgud/common/cmds.el
index 9ecc759..1745302 100644
--- a/realgud/common/cmds.el
+++ b/realgud/common/cmds.el
@@ -1,4 +1,20 @@
-;;; Copyright (C) 2010-2011, 2013-2015 Rocky Bernstein <address@hidden>
+;; Copyright (C) 2015 Free Software Foundation, Inc
+
+;; Author: Rocky Bernstein <address@hidden>
+
+;; This program is free software; you can redistribute it and/or modify
+;; it under the terms of the GNU General Public License as published by
+;; the Free Software Foundation, either version 3 of the License, or
+;; (at your option) any later version.
+
+;; This program is distributed in the hope that it will be useful,
+;; but WITHOUT ANY WARRANTY; without even the implied warranty of
+;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+;; GNU General Public License for more details.
+
+;; You should have received a copy of the GNU General Public License
+;; along with this program.  If not, see <http://www.gnu.org/licenses/>.
+
 (require 'load-relative)
 (require-relative-list  '("send" "core") "realgud-")
 (require-relative-list  '("buffer/command") "realgud-buffer-")
@@ -32,24 +48,28 @@ a shortcut for that key."
       (unless (and cmd-hash (setq cmd (gethash cmd-name cmd-hash)))
        (setq cmd default-cmd-template))
       )
-    (realgud-command cmd arg no-record? frame-switch? realgud-prompts?)
-    ;; FIXME: Figure out how to update the position if the source
-    ;; buffer is displayed.
-    ;; (if frame-switch?
-    ;;         (let* ((src-buffer (realgud-get-srcbuf-from-cmdbuf cmdbuf))
-    ;;                (src-window (get-buffer-window src-buffer))
-    ;;                ))
-    ;;           (with-selected-window src-window
-    ;;             (message "recentering...")
-    ;;             (realgud-recenter-arrow)
-    ;;           ))
-    )
-  ;; FIXME: this is a one-time thing. Put in caller.
-  (if key
-      (local-set-key (format "\C-c%s" key)
-                    (intern (format "realgud:cmd-%s" cmd-name)))
-    )
-  )
+    (if (equal cmd "*not-implemented*")
+       (message "Command %s is not implemented for this debugger")
+      ;; else
+      (progn
+       (realgud-command cmd arg no-record? frame-switch? realgud-prompts?)
+       ;; FIXME: Figure out how to update the position if the source
+       ;; buffer is displayed.
+       ;; (if frame-switch?
+       ;;      (let* ((src-buffer (realgud-get-srcbuf-from-cmdbuf cmdbuf))
+       ;;             (src-window (get-buffer-window src-buffer))
+       ;;             ))
+       ;;        (with-selected-window src-window
+       ;;          (message "recentering...")
+       ;;          (realgud-recenter-arrow)
+       ;;        ))
+       )
+      ;; FIXME: this is a one-time thing. Put in caller.
+      (if key
+         (local-set-key (format "\C-c%s" key)
+                        (intern (format "realgud:cmd-%s" cmd-name))))
+      )
+    ))
 
 (defun realgud:cmd-backtrace(arg)
   "Show the current call stack"
diff --git a/realgud/debugger/nodejs/core.el b/realgud/debugger/nodejs/core.el
index cc09972..1ff8b71 100644
--- a/realgud/debugger/nodejs/core.el
+++ b/realgud/debugger/nodejs/core.el
@@ -48,14 +48,13 @@
 
 ;;; FIXME: DRY this with other *-parse-cmd-args routines
 (defun nodejs-parse-cmd-args (orig-args)
-  "Parse command line ORIG-ARGS for the annotate level and name of script to 
debug.
+  "Parse command line ORIG-ARGS for the name of script to debug.
 
 ORIG-ARGS should contain a tokenized list of the command line to run.
 
 We return the a list containing
 * the name of the debugger given (e.g. nodejs) and its arguments - a list of 
strings
 * the script name and its arguments - list of strings
-* whether the annotate or emacs option was given ('-A', '--annotate' or 
'--emacs) - a boolean
 
 For example for the following input:
   (map 'list 'symbol-name
@@ -96,7 +95,7 @@ Note that path elements have been expanded via 
`expand-file-name'.
        ;; nodejs --nodejs-options script --script-options
        (setq debugger-name (file-name-sans-extension
                             (file-name-nondirectory (car args))))
-       (unless (string-match "^node\\(?:js\\|mon\\)$" debugger-name)
+       (unless (string-match "^node\\(?:js\\|mon\\)?$" debugger-name)
          (message
           "Expecting debugger name `%s' to be `node', `nodemon', or `nodejs'"
           debugger-name))
diff --git a/realgud/debugger/nodejs/init.el b/realgud/debugger/nodejs/init.el
index 204444f..9712b75 100644
--- a/realgud/debugger/nodejs/init.el
+++ b/realgud/debugger/nodejs/init.el
@@ -111,6 +111,8 @@ realgud-loc-pat struct")
        :line-group 3
        :char-offset-group 4))
 
+(defconst realgud:nodejs-debugger-name "nodejs" "Name of debugger")
+
 ;; ;; Regular expression that for a termination message.
 ;; (setf (gethash "termination" realgud:nodejs-pat-hash)
 ;;        "^nodejs: That's all, folks...\n")
@@ -137,14 +139,13 @@ realgud-loc-pat struct")
         (1 realgud-line-number-face))
        ))
 
-(setf (gethash "nodejs" realgud-pat-hash) realgud:nodejs-pat-hash)
+(setf (gethash realgud:nodejs-debugger-name realgud-pat-hash)
+      realgud:nodejs-pat-hash)
 
 (defvar realgud:nodejs-command-hash (make-hash-table :test 'equal)
   "Hash key is command name like 'finish' and the value is
   the nodejs command to use, like 'out'")
 
-(setf (gethash "nodejs" realgud-command-hash realgud:nodejs-command-hash))
-
 (setf (gethash "backtrace"  realgud:nodejs-command-hash) "T")
 (setf (gethash "break"      realgud:nodejs-command-hash)
       "setBreakpoint(%l)")
@@ -152,6 +153,7 @@ realgud-loc-pat struct")
 (setf (gethash "quit"       realgud:nodejs-command-hash) "quit")
 (setf (gethash "finish"     realgud:nodejs-command-hash) "out")
 (setf (gethash "shell"      realgud:nodejs-command-hash) "repl")
+(setf (gethash "eval"       realgud:nodejs-command-hash) "*not-implemented*")
 
 ;; We need aliases for step and next because the default would
 ;; do step 1 and nodejs doesn't handle this. And if it did,
diff --git a/realgud/debugger/trepanjs/core.el 
b/realgud/debugger/trepanjs/core.el
index 09482e3..3a4bfed 100644
--- a/realgud/debugger/trepanjs/core.el
+++ b/realgud/debugger/trepanjs/core.el
@@ -49,21 +49,20 @@
    opt-debugger))
 
 (defun realgud:trepanjs-parse-cmd-args (orig-args)
-  "Parse command line ARGS for the annotate level and name of script to debug.
+  "Parse command line ARGS for the name of script to debug.
 
 ORIG-ARGS should contain a tokenized list of the command line to run.
 
 We return the a list containing
 * the name of the debugger given (e.g. trepanjs) and its arguments - a list of 
strings
 * the script name and its arguments - list of strings
-* whether the annotate or emacs option was given ('-A', '--annotate' or 
'--emacs) - a boolean
 
 For example for the following input:
   (map 'list 'symbol-name
-   '(node --interactive --debugger-port 5858 /tmp trepanjs ./gcd.js a b))
+   '(trepanjs  --no-highlight --port 5858 /tmp trepanjs ./gcd.js a b))
 
 we might return:
-   ((\"node\" \"--interactive\" \"--debugger-port\" \"5858\") nil 
(\"/tmp/gcd.js\" \"a\" \"b\"))
+   ((\"trepanjs\" \"--no-highlight\" \"--port\" \"5858\") nil (\"/tmp/gcd.js\" 
\"a\" \"b\"))
 
 Note that path elements have been expanded via `expand-file-name'.
 "
@@ -73,7 +72,7 @@ Note that path elements have been expanded via 
`expand-file-name'.
   (let (
        (args orig-args)
        (pair)          ;; temp return from
-       (node-two-args '("-debugger_port" "C" "D" "i" "l" "m" "-module" "x"))
+       (node-two-args '("-port" "C" "D" "i" "l" "m" "-module" "x"))
        ;; node doesn't have any optional two-arg options
        (node-opt-two-args '())
 
@@ -97,7 +96,7 @@ Note that path elements have been expanded via 
`expand-file-name'.
        ;; trepanjs --trepanjs-options script --script-options
        (setq debugger-name (file-name-sans-extension
                             (file-name-nondirectory (car args))))
-       (unless (string-match "^node\\(?:js\\|mon\\)$" debugger-name)
+       (unless (string-match "^node\\(?:js\\|mon\\)?$" debugger-name)
          (message
           "Expecting debugger name `%s' to be `node', `nodemon', or `trepanjs'"
           debugger-name))



reply via email to

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