diff options
| author | rocky <rocky@gnu.org> | 2019-05-18 07:21:05 -0400 |
|---|---|---|
| committer | rocky <rocky@gnu.org> | 2019-05-18 07:21:05 -0400 |
| commit | e83e6d8f5a0018cba136b7a9ea845a25049caa09 (patch) | |
| tree | 20debb2f787876e995a75e3f0ab31734b05d9d68 | |
| parent | e9590727c981caf424b8736448a29f4111d3e8c1 (diff) | |
Start node-debug from node-inspect
| -rw-r--r-- | Makefile.am | 2 | ||||
| -rw-r--r-- | README.md | 10 | ||||
| -rw-r--r-- | common.mk | 2 | ||||
| -rwxr-xr-x | compute-lispdir.sh | 4 | ||||
| -rw-r--r-- | configure.ac | 6 | ||||
| -rw-r--r-- | realgud-node-debug.el (renamed from realgud-node-inspect.el) | 25 | ||||
| -rw-r--r-- | realgud-node-debug/.nosearch (renamed from node-inspect/.nosearch) | 0 | ||||
| -rw-r--r-- | realgud-node-debug/Makefile.am (renamed from node-inspect/Makefile.am) | 0 | ||||
| -rw-r--r-- | realgud-node-debug/core.el (renamed from node-inspect/core.el) | 81 | ||||
| -rw-r--r-- | realgud-node-debug/init.el (renamed from node-inspect/init.el) | 106 | ||||
| -rw-r--r-- | realgud-node-debug/main.el (renamed from node-inspect/main.el) | 47 | ||||
| -rw-r--r-- | realgud-node-debug/track-mode.el (renamed from node-inspect/track-mode.el) | 54 | ||||
| -rw-r--r-- | test/test-loc-regexp-node-debug.el (renamed from test/test-loc-regexp-node-inspect.el) | 2 | ||||
| -rw-r--r-- | test/test-node-debug.el (renamed from test/test-node-inspect.el) | 8 |
14 files changed, 179 insertions, 168 deletions
diff --git a/Makefile.am b/Makefile.am index 66d3f8b..c1e36b4 100644 --- a/Makefile.am +++ b/Makefile.am @@ -2,7 +2,7 @@ # These comments before the targets start with #: # remake --tasks to shows the targets and the comments -SUBDIRS = node-inspect test +SUBDIRS = realgud-node-debug test GIT2CL ?= git2cl RUBY ?= ruby @@ -1,6 +1,6 @@ -Module to add [node inspect](https://nodejs.org/api/debugger.html)'s [V8-inspector-protocol](https://chromedevtools.github.io/devtools-protocol/v8/Debugger) -debugger support to emacs -[realgud](http://github.com/realgud/realgud). +Module to add the older [node +debug]( https://nodejs.org/dist/latest-v6.x/docs/api/debugger.html) debugger support to emacs +[realgud](http://github.com/realgud/realgud). This protocol was used up until version 6.3 and +deprecated in node version 8. -For node before version 6.3, an older protocol is used. In realgud, -that debugger for the older version is called node-debug. +For node before after 6.3, use [realgud-node-inspect]. (http://github.com/realgud/realgud-node-inspect). @@ -1,5 +1,5 @@ MOSTLYCLEANFILES = *.elc -EMACSLOADPATH=:/home/rocky/.emacs.d/elpa/test-simple-20170527.832/:/home/rocky/.emacs.d/elpa/realgud-20180207.1330/ +EMACSLOADPATH=:/home/rocky/.emacs.d/elpa/test-simple-20170527.1532/:/home/rocky/.emacs.d/elpa/realgud-20190504.1238/:/home/rocky/.emacs.d/elpa/load-relative-20170526.1010/:/home/rocky/.emacs.d/elpa/loc-changes-20160801.1708/ short: $(MAKE) 2>&1 >/dev/null | ruby $(top_srcdir)/make-check-filter.rb diff --git a/compute-lispdir.sh b/compute-lispdir.sh index 220befd..c46a66a 100755 --- a/compute-lispdir.sh +++ b/compute-lispdir.sh @@ -24,7 +24,7 @@ done for dir in $list ; do if [[ -d $dir ]] ; then case $dir in - */emacs/2[34]\.[0-9]/site-lisp) + */emacs/2[3-6]\.[0-9]/site-lisp) ((DEBUG)) && echo "versioned site lisp: $dir" echo "$dir" exit 0 @@ -35,7 +35,7 @@ done for dir in $list ; do if [[ -d $dir ]] ; then case $dir in - */emacs/2[34]\.[0-9]/site-lisp) + */emacs/2[3-6]\.[0-9]/site-lisp) ((DEBUG)) && echo "versioned site lisp: $dir" echo "$dir" exit 0 diff --git a/configure.ac b/configure.ac index 6d5d73d..457fce0 100644 --- a/configure.ac +++ b/configure.ac @@ -1,6 +1,6 @@ dnl FIXME: pick up from realgud.el -AC_INIT(realgud-inspect, 1.0,) -AC_CONFIG_SRCDIR(node-inspect/main.el) +AC_INIT(realgud-node-debug, 1.0.0,) +AC_CONFIG_SRCDIR(realgud-node-debug/main.el) AM_INIT_AUTOMAKE([foreign]) AM_MAINTAINER_MODE @@ -49,7 +49,7 @@ AM_CONDITIONAL(INSTALL_EMACS_LISP, test "x$lispdir_realgud" != "x") AC_CONFIG_FILES([Makefile \ common.mk \ - node-inspect/Makefile \ + realgud-node-debug/Makefile \ test/Makefile \ ]) AC_OUTPUT diff --git a/realgud-node-inspect.el b/realgud-node-debug.el index bd7f39f..dd411c6 100644 --- a/realgud-node-inspect.el +++ b/realgud-node-debug.el @@ -1,13 +1,13 @@ -;;; realgud-node-inspect.el --- realgud front-end to newer "node inspect" +;;; realgud-node-debug.el --- realgud front-end to older nodejs "node debug" ;; Author: Rocky Bernstein -;; Version: 1.0 +;; Version: 1.0.0 ;; Package-Type: multi -;; Package-Requires: ((realgud "1.4.3") (cl-lib "0.5") (emacs "24")) -;; URL: http://github.com/realgud/realgud-node-inspect +;; Package-Requires: ((realgud "1.4.5") (load-relative "1.2") (cl-lib "0.5") (emacs "24")) +;; URL: http://github.com/realgud/realgud-node-debug ;; Compatibility: GNU Emacs 24.x -;; Copyright (C) 2015, 2016, 2018 Rocky Bernstein <rocky@gnu.org> +;; Copyright (C) 2019 Rocky Bernstein <rocky@gnu.org> ;; 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 @@ -24,8 +24,9 @@ ;;; Commentary: -;; realgud support for the "node inspect" with V8 inspector support. -;; See https://nodejs.org/api/debugger.html +;; realgud support for the older "node debug" used up into node +;; version 6 and deprecated starting with node version 8. +;; https://nodejs.org/dist/latest-v6.x/docs/api/ ;; ;;; Code: @@ -35,14 +36,14 @@ (require 'load-relative) -(defgroup realgud-node-inspector nil - "Realgud interface to the 'node inspect' debugger" +(defgroup realgud-node-debugor nil + "Realgud interface to the older 'node debug' debugger" :group 'realgud :version "24.3") -(require-relative-list '( "./node-inspect/main" ) "realgud-") -(load-relative "./node-inspect/main.el") +(require-relative-list '( "./realgud-node-debug/main" ) "realgud-") +(load-relative "./realgud-node-debug/main.el") (provide-me) -;;; realgud-node-inspect.el ends here +;;; realgud-node-debug.el ends here diff --git a/node-inspect/.nosearch b/realgud-node-debug/.nosearch index 97f36a7..97f36a7 100644 --- a/node-inspect/.nosearch +++ b/realgud-node-debug/.nosearch diff --git a/node-inspect/Makefile.am b/realgud-node-debug/Makefile.am index aa624b8..aa624b8 100644 --- a/node-inspect/Makefile.am +++ b/realgud-node-debug/Makefile.am diff --git a/node-inspect/core.el b/realgud-node-debug/core.el index b3a13f1..9f07202 100644 --- a/node-inspect/core.el +++ b/realgud-node-debug/core.el @@ -1,4 +1,4 @@ -;;; Copyright (C) 2015-2018 Rocky Bernstein <rocky@gnu.org> +;;; Copyright (C) 2015-2019 Rocky Bernstein <rocky@gnu.org> ;; 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 @@ -30,45 +30,46 @@ ;; FIXME: I think the following could be generalized and moved to ;; realgud-... probably via a macro. -(defvar realgud:node-inspect-minibuffer-history nil - "minibuffer history list for the command `node-inspect'.") +(defvar realgud:node-debug-minibuffer-history nil + "Minibuffer history list for the command `node-debug'.") -(easy-mmode-defmap realgud:node-inspect-minibuffer-local-map +(easy-mmode-defmap realgud:node-debug-minibuffer-local-map '(("\C-i" . comint-dynamic-complete-filename)) - "Keymap for minibuffer prompting of node-inspect startup command." + "Keymap for minibuffer prompting of node-debug startup command." :inherit minibuffer-local-map) ;; FIXME: I think this code and the keymaps and history ;; variable chould be generalized, perhaps via a macro. -(defun node-inspect-query-cmdline (&optional opt-debugger) +(defun node-debug-query-cmdline (&optional opt-debugger) (realgud-query-cmdline - 'realgud:node-inspect-suggest-invocation - realgud:node-inspect-minibuffer-local-map - 'realgud:node-inspect-minibuffer-history + 'realgud:node-debug-suggest-invocation + realgud:node-debug-minibuffer-local-map + 'realgud:node-debug-minibuffer-history opt-debugger)) ;;; FIXME: DRY this with other *-parse-cmd-args routines -(defun node-inspect-parse-cmd-args (orig-args) +(defun node-debug-parse-cmd-args (orig-args) "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. node-inspect) and its arguments - a list of strings +* the name of the debugger given (e.g. node-debug) and its arguments , + a list of strings * the script name and its arguments - list of strings For example for the following input: (map 'list 'symbol-name - '(node --interactive --debugger-port 5858 /tmp node-inspect ./gcd.js a b)) + '(node --interactive --debugger-port 5858 /tmp node-debug ./gcd.js a b)) we might return: - ((\"node\" \"--interactive\" \"--debugger-port\" \"5858\") nil (\"/tmp/gcd.js\" \"a\" \"b\")) + ((\"node\" \"--interactive\" \"--debugger-port\" \"5858\") nil + (\"/tmp/gcd.js\" \"a\" \"b\")) -Note that path elements have been expanded via `expand-file-name'. -" +Note that path elements have been expanded via `expand-file-name'." ;; Parse the following kind of pattern: - ;; node node-inspect-options script-name script-options + ;; node node-debug-options script-name script-options (let ( (args orig-args) (pair) ;; temp return from @@ -78,8 +79,8 @@ Note that path elements have been expanded via `expand-file-name'. ;; One dash is added automatically to the below, so ;; h is really -h and -debugger_port is really --debugger_port. - (node-inspect-two-args '("-debugger_port")) - (node-inspect-opt-two-args '()) + (node-debug-two-args '("-debugger_port")) + (node-debug-opt-two-args '()) ;; Things returned (script-name nil) @@ -92,13 +93,13 @@ Note that path elements have been expanded via `expand-file-name'. (list interpreter-args nil script-args) ;; else (progn - ;; Remove "node-inspect" (or "nodemon" or "node") from invocation like: - ;; node-inspect --node-inspect-options script --script-options + ;; Remove "node-debug" (or "nodemon" or "node") from invocation like: + ;; node-debug --node-debug-options script --script-options (setq debugger-name (file-name-sans-extension (file-name-nondirectory (car args)))) (unless (string-match "^node\\(?:js\\|mon\\)?$" debugger-name) (message - "Expecting debugger name `%s' to be `node', `nodemon', or `node-inspect'" + "Expecting debugger name `%s' to be `node', `nodemon', or `node-debug'" debugger-name)) (setq interpreter-args (list (pop args))) @@ -114,7 +115,7 @@ Note that path elements have been expanded via `expand-file-name'. ;; Options with arguments. ((string-match "^-" arg) (setq pair (realgud-parse-command-arg - args node-inspect-two-args node-inspect-opt-two-args)) + args node-debug-two-args node-debug-opt-two-args)) (nconc interpreter-args (car pair)) (setq args (cadr pair))) ;; Anything else must be the script to debug. @@ -125,45 +126,45 @@ Note that path elements have been expanded via `expand-file-name'. )) ;; To silence Warning: reference to free variable -(defvar realgud:node-inspect-command-name) +(defvar realgud:node-debug-command-name) -(defun realgud:node-inspect-suggest-invocation (debugger-name) - "Suggest a node-inspect command invocation via `realgud-suggest-invocaton'" - (realgud-suggest-invocation realgud:node-inspect-command-name - realgud:node-inspect-minibuffer-history +(defun realgud:node-debug-suggest-invocation (debugger-name) + "Suggest a node-debug command invocation via `realgud-suggest-invocaton'." + (realgud-suggest-invocation realgud:node-debug-command-name + realgud:node-debug-minibuffer-history "js" "\\.js$")) -(defun realgud:node-inspect-remove-ansi-shmutz() +(defun realgud:node-debug-remove-ansi-shmutz() "Remove ASCII escape sequences that node.js 'decorates' in -prompts and interactive output with" +prompts and interactive output." (add-to-list 'comint-preoutput-filter-functions (lambda (output) (replace-regexp-in-string "\033\\[[0-9]+[GKJ]" "" output))) ) -(defun realgud:node-inspect-reset () - "Node-Inspect cleanup - remove debugger's internal buffers (frame, +(defun realgud:node-debug-reset () + "Node-Debug cleanup - remove debugger's internal buffers (frame, breakpoints, etc.)." (interactive) - ;; (node-inspect-breakpoint-remove-all-icons) + ;; (node-debug-breakpoint-remove-all-icons) (dolist (buffer (buffer-list)) - (when (string-match "\\*node-inspect-[a-z]+\\*" (buffer-name buffer)) + (when (string-match "\\*node-debug-[a-z]+\\*" (buffer-name buffer)) (let ((w (get-buffer-window buffer))) (when w (delete-window w))) (kill-buffer buffer)))) -;; (defun node-inspect-reset-keymaps() +;; (defun node-debug-reset-keymaps() ;; "This unbinds the special debugger keys of the source buffers." ;; (interactive) -;; (setcdr (assq 'node-inspect-debugger-support-minor-mode minor-mode-map-alist) -;; node-inspect-debugger-support-minor-mode-map-when-deactive)) +;; (setcdr (assq 'node-debug-debugger-support-minor-mode minor-mode-map-alist) +;; node-debug-debugger-support-minor-mode-map-when-deactive)) -(defun realgud:node-inspect-customize () - "Use `customize' to edit the settings of the `node-inspect' debugger." +(defun realgud:node-debug-customize () + "Use `customize' to edit the settings of the `node-debug' debugger." (interactive) - (customize-group 'realgud:node-inspect)) + (customize-group 'realgud:node-debug)) -(provide-me "realgud:node-inspect-") +(provide-me "realgud:node-debug-") diff --git a/node-inspect/init.el b/realgud-node-debug/init.el index 0120e52..6d0a775 100644 --- a/node-inspect/init.el +++ b/realgud-node-debug/init.el @@ -1,4 +1,4 @@ -;; Copyright (C) 2015-2016, 2018 Rocky Bernstein <rocky@gnu.org> +;; Copyright (C) 2019 Rocky Bernstein <rocky@gnu.org> ;; 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 @@ -13,7 +13,13 @@ ;; You should have received a copy of the GNU General Public License ;; along with this program. If not, see <http://www.gnu.org/licenses/>. -;;; "node inspect" debugger +;;; "node debug" debugger + +;;; Note: this protocol is was in use up until node version 6 and +;;; became became deprecated with node version 8. The newer protocol +;;; is in realgud-node-inspect +;;; +;;; Regular expressions for nodejs Javascript debugger with "node debug" protocol. (eval-when-compile (require 'cl-lib)) ;For setf. @@ -21,10 +27,10 @@ (require 'realgud-lang-js) (require 'ansi-color) -(defvar realgud:node-inspect-pat-hash) +(defvar realgud:node-debug-pat-hash) (declare-function make-realgud-loc-pat (realgud-loc)) -(defvar realgud:node-inspect-pat-hash (make-hash-table :test 'equal) +(defvar realgud:node-debug-pat-hash (make-hash-table :test 'equal) "Hash key is the what kind of pattern we want to match: backtrace, prompt, etc. The values of a hash entry is a realgud-loc-pat struct") @@ -32,7 +38,7 @@ realgud-loc-pat struct") ;; before a command prompt. ;; For example: ;; break in /home/indutny/Code/git/indutny/myscript.js:1 -(setf (gethash "loc" realgud:node-inspect-pat-hash) +(setf (gethash "loc" realgud:node-debug-pat-hash) (make-realgud-loc-pat :regexp (format "\\(?:%s\\)*\\(?:break\\|exception\\) in %s:%s" @@ -41,10 +47,10 @@ realgud-loc-pat struct") :file-group 1 :line-group 2)) -;; Regular expression that describes a node-inspect command prompt +;; Regular expression that describes a node-debug command prompt ;; For example: ;; debug> -(setf (gethash "prompt" realgud:node-inspect-pat-hash) +(setf (gethash "prompt" realgud:node-debug-pat-hash) (make-realgud-loc-pat :regexp (format "^\\(?:%s\\)*debug> " realgud:js-term-escape) )) @@ -55,7 +61,7 @@ realgud-loc-pat struct") ;; ;; * 4 const client = new armlet.Client( ;; ;; ^^^^ ;; ;; -;; (setf (gethash "brkpt-set" realgud:node-inspect-pat-hash) +;; (setf (gethash "brkpt-set" realgud:node-debug-pat-hash) ;; (make-realgud-loc-pat ;; :regexp "^\*[ ]*\\([0-9]+\\) \\(.+\\)" ;; :line-group 1 @@ -66,26 +72,26 @@ realgud-loc-pat struct") ;; at repl:1:7 ;; at Interface.controlEval (/src/external-vcs/github/trepanjs/lib/interface.js:352:18) ;; at REPLServer.b [as eval] (domain.js:183:18) -(setf (gethash "lang-backtrace" realgud:node-inspect-pat-hash) +(setf (gethash "lang-backtrace" realgud:node-debug-pat-hash) realgud:js-backtrace-loc-pat) ;; Regular expression that describes a debugger "delete" (breakpoint) ;; response. ;; For example: ;; Removed 1 breakpoint(s). -(setf (gethash "brkpt-del" realgud:node-inspect-pat-hash) +(setf (gethash "brkpt-del" realgud:node-debug-pat-hash) (make-realgud-loc-pat :regexp (format "^Removed %s breakpoint(s).\n" realgud:regexp-captured-num) :num 1)) -(defconst realgud:node-inspect-frame-start-regexp "\\(?:^\\|\n\\)\\(?:#\\)") -(defconst realgud:node-inspect-frame-num-regexp realgud:regexp-captured-num) -(defconst realgud:node-inspect-frame-module-regexp "[^ \t\n]+") -(defconst realgud:node-inspect-frame-file-regexp "[^ \t\n]+") +(defconst realgud:node-debug-frame-start-regexp "\\(?:^\\|\n\\)\\(?:#\\)") +(defconst realgud:node-debug-frame-num-regexp realgud:regexp-captured-num) +(defconst realgud:node-debug-frame-module-regexp "[^ \t\n]+") +(defconst realgud:node-debug-frame-file-regexp "[^ \t\n]+") -;; Regular expression that describes a node-inspect location generally shown +;; Regular expression that describes a node-debug location generally shown ;; Regular expression that describes a debugger "backtrace" command line. ;; For example: ;; #0 module.js:380:17 @@ -96,12 +102,12 @@ realgud-loc-pat struct") ;; #5 Module._load module.js:312:12 ;; #6 Module.runMain module.js:497:10 ; ;#7 timers.js:110:15 -(setf (gethash "debugger-backtrace" realgud:node-inspect-pat-hash) +(setf (gethash "debugger-backtrace" realgud:node-debug-pat-hash) (make-realgud-loc-pat - :regexp (concat realgud:node-inspect-frame-start-regexp - realgud:node-inspect-frame-num-regexp " " - "\\(?:" realgud:node-inspect-frame-module-regexp " \\)?" - "\\(" realgud:node-inspect-frame-file-regexp "\\)" + :regexp (concat realgud:node-debug-frame-start-regexp + realgud:node-debug-frame-num-regexp " " + "\\(?:" realgud:node-debug-frame-module-regexp " \\)?" + "\\(" realgud:node-debug-frame-file-regexp "\\)" ":" realgud:regexp-captured-num ":" @@ -112,13 +118,13 @@ realgud-loc-pat struct") :line-group 3 :char-offset-group 4)) -(defconst realgud:node-inspect-debugger-name "node-inspect" "Name of debugger") +(defconst realgud:node-debug-debugger-name "node-debug" "Name of debugger.") ;; ;; Regular expression that for a termination message. -;; (setf (gethash "termination" realgud:node-inspect-pat-hash) -;; "^node-inspect: That's all, folks...\n") +;; (setf (gethash "termination" realgud:node-debug-pat-hash) +;; "^node-debug: That's all, folks...\n") -(setf (gethash "font-lock-keywords" realgud:node-inspect-pat-hash) +(setf (gethash "font-lock-keywords" realgud:node-debug-pat-hash) '( ;; The frame number and first type name, if present. ;; E.g. ->0 in file `/etc/init.d/apparmor' at line 35 @@ -140,46 +146,46 @@ realgud-loc-pat struct") (1 realgud-line-number-face)) )) -(setf (gethash "node-inspect" realgud-pat-hash) - realgud:node-inspect-pat-hash) +(setf (gethash "node-debug" realgud-pat-hash) + realgud:node-debug-pat-hash) ;; Prefix used in variable names (e.g. short-key-mode-map) for ;; this debugger -(setf (gethash "node-inspect" realgud:variable-basename-hash) - "realgud:node-inspect") +(setf (gethash "node-debug" realgud:variable-basename-hash) + "realgud:node-debug") -(defvar realgud:node-inspect-command-hash (make-hash-table :test 'equal) +(defvar realgud:node-debug-command-hash (make-hash-table :test 'equal) "Hash key is command name like 'finish' and the value is - the node-inspect command to use, like 'out'") +the node-debug command to use, like 'out'.") -(setf (gethash realgud:node-inspect-debugger-name +(setf (gethash realgud:node-debug-debugger-name realgud-command-hash) - realgud:node-inspect-command-hash) + realgud:node-debug-command-hash) -(setf (gethash "backtrace" realgud:node-inspect-command-hash) "backtrace") -(setf (gethash "break" realgud:node-inspect-command-hash) +(setf (gethash "backtrace" realgud:node-debug-command-hash) "backtrace") +(setf (gethash "break" realgud:node-debug-command-hash) "setBreakpoint('%X',%l)") -(setf (gethash "continue" realgud:node-inspect-command-hash) "cont") -(setf (gethash "kill" realgud:node-inspect-command-hash) "kill") -(setf (gethash "quit" realgud:node-inspect-command-hash) "") -(setf (gethash "finish" realgud:node-inspect-command-hash) "out") -(setf (gethash "shell" realgud:node-inspect-command-hash) "repl") -(setf (gethash "eval" realgud:node-inspect-command-hash) "exec('%s')") +(setf (gethash "continue" realgud:node-debug-command-hash) "cont") +(setf (gethash "kill" realgud:node-debug-command-hash) "kill") +(setf (gethash "quit" realgud:node-debug-command-hash) "") +(setf (gethash "finish" realgud:node-debug-command-hash) "out") +(setf (gethash "shell" realgud:node-debug-command-hash) "repl") +(setf (gethash "eval" realgud:node-debug-command-hash) "exec('%s')") ;; We need aliases for step and next because the default would -;; do step 1 and node-inspect doesn't handle this. And if it did, +;; do step 1 and node-debug doesn't handle this. And if it did, ;; it would probably look like step(1). -(setf (gethash "step" realgud:node-inspect-command-hash) "step") -(setf (gethash "next" realgud:node-inspect-command-hash) "next") +(setf (gethash "step" realgud:node-debug-command-hash) "step") +(setf (gethash "next" realgud:node-debug-command-hash) "next") ;; Unsupported features: -(setf (gethash "jump" realgud:node-inspect-command-hash) "*not-implemented*") -(setf (gethash "up" realgud:node-inspect-command-hash) "*not-implemented*") -(setf (gethash "down" realgud:node-inspect-command-hash) "*not-implemented*") -(setf (gethash "frame" realgud:node-inspect-command-hash) "*not-implemented*") +(setf (gethash "jump" realgud:node-debug-command-hash) "*not-implemented*") +(setf (gethash "up" realgud:node-debug-command-hash) "*not-implemented*") +(setf (gethash "down" realgud:node-debug-command-hash) "*not-implemented*") +(setf (gethash "frame" realgud:node-debug-command-hash) "*not-implemented*") -(setf (gethash "node-inspect" realgud-command-hash) realgud:node-inspect-command-hash) -(setf (gethash "node-inspect" realgud-pat-hash) realgud:node-inspect-pat-hash) +(setf (gethash "node-debug" realgud-command-hash) realgud:node-debug-command-hash) +(setf (gethash "node-debug" realgud-pat-hash) realgud:node-debug-pat-hash) -(provide-me "realgud:node-inspect-") +(provide-me "realgud:node-debug-") diff --git a/node-inspect/main.el b/realgud-node-debug/main.el index d62bd24..4d1963b 100644 --- a/node-inspect/main.el +++ b/realgud-node-debug/main.el @@ -1,4 +1,4 @@ -;; Copyright (C) 2016, 2018 Rocky Bernstein +;; Copyright (C) 2019 Rocky Bernstein ;; 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 @@ -13,17 +13,17 @@ ;; You should have received a copy of the GNU General Public License ;; along with this program. If not, see <http://www.gnu.org/licenses/>. -;; `realgud:node-inspect' Main interface to "node inspect" debugger via Emacs +;; `realgud:node-debug' Main interface to older "node debugb" debugger via Emacs (require 'cl-lib) (require 'load-relative) (require 'realgud) -(require-relative-list '("core" "track-mode") "realgud:node-inspect-") +(require-relative-list '("core" "track-mode") "realgud:node-debug-") ;; This is needed, or at least the docstring part of it is needed to ;; get the customization menu to work in Emacs 24. -(defgroup realgud:node-inspect nil - "The realgud interface to the node-inspect debugger" +(defgroup realgud:node-debug nil + "The realgud interface to the node-debug debugger" :group 'realgud :version "24.3") @@ -31,45 +31,44 @@ ;; User-definable variables ;; -(defcustom realgud:node-inspect-command-name - "node inspect" +(defcustom realgud:node-debug-command-name + "node debug" "File name for executing the Javascript debugger and command options. This should be an executable on your path, or an absolute file name." :type 'string - :group 'realgud:node-inspect) + :group 'realgud:node-debug) ;; ------------------------------------------------------------------- ;; The end. ;; -(declare-function node-inspect-track-mode 'realgud-node-inspect-track-mode) -(declare-function node-inspect-query-cmdline 'realgud:node-inspect-core) -(declare-function node-inspect-parse-cmd-args 'realgud:node-inspect-core) +(declare-function node-debug-track-mode 'realgud-node-debug-track-mode) +(declare-function node-debug-query-cmdline 'realgud:node-debug-core) +(declare-function node-debug-parse-cmd-args 'realgud:node-debug-core) ;;;###autoload -(defun realgud:node-inspect (&optional opt-cmd-line no-reset) - "Invoke the node-inspect shell debugger and start the Emacs user interface. +(defun realgud:node-debug (&optional opt-cmd-line no-reset) + "Invoke the node-debug shell debugger and start the Emacs user interface. -String OPT-CMD-LINE specifies how to run node-inspect. +String OPT-CMD-LINE specifies how to run node-debug. OPT-CMD-LINE is treated like a shell string; arguments are -tokenized by `split-string-and-unquote'. The tokenized string is -parsed by `node-inspect-parse-cmd-args' and path elements found by that +tokenized by `split-string-and-unquote'. The tokenized string is +parsed by `node-debug-parse-cmd-args' and path elements found by that are expanded using `realgud:expand-file-name-if-exists'. Normally, command buffers are reused when the same debugger is -reinvoked inside a command buffer with a similar command. If we +reinvoked inside a command buffer with a similar command. If we discover that the buffer has prior command-buffer information and NO-RESET is nil, then that information which may point into other buffers and source buffers which may contain marks and fringe or -marginal icons is reset. See `loc-changes-clear-buffer' to clear -fringe and marginal icons. -" +marginal icons is reset. See `loc-changes-clear-buffer' to clear +fringe and marginal icons." (interactive) (let ((cmd-buf - (realgud:run-debugger "node-inspect" - 'node-inspect-query-cmdline 'node-inspect-parse-cmd-args - 'realgud:node-inspect-minibuffer-history + (realgud:run-debugger "node-debug" + 'node-debug-query-cmdline 'node-debug-parse-cmd-args + 'realgud:node-debug-minibuffer-history opt-cmd-line no-reset))) ;; (if cmd-buf ;; (with-current-buffer cmd-buf @@ -80,6 +79,6 @@ fringe and marginal icons. ;; ) )) -(defalias 'node-inspect 'realgud:node-inspect) +(defalias 'node-debug 'realgud:node-debug) (provide-me "realgud-") diff --git a/node-inspect/track-mode.el b/realgud-node-debug/track-mode.el index 8bd54ee..708cfee 100644 --- a/node-inspect/track-mode.el +++ b/realgud-node-debug/track-mode.el @@ -14,7 +14,7 @@ ;; You should have received a copy of the GNU General Public License ;; along with this program. If not, see <http://www.gnu.org/licenses/>. -;; "node inspect" tracking a comint or eshell buffer. +;; "node debug" tracking a comint or eshell buffer. (declare-function realgud:track-set-debugger 'realgud-track-mode) (declare-function realgud-track-mode-setup 'realgud-track-mode) @@ -22,58 +22,62 @@ (require 'realgud) -(require-relative-list '("core" "init") "realgud:node-inspect-") +(require-relative-list '("core" "init") "realgud:node-debug-") -(defun realgud:node-inspect-track-mode-hook() - (if realgud:node-inspect-track-mode +(realgud-track-mode-vars "realgud:node-debug") + +(defun realgud:node-debug-track-mode-hook() + (if realgud:node-debug-track-mode (progn - (use-local-map realgud:node-inspect-track-mode-map) + (use-local-map realgud:node-debug-track-mode-map) (realgud:remove-ansi-schmutz) - (message "using node-inspect mode map") + (message "using node-debug mode map") ) - (message "node-inspect track-mode-hook disable called")) + (message "node-debug track-mode-hook disable called")) ) ;; FIXME: this shouldn't be needed -(defvar realgud:node-inspect-track-mode-map (make-keymap)) +(defvar realgud:node-debug-track-mode-map (make-keymap)) +(define-key realgud:node-debug-track-mode-map + (kbd "C-c !f") 'realgud:js-goto-file-line) -(define-minor-mode realgud:node-inspect-track-mode - "Minor mode for tracking node-inspect source locations inside a node-inspect shell via realgud. +(define-minor-mode realgud:node-debug-track-mode + "Minor mode for tracking node-debug source locations inside a node-debug shell via realgud. If called interactively with no prefix argument, the mode is toggled. A prefix argument, captured as ARG, enables the mode if the argument is positive, and disables it otherwise. -\\{realgud:node-inspect-track-mode-map}" +\\{realgud:node-debug-track-mode-map}" :init-value nil - ;; :lighter " node-inspect" ;; mode-line indicator from realgud-track is sufficient. + ;; :lighter " node-debug" ;; mode-line indicator from realgud-track is sufficient. ;; The minor mode bindings. :global nil - :group 'realgud:node-inspect - :keymap realgud:node-inspect-track-mode-map + :group 'realgud:node-debug + :keymap realgud:node-debug-track-mode-map - (if realgud:node-inspect-track-mode + (if realgud:node-debug-track-mode (progn - (realgud:track-set-debugger "node-inspect") - (realgud:node-inspect-track-mode-hook) + (realgud:track-set-debugger "node-debug") + (realgud:node-debug-track-mode-hook) (realgud:track-mode-enable)) (progn (setq realgud-track-mode nil) )) ) -;; ;; Debugger commands that node-inspect doesn't have -;; (define-key node-inspect-track-mode-map +;; ;; Debugger commands that node-debug doesn't have +;; (define-key node-debug-track-mode-map ;; [remap realgud:cmd-newer-frame] 'undefined) -;; (define-key node-inspect-track-mode-map +;; (define-key node-debug-track-mode-map ;; [remap realgud:cmd-older-frame] 'undefined) -(defvar realgud:node-inspect-short-key-mode-map (make-keymap)) +(defvar realgud:node-debug-short-key-mode-map (make-keymap)) -(define-key realgud:node-inspect-short-key-mode-map +(define-key realgud:node-debug-short-key-mode-map [remap realgud:cmd-step] 'realgud:cmd-step-no-arg) -(define-key realgud:node-inspect-short-key-mode-map +(define-key realgud:node-debug-short-key-mode-map [remap realgud:cmd-step] 'realgud:cmd-step-no-arg) -(define-key realgud:node-inspect-short-key-mode-map +(define-key realgud:node-debug-short-key-mode-map [remap realgud:cmd-next] 'realgud:cmd-next-no-arg) -(provide-me "realgud:node-inspect-") +(provide-me "realgud:node-debug-") diff --git a/test/test-loc-regexp-node-inspect.el b/test/test-loc-regexp-node-debug.el index 58be563..538fe29 100644 --- a/test/test-loc-regexp-node-inspect.el +++ b/test/test-loc-regexp-node-debug.el @@ -6,7 +6,7 @@ (require 'realgud) (load-file "./regexp-helper.el") -(load-file "../node-inspect/init.el") +(load-file "../realgud-node-debug/init.el") (declare-function realgud-cmdbuf-info-loc-regexp 'realgud-buffer-command) (declare-function cmdbuf-loc-match 'realgud-regexp-helper) diff --git a/test/test-node-inspect.el b/test/test-node-debug.el index 659b9ad..7762de6 100644 --- a/test/test-node-inspect.el +++ b/test/test-node-debug.el @@ -2,7 +2,7 @@ ;; (test-simple-run "emacs -batch -L %s -l %s" (file-name-directory (locate-library "test-simple.elc")) buffer-file-name) (require 'test-simple) -(load-file "../node-inspect/main.el") +(load-file "../realgud-node-debug/main.el") (eval-when-compile (defvar test:run-process-save)) @@ -25,11 +25,11 @@ )) (note "nodejs-parse-cmd-args") -(assert-equal (list '("node" "inspect") nil '("foo")) - (nodejs-parse-cmd-args '("node" "inspect" "foo"))) +(assert-equal (list '("node" "debug") nil '("foo")) + (nodejs-parse-cmd-args '("node" "debug" "foo"))) ;; FIXME: need to mock remove-ansi-schmutz in realgud:nodejs -;; (realgud:nodejs "node inspect ./gcd.js 3 5") +;; (realgud:nodejs "node debug ./gcd.js 3 5") ;; Restore the old value of realgud:run-process (fset 'realgud:run-process test:run-process-save) |
