User Tools

Site Tools


emacs:emacs

This is an old revision of the document!


Emacs

Show trailing whitespace

Show trailing whitespace as red blocks:

(custom-set-variables
 '(show-trailing-whitespace t))

Use Allman/BSD style

Make curly braces placement as described by Allman from the BSD project:

(setq c-default-style "bsd" c-basic-offset 4)

Use SmartTabs

Use "SmartTabs", ie. tabs for indentation and spaces for alignment.

Create the folder ~/.emacs.d/lisp and download smart-tabs-mode.el and cl-lib into it.

Add the following lines to the .emacs file:

(add-to-list 'load-path "~/.emacs.d/lisp/")
(load-file "~/.emacs.d/lisp/cl-lib-0.5.el")
(load-file "~/.emacs.d/lisp/smart-tabs-mode.el")
 
(autoload 'smart-tabs-mode "Intelligently indent with tabs, align with spaces!")
(autoload 'smart-tabs-mode-enable "smart-tabs-mode")
(autoload 'smart-tabs-advice "smart-tabs-mode")
(autoload 'smart-tabs-insinuate "smart-tabs-mode")
 
(smart-tabs-insinuate 'c 'c++ 'java 'javascript 'cperl 'ruby 'nxml)

Switch between cc/h files

Switch between the header and implementation using Alt-o.

Download SwitchFile.el to the ~/emacs.d/lisp folder.

(require 'switch-file)
(global-set-key (kbd "M-o") 'switch-cc-to-h)

Show whitespace

emacs/emacs.1442078274.txt.gz · Last modified: 2015/09/12 19:17 by deva