Use Emacs for remote compilation and catch output

Just a small tip. I have souced and makefile on remoteĀ  machine and I’m trying to compile it on my local machine, but I don’t have the compiler and environment. So when I run “M-x compile“, I use a script with following contents

ssh my_remote_machine "source my_environment_file; cd my_build_directory; make my_target"

Remember, that ssh command are executed not in your common environment, so you have to import it before execution of main commands (I use source command with some script to configure environment)

Then Emacs *compilation* buffer would receive stdout from remote make and you even would be able to navigate through compiler errors in your local code (if you have correct paths)

Emacs hangs on large file with DOS-encoded end of lines

I’ve had a quite big C++ source file, copied from Windows with ^M symbol after each line. After any scrolling downside Emacs 24.2 hanged up and the only option was to kill it.

Due to the fact that my .emacs configuration is quite big, I started with binary search, commenting out parts of lisp code. After few minutes I’ve figured out, that the problem lies in .gnu-emacs file, so I moved with binary search to that file.

Within 5 minutes, source of the problem was found:

(setq-default inhibit-eol-conversion t)

After commenting this line, Emacs was resurrected!

C++ dev via Emacs 24 in Windows 7 (visual studio includes)

Recently I had issue with CEDET 1.1: semantic was not able to parse header files from Visual Studio, when using

(semantic-add-system-include “C:/Program Files/Microsoft Visual Studio 10.0/VS/Include” ‘c++-mode)

But after looking through Visual Stuio headers in Studio itself, I’ve found some headers with defines, which are new to semantic, so you have to add them after this system include in your .el files:

(defun windows-semantic-hook ()
  (setq microsoft-base-dir 
        "C:/Program Files (x86)/Microsoft Visual Studio 14.0/VC/include")
  (add-to-list 'semantic-lex-c-preprocessor-symbol-file 
               (concat microsoft-base-dir "/crtdefs.h"))
  (add-to-list 'semantic-lex-c-preprocessor-symbol-file 
               (concat microsoft-base-dir "/yvals.h"))
  (add-to-list 'semantic-lex-c-preprocessor-symbol-file 
               (concat microsoft-base-dir "/vadefs.h"))
  (add-to-list 'semantic-lex-c-preprocessor-symbol-file 
               (concat microsoft-base-dir "/comdefsp.h"))
  (semantic-add-system-include microsoft-base-dir 'c++-mode)
  (add-to-list 'auto-mode-alist (cons microsoft-base-dir 'c++-mode)))

(add-hook 'semantic-init-hooks 'windows-semantic-hook)

Emacs 24.2 with Python and C++ bundle for Windows

I’ve managed to put together some interesting things with Emacs for Windows. For now we have:

  • Emacs 24.2 for Windows
  • CEDET-1.1
  • Auto-Complete 1.3.1
  • Custom themes (using tango in current zip)
  • Ocaml support (ocaml mode, eval and highlighting)
  • Git user interface 1.0 support (with git blame)
  • Ropemacs + Pylint + Flymake (Python IDE + static analysis)
  • Fixes for Cygwin, gnu and git pathes in Windows