Emacs usecases 0 - Intro
RSS 2.0
|
Published: 2008-03-09
Next in series: 1 - Python
No more VIM for me. I tried out Emacs for a few days and I absolutely love it. It's got all the features I need, some features I don't need, and numerous features I didn't even know I needed. Also, with elisp, you can make it do whatever you want it to do. DotEmacs
My setup is based on this post. The
The .emacs:
;; Based on McGeary's init: http://www.emacsblog.org/2007/10/07/declaring-emacs-bankruptcy/ ;; paths (add-to-list 'load-path (expand-file-name "~/.emacs.d")) (add-to-list 'load-path (expand-file-name "~/.emacs.d/lisp")) ;; Third-party stuff (require 'doremi-cmd) ;; Preferences (load "my-generic") ;; Autoload hook functions (autoload 'my-python-init "my-python-init") (autoload 'my-ruby-init "my-ruby-init") (autoload 'my-latex-init "my-latex-init") ;; Hooks ;; (add-hook 'python-mode-hook 'my-python-init) (add-hook 'LaTeX-mode-hook 'my-latex-init) (add-hook 'ruby-mode-hook 'my-ruby-init) ;; Customize (custom-set-variables '(inhibit-splash-screen t) '(nuke-trailing-whitespace-in-hooks (quote (write-file-hooks mail-send-hook)) nil (nuke-trailing-whitespace))) (custom-set-faces ) An example of what the autoloaded files look like is provided below. They'll all be discussed in the post related to their mode. my-python-init.el:
;;;###autoload (defun my-python-init () ;; Python must always be indented, so why not bind Return to that? (local-set-key "\r" 'newline-and-indent) ) Also, my-generic.el:
(load "toggle-fullscreen") (color-theme-ld-dark) ;; Nice, dark, easy on the eyes (tool-bar-mode -1) ;; No toolbar, thanks (set-default 'fill-column 80) ;; 80. standard. good. (setq visible-bell t);; Can't go beeping around at midnight, now can I? (toggle-fullscreen) ;; Start maximized (setq-default indent-tabs-mode nil) ;; I always want spaces instead of tabs (global-set-key "\C-x\C-m" 'execute-extended-command) ;; for M-x (global-set-key "\C-w" 'backward-kill-word) ;; instead of backspacing (global-set-key "\C-x\C-k" 'kill-region) ;; rebind kill-region (setq default-tab-width 4) ;; mode-compile (autoload 'mode-compile "mode-compile" "Command to compile current buffer file based on the major mode" t) (global-set-key "\C-cc" 'mode-compile) (autoload 'mode-compile-kill "mode-compile" "Command to kill a compilation launched by `mode-compile'" t) (global-set-key "\C-ck" 'mode-compile-kill) (setq mode-compile-expert-p t) And finally toggle-fullscreen.el:
;; Maximizes the window; Found on the Ubuntu forums. (defun toggle-fullscreen () (interactive) (x-send-client-message nil 0 nil "_NET_WM_STATE" 32 '(2 "_NET_WM_STATE_MAXIMIZED_VERT" 0)) (x-send-client-message nil 0 nil "_NET_WM_STATE" 32 '(2 "_NET_WM_STATE_MAXIMIZED_HORZ" 0)) )Btw, the listings were made by the Emacs command "htmlize-file". Comments |
Archive
|