GNU Emacs as a lightweight IDE

If you have a small project in any of the supported languages, you can get IDE like features without any additional installation in Emacs. Given the CEDET framework, supporting more languages boils down to simply adding a new grammar and overloading few functions.

Presently, it works for the following languages (demo links in brackets):
- C ( Auto-suggest data structure , Auto-suggest basic, generate header )
- LaTex ( Auto-suggest )
- SQL ( Auto-suggest from connected DB , Auto-suggest local names and statements )
- HTML, JS , CSS
- Java ( Auto-suggest , Refactoring , Debugging , Type hierarchy, Semantic font-lock , Getter/setter)
- Elisp ( Auto-suggest , Refactoring )

- PHP

- Assembly 

- IDE Basics, Outline view, Rename symbol, Lexer based indent region, Call tree, Semantic font lock

Complete playlist is here.

 

Steps

Config (.emacs):

(global-ede-mode 1)
(ede-enable-generic-projects)
(semantic-mode 1)    
(srecode-minor-mode 1) 
;; Install company for inline completion with dropdown
(require 'company)
(global-company-mode)
(global-set-key (kbd "M-.") 'semantic-ia-fast-jump)
  • Visit a file in the root of the project. This is typically a Makefile for C or a pom.xml/build.xml for Java projects. If this is the first time you're opening the project, run M-x ede . (Notice: It's assumed that files are under some source control like git.)
  • For Java, you can set classpath using M-x semantic-java-update-classpath. For C, you should add system includes using M-x semantic-c-update-include-path . These are file paths separated by colon.
  • Then you should be able to edit a file in any of the supported languages. First time load of a buffer might lag a bit based on how many includes it has. However, second time onwards, you should have a pleasant experience.
  • Use M-. for jump to definition and M-, to jump back to previous position.
  • Use M-x speedbar-window-mode for outline view.
  • Use M-x semantic-font-lock-mode for semantic font lock.
  • Use M-x srecode-minor-mode for code generation. It provides you menu options to generate variables, functions and classes. Additionally, in java-mode, use M-x srecode-getset-dialog for generating getter/setters.
  • Use M-x semantic-symref-symbol for renaming a symbol across files in a project.
  • Use M-x semantic-symref-call-tree for displaying and navigating a function call tree.

Generate getter/setter

Call tree
Semantic Pre-processor font lock

  • Use senator-fold-tag-toggle (C-c TAB) and senator-fold-all-tags-toggle for collapsing definitions. Variables are collapsed to single line only if they are multiline. Also it won't collapse a top level type - only its children. (overlays-at POS SORTED) is just the right API for this job.

All tags folded

Toggle nested ifdef

  • Use M-x srecode-gen-header for generating C header file.


 

 


 

Comments

Popular posts from this blog

GNU Emacs as a Comic Book Reader

Tinylisp and Multi-threaded Emacs

Data Visualization with GNU Emacs