1 ;;; Copyright (C) 2014-2015 Rocky Bernstein <rocky@gnu.org>
2 ;; `nodejs' Main interface to nodejs debugger via Emacs
4 (require 'load-relative)
5 (require-relative-list '("../../common/helper") "realgud-")
6 (require-relative-list '("../../common/run") "realgud:")
7 (require-relative-list '("core" "track-mode") "realgud:nodejs-")
9 (declare-function realgud:nodejs-remove-ansi-shmutz 'realgud-core)
10 (declare-function realgud:run-debugger 'realgud:run)
12 ;; This is needed, or at least the docstring part of it is needed to
13 ;; get the customization menu to work in Emacs 24.
14 (defgroup realgud:nodejs nil
15 "The realgud interface to the nodejs debugger"
19 ;; -------------------------------------------------------------------
20 ;; User-definable variables
23 (defcustom realgud:nodejs-command-name
25 "File name for executing the Javascript debugger and command options.
26 This should be an executable on your path, or an absolute file name."
28 :group 'realgud:nodejs)
30 ;; -------------------------------------------------------------------
34 (declare-function nodejs-track-mode 'realgud-nodejs-track-mode)
35 (declare-function nodejs-query-cmdline 'realgud:nodejs-core)
36 (declare-function nodejs-parse-cmd-args 'realgud:nodejs-core)
37 (declare-function realgud:run-process 'realgud:run)
40 (defun realgud:nodejs (&optional opt-cmd-line no-reset)
41 "Invoke the nodejs shell debugger and start the Emacs user interface.
43 String OPT-CMD-LINE specifies how to run nodejs.
45 OPT-CMD-LINE is treated like a shell string; arguments are
46 tokenized by `split-string-and-unquote'. The tokenized string is
47 parsed by `nodejs-parse-cmd-args' and path elements found by that
48 are expanded using `realgud:expand-file-name-if-exists'.
50 Normally, command buffers are reused when the same debugger is
51 reinvoked inside a command buffer with a similar command. If we
52 discover that the buffer has prior command-buffer information and
53 NO-RESET is nil, then that information which may point into other
54 buffers and source buffers which may contain marks and fringe or
55 marginal icons is reset. See `loc-changes-clear-buffer' to clear
56 fringe and marginal icons.
60 (realgud:run-debugger "nodejs"
61 'nodejs-query-cmdline 'nodejs-parse-cmd-args
62 'realgud:nodejs-minibuffer-history
63 opt-cmd-line no-reset)))
65 (with-current-buffer cmd-buf
66 ;; FIXME should allow customization whether to do or not
67 ;; and also only do if hook is not already there.
68 (realgud:nodejs-remove-ansi-shmutz)
72 ;; There is already a nodejs command in `nodejs-repl'.
73 ;; (defalias 'nodejs 'realgud:nodejs)
75 (provide-me "realgud-")