Emacs + GDB + SCons + Step through Debugging - emacs

When compiling a project via a makefile using the Emacs compile command, when gdb is run on the resultant binary the application can be stepped through. However, when building using a large project with SCons, attempting to step through does not work in that Emacs doesn't seem to know which files to load or how they're related to the binary.
What does one have to do to do step through in Emacs? If Emacs can't support SCons natively then how can this be done manually; make must be using some mechanism to alert Emacs to a file's presence.

Are you sure your make and scons compile options are the same? It sounds like your scons build is lacking debug symbols (in gcc, use the -g option).

I don't use Scons. I can't help but ask if you have done the Scons IDEIntegration as given in the Working within Emacs and XEmacs section. It says Scons builds in a different directory that Emacs does not look at by default, so you have to move the files to make Emacs look at them. But that is for navigating through build error messages. I hope it works for gdb too.

Related

Emacs OSX 10.13 configuration issue

Recently I pass to Emacs org because is really convenient to me to write note there.
So I installed all packages I needed (principally ORG and EVIL) but I didn't understand how to setup everything.
I installed emacs from brew without using cask, I linked it, and I'm sure that I'm using the version that I installed (26.1).
So in my ~/ folder I have a .emacs file in which I set up evil mode, and I have a /.emacs.d/ in which I have a lot of file. The problem is: whatever I wrote in a ~/.emacs.d/init.el seems doesn't effect emacs.
So I said "whatever, I'm going on github and I installed some complete configurations and then I customized them myself". I tried to install these two configurations.
https://github.com/hrs/dotfiles
https://github.com/larstvei/dot-emacs?files=1
But for some reason, after doing exactly what they say on README.org
nothing happens.
In particular the second link, after install and open emacs said I need to have ~/.cask/.cask.el but I don't have it.
Advice?

Emacs 21 C/C++ auto-complete mode

