EMacs Questions

From wiki
Revision as of 18:26, 9 March 2008 by MatMarcus (Talk | contribs)

Jump to: navigation, search

Q: In C/C++ modes, I want:

 Tabs as spaces
 Tabs is 4 spaces
 Persistent off auto formatting.
 Double-click selection across _ (underscore)

A: Try this in your .emacs:

(defun my-c-mode-common-hook ()
  (setq tab-width 4)
  ;; don't treat _ as word delimiter
  (modify-syntax-entry ?_ "w")
  ;; this will make sure spaces are used instead of tabs
  (setq indent-tabs-mode t)
  ;; we don't like auto-newline and hungry-delete
  (c-toggle-auto-hungry-state -1)
  (c-toggle-auto-state -1)
  (setq c-basic-offset 4)
(add-hook 'c-mode-common-hook 'my-c-mode-common-hook)

Q: [done?] Bind recompile to a key command

 tab means indent
 Get command-[ ] behavior to work.
 Get bjam to compile / force execute