I am wondering if it is possible to debug/execute a Ocaml program step by step, for instance like debugging C++ programs in Visual Studio. In other words, I would like to run a Ocaml program line by line, also it would be great if we could "watch" the value of some variables.
By the way, I am using Emacs as editor.
Could anyone help? Thank you very much
Edit-1: As sepp2k suggested, I am trying to run camldebug under Emacs. I have a problem in the beginning: the web page mentions "The Caml debugger is started under Emacs by the command M-x camldebug, with argument the name of the executable file progname to debug." Actually I have only 3 choices:
M-x camldebug
M-x camldebug-mode
M-x camldebug-step
Edit-2: When I type M-x camldebug, enter, it shows Symbol's value as variable is void: caml-mode-map which does not allow me to enter the executable file.
Could anyone help? Thank you!
You can step through the code using the debugger ocamldebug, which can be run in emacs.
The documentation is telling you to supply the executable file's name to camldebug. You can do this by M-x camldebug, then press enter, and then type in the path of the executable when emacs prompts you for it.
Related
I have a basic question on lldb in Xcode.
When using lldb in Xcode, how you guys call the command previously executed ?
Typing the same command every time is very frustrated to me, and
now looking the way to call them in efficient way.
I know "command history" will list the command with the number,
and the $ will execute the command.
But is there something similar like ctrl-p/ctrl-n or ctrl-r in bash
to show or search the previous commands ?
(lldb command running on terminal (not build-in lldb inside
Xcode) can do this.)
I'm using Xcode version 11.5(11E608c).
Use up arrow in the LLDB command prompt. It works similar to Terminal in that regard.
Type Ctrl R and then type part of the command you want. It'll display the first matching command. Keep typing Ctrl R and it will cycle through previous matching commands.
Is there a possability in Emacs to run custom commands or a set of commands (eg. shell) with a user defined emacs shortcut/hook?
To make this clearer. I am working with an embedded system (target), but developing on the host. After writing and compiling code (eg using emacs compile command), I would like to copy (eg. scp) the binary to the system right away.
Furthermore it would be good if the custom shorcut/hook would be easy to adjust (eg. ip address of the target).
Btw: I am aware of the "shell-command" in emacs, but that is not quite what I am looking for.
Would appreciate any advice. Thanks!
I ended up using C-x C-f /root#my-target-ip:/tmp/myfile to edit the file directly on the target. Then you can run it with shell-command ./myfile from within emacs.
In the ESS (Emacs speaks Statistics) manual, it says if I use Cygwin bash shell, I should run M-x S RET.
and if MSDOS prompt shell, run something like M-x S+6-msdos RET.
so what's the proper syntax for starting a Stata process? I tried M-x stata-msdos RET, M-x sta-msdos, and M-x Stata-msdos and failed.
EDIT 1: I'm using Windows 8.1 and MSDOS prompt shell (this is the shell pops up when I use M-x shell)
It seems there is some problem when I use M-x stata RET (might not be the right command for msdos shell), instead of opening a new buffer in Stata mode, Emacs starts Stata in its own window and leaves the old Emacs window irresponsive, which I have to force kill in the end.
EDIT 2: I asked roughly the same question in the ess mailing list and someone mentioned that it seems in Windows Stata Can only be used with its own GUI, not the command line, and that explains why when I M-x stata RET it always opens its own window ( I thought it was because I was using the wrong command). I asked the question because I didn't see the question being asked, now I guess I understand (sadly) why: because it can not be solved..
Suppose I am in terminal in Emacs (M-x term), and I list the following files in current directory:
text_code.R
Now I am in bash-3.2$ (terminal) and hope to open this .R file in another Emacs buffer and then edit. Is there a way to do it? This might be a trivial question, for I am a newbie to Linux and Emacs. Thanks in advance!
Remember that in Term Mode you can type C-c C-f to open a file (just like C-x C-f outside Term Mode). The prompt will already be on your current directory, so you just have to start typing the name of the file and autocomplete it with TAB.
I don't know the official procedure for what you want to do, but here is a procedure that works:
Either tell emacs to run as a daemon (Ref: EmacsAsDaemon) or in emacs start daemon via M-x server-start.
In the term, a command like emacsclient -n filename will start editing the specified file in the current window. Note, emacsclient also has a -c, --create-frame option to edit in a new frame. You probably will want to use a -n option as above, so you can continue using your term, after selecting it from the buffers list in another pane or frame.
If you start the daemon via M-x server-start in emacs, the daemon will terminate when you exit from emacs. If you set it up via reference mentioned above, use kill-emacs or save-buffers-kill-emacs commands or shell command emacsclient -e '(kill-emacs)' to stop it, as mentioned in part 6 of reference.
I installed Emacs 23 on OS X (the NS/Cocoa variant) and I got the following error when I tried to run ssh from a shell inside emacs.
"pseudo terminal will not be allocated because stdin is not a terminal".
Searching around the web tells me that it is because stdin is somehow a pipe instead of a real tty. I confirmed that by running stty.
Unfortunately, no one really seems to know how to fix it. There were suggestions to try and modify process-connection-type (some said set it to nil while others said t) but unfortunately, neither seems to work.
How do I fix this and get back usage of ssh (and I guess other tools like ftp, latex and anything that needs a tty) inside emacs's shell?
[update: I know of M-x term but that isn't a solution for me. I have confirmed that this works for me on Carbon Emacs 22.3 so this might be something specific about the NS post)
I figured this out. I had some piece of elisp in my .emacs which was setting process-connection-type to nil. Though this was needed for Carbon Emacs, it doesn't seem to be needed for NS Emacs 23. Setting it to t fixes it
are you using M-x shell or M-x term, term is a full blown terminal emulator that will allow you to run any console application you want.
M-x ansi-term
Character to defy 15 char limit.