I am working on a server which uses a really old emacs. The only way to install plugins is by downloading the .el files and adding them to the ~/.emacs/ folder and then sourcing it from the main .emacs file. Would someone know of a C/C++ autocomplete plugin which works with Emacs 21? I tried auto-complete-mode but I get an error.
An error has occurred while loading `/home/sbhalla/.emacs':
Symbol's function definition is void: defvaralias
The same auto-complete-mode works fine on emacs 22.
You might be able to run Emacs 24 without root access:
Download and untar Emacs 24: http://gnu.mirror.iweb.com/emacs/emacs-24.5.tar.gz
./configure && make. It may tell you to disable some options, e.g. I had to compile ./configure --without-jpg --without-png
You should be able to run ./src/emacs
I've done this to get the latest version of Emacs on university machines without sudo access, so it could probably work for you too.

Setting up Vala mode on Emacs

I'm trying to set up a mode for editing Vala in Emacs. I've only found these instructions, and it seems that (for the first case with packages) marmalade no longer carries vala-mode, and for the second, csharp-mode always fails to compile when I try to install it! What should I do?
I just confirmed that vala-mode is not included in the marmalade archive, despite the link above. To work around this, from within M-x eshell execute:
$ wget http://marmalade-repo.org/packages/vala-mode-0.1.el
$ package-install-file vala-mode-0.1.el
package-install works with the network automatically, but package-install-file, and package-install-from-buffer are also available.
Of course this solution will not download it automatically going forward, so you should contact Marmalade maintainers to determine why it's not listing it in the archive, or possibly submit it for inclusion in Melpa.
Another useful thing you can do is install and configure an LSP language server. I've had some success with https://github.com/Prince781/vala-language-server.
You can then install lsp-mode (https://github.com/emacs-lsp/lsp-mode) and lsp-ui (https://github.com/emacs-lsp/lsp-ui) for Emacs.
And then create a compile_commands.json file for your Vala project. E.g.
[
{
"directory": "/home/user/projects/example",
"command": "/usr/bin/valac /home/user/projects/example/main.vala",
"file": "/home/user/projects/example/main.vala"
}
]
I haven't found an automatic way of doing this. But it's possible you could use CMake. CMake is definitely capable of generating a compile_commands.json. You would just need to describe your Vala project in a CMakeLists.txt file.
Then you add (lsp) to your vala-mode-hook:
(add-hook 'vala-mode-hook #'(lambda () (lsp)))

How do I use Eclipse for Scheme development?

Has anyone succeeded in running and debugging Scheme with Eclipse?
I've tied several plug-ins (scheme 48, schemeway) and couldn't get them working. I'm not sure why they won't work; I downloaded an interpreter (kawa, mit-scheme) and tried to configure it in the plugin but nothing happened (except that mit-scheme threw some errors).
I know there is another way - Racket, but I prefer not to use another IDE. I work with many languages and I'd like to be able to use one IDE for all of them.
Any suggestions?
EDIT:
I tried to run the simplest .scm file (that has only (+ 1 1) in it). By configuration of the plug-ins I mean that I choose an external interpreter and then choose the kawa/mit-scheme interpreter exe file. When I choose kawa with schemeway it open a new window and waited for my input (I didn't have any input - JUST wanted to run the file...). When I did it with mit-scheme interpreter I got this error...
I am using linux-centOS 6.
Found the solution - here it is if someone else will encounter the same error:
There are 2 step when trying to work with Scheme 48 in Eclipse:
install the plugin - just follow http://s48.org/sdt/
install the interpreter - I finally found 2 that I can work with :
Scheme 48 (I use ubuntu so I typed scheme48 in the command line and it gave me the package that I need to install (I think it was
sudo apt-get install scheme48)). Then open the preferences in
Eclipse and go to scheme48->interpreter and check that the
command line is scheme48.
guile - I think that it is supported by gnu. It also the one I prefer. It had less errors and more understandable error output in the consul. Again, to install it I just typed guile in the command line and it gave me 3 versions. I installed 1.8. after installation I created a scheme project and a simple file. go to the preferences and changed the command line to "guile" and the working directory to the path of the project I just created. to load the file just search for the load file into interpreter button (or press Ctrl+F6).

Arduino Emacs development

I would like to use Emacs as a development environment for Arduino programming. What are some tips or links to use Emacs to program Arduino?
Is there an official (or de facto) Emacs mode?
Also, am I going to miss something in Arduino IDE if I use Emacs exclusively?
There's a nice Arduino mode on GitHub.
Just wraps cc-mode, but it does a nice job.
Update:
The EmacsWiki has a page dedicated to Ardunio Support for Emacs. The setup has a few steps but once done it allows you to compile and upload sketches from inside Emacs.
You can enable an external editor option that will allow you to edit projects using external editors and then use the Arduino IDE as some kind of terminal just for compiling and uploading.
I just edit stuff in Emacs, then switch to the IDE to just hit compile and upload. No need for makefiles.
Arduino code is just C++ wearing a dress and hat. You should be able to use that mode in Emacs without problems. You may miss the one-click-compile-and-transfer button, as well as the organization of the libraries from the official IDE. You can replicate either in Emacs of course. There is nothing the official IDE does that Emacs can't do.
There is support in the Emacs tool CEDET for programming with Arduino. As I write this, the support is available in CEDET 1.1 or later from cedet.sf.net.
It has all the development features as described for CEDET, plus Arduino only features, like uploading your program to the Arduino. See more here:
http://www.randomsample.de/cedetdocs/cedet/Arduino-Features.html
I use this Makefile and I find it very useful.
http://ed.am/dev/make/arduino-mk
As previously mentioned you do not need any external mode.
Since I am a newbie interested about learning Arduino I write small programs. Instead of creating several sub directories, one per snippet, and putting the makefile in each I decided to do it on one directory.
So that I'd be able to built the last edited source file (*.cc) . Here is my current Makefile.
SOURCES := $(shell ls -tp *.cc | grep -v /$ | head -1)
BOARD := uno
LIBRARIES := Stepper
include ~/arduino/arduino.mk
The commands that the Arduino IDE uses in the background change often, so the above info is probably out of date. I'm using IDE version 1.6.4 at the moment.
To find out the current commands, in the Arduino IDE | File | Preferences, check "Show verbose output during: x compilation x upload". Then you can see the full command in the IDE log window, and adapt your Emacs Makefile to use them.
For IDE 1.6.4, targeting a LilyPad Arduino board, that shows avr-gcc for the compiler, and avrdude for the uploader.
Choose C++ Mode in Emacs, then run the files in the Arduino IDE. Choose avr-gcc as the compiler, and avrdude as the uploader, if you want to compile in Emacs. Merry making!