gdb within emacs on Windows - emacs

I'm running Emacs 22.3 in Windows. Earlier today I had gdb working within Emacs just fine. I was installing QT4 and during the installation it asked me to uninstall MSYS which I quickly clicked through not thinking about things. I think I had gdb installed with the MSYS package and Emacs was using that, but I'm not completely sure. Now when I run the following I get an error in the mini-buffer.
M-x gdb
"Searching for program: no such file or directory, gdb"
I tried to add the path "C:\cygwin\bin" to the Emacs load-path with this code but I still get the same error.
(message "Adding cygwin/bin to load path.")
(add-to-list 'load-path "c:/cygwin/bin")
Could someone tell me what I'm doing wrong?
Thanks.

probably adjust your system path to point it where you have gdb installed.

Try using /cygdrv/c/cygwin/bin

Related

Emacs: where is better have the executable file?

After many changes on my Debian Jessie, when I launch the command emacs I receive an error libgnutls.so.26 : cannot open shared object file: No such file or directory.
If I launch instead the command emacs24 everything is allright.
I have emacs in /usr/local/bin
I have emacs24 in /usr/bin.
So, for now I created an alias to launch emacs24 as emacs, but i don't like and, for example, i have to change the git setting to open the default ide cause emacs is not availlable yet.
The question is where is the correct position of the command ? I have to change my PATH ?
Consider that libgnutls.so.26 is not installable from apt.
Thanks for any suggest or advice.
This is very strange, because a simple sudo dnf install emacs should suffice (I use fedora, so you probably use apt-get instead of dnf). Maybe it is best to just reinstall emacs (backup your .emacs to be safe) using apt-get? Anyhow, in fedora the emacs executable is located at /usr/bin/emacs (which is also the one used in the terminal when you use the emacs command).

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.

Emacs can't find gofmt in go-mode

I'm trying to use Emacs for golang programming. I downloaded the go-mode package and installed it. My .emacs is:
(require 'go-mode)
When I'm opening *.go files, go-mode enables correctly. But I can't save any *.go files because when I'm trying to save *.go files I'm getting an error in the minibuffer that says
gofmtprogram not found.
Golang installed (version 1.3), gofmt works from terminal.
How can I solve this problem?
Thank you.
On OSX I'm usingthe following in .emacs/init.el
(use-package exec-path-from-shell
:ensure t
:init (exec-path-from-shell-initialize))
to insure that Emacs are using the correct path.
Make sure you have gofmt in your PATH. (echo $PATH) to check, if you can't run gofmt in your shell, it is likely that emacs won't as well.
gofmt on my setup is in $GOBIN/gofmt, but I think it can be as well be in one of the $GOPATH/bin.
If you have it in your path, chances are that you have an emacs configuration that sets the path. Change as needed.
If you installed via a packet manager, chances are that gofmt will be somewhere else. (I think brew puts it in /usr/local/bin)
Small tip when this happen and you really need to save: switch back to text-mode (M-x text-mode).

Emacs + Cygwin setup under windows !

I just downloaded Emacs and Cygwin for Windows(Vista in my case). Have no idea how to set them up.
Any help would be appreciated !
Thanks !
I use these libraries, in this order:
(require 'cygwin-mount)
(require 'setup-cygwin)
They are both available on EmacsWiki:
http://www.emacswiki.org/emacs/cygwin-mount.el
http://www.emacswiki.org/emacs/setup-cygwin.el
Step 1: Install libraries
http://www.emacswiki.org/emacs/cygwin-mount.el
http://www.emacswiki.org/emacs/setup-cygwin.el
Step 2: Install cygwin to C:\cygwin (This requirement is hardcoded in setup-cygwin.el, so just do it unless you are willing to modify setup-cygwin.el).
Step 3: Add following code into your .emacs or .emacs.d/init.el. Please note the variable cygwin-mount-cygwin-bin-directory is not set by default in cygwin-mount.el, I suggest using hard coded path (I mean "c:/cygwin/bin" actually) since the cygwin install path is already hardcoded by setup-cygwin.el.
(setq *win32* (eq system-type 'windows-nt) )
;; win32 auto configuration, assuming that cygwin is installed at "c:/cygwin"
(if *win32*
(progn
(setq cygwin-mount-cygwin-bin-directory "c:/cygwin/bin")
(require 'setup-cygwin)
;(setenv "HOME" "c:/cygwin/home/someuser") ;; better to set HOME env in GUI
))
Maybe try posting your question on http://superuser.com
But:
Installing Emacs on Windows 95/98/2K/NT/ME/XP/Vista/Windows 7
Quick Start Guide for those more experienced with Windows
Use cygwin-mount.el to integrate Cygwin with Emacs:
http://www.khngai.com/emacs/cygwin.php
You might also want to replace the DOS Shell with the Cygwin bash, that's also covered.
You can find instructions here.
There're several way to integrate emacs with cygwin as follows:
emacs-nox under cygwin. Not attractive!
emacs-X11 under cygwin. An X server is needed like XMing or Cygwin/X. A bit slow and heavy.
emacs-w32 under cygwin.
emacs under windows. You need some configuration to make emacs recognize the cygwin environment. Difficult for beginners.
I'd recommend using emacs-w32 with cygwin, which uses native Windows GUI so that you don't have to start an xserver just to run emacs and you don't need to write/download any tricky code to make emacs aware of cygwin env as other answers do.
Just install emacs-w32 and run it from mintty and here you go. FYI, if you want to start emacs "independently", write a .bat file with D:\cygwin\bin\run.exe /usr/bin/bash.exe --login -i -c /usr/bin/emacs-w32.exe inside or, as I do, write a .ahk script to start emacs with hotkey F12.

gdb not showing code within emacs on Windows

I asked a question just yesterday which caused this new issue. gdb within emacs on Windows
Basically I was installing a QT sdk which asked me to uninstall MSYS which I did & I hosed my emacs/gdb interaction.
Here is the gdb_init file that I'm using. Before the uninstall of MSYS this worked fine. Now after it, the breakpoints are working but I am not getting my code in another window with the little red dot on the left margin for a breakpoint.
file ~/../sandbox/trunk/current-win32/debug-bin/sm.exe
dir ~/../sandbox/trunk/src/mgr/view
dir ~/../sandbox/trunk/src/mgr/view/appstatus
dir ~/../sandbox/trunk/src/mgr/controller
break widget.cpp:176
break book.cpp:72
break TcpClient.cpp:660
break mainwidget.cpp:1474
The steps I'm running in emacs
M-x gdb
source ~/gdb_init
run
(It will break but not give me the code along with the breakpoint)
Any ideas what I'm doing wrong?
It turns out I was using the Cygwin version of gdb and had that in my system PATH. For some reason that didn't work out and I was getting errors in gdb within Emacs. Once I installed MSYS(mingw) & the gdb install on their download page and put that in my system PATH then I was back up and running.
I had the exact same problem: windows emacs, cygwin gdb, and the source buffer did not update with the "=>" pointer to show the code location. Downloaded mingw gdb.exe from here: http://sourceforge.net/projects/mingw/files/OldFiles/and selected that gdb with M-x gdb and it worked perfectly.