My .emacs file.

I have been using emacs extensively for programming. While text editors are a matter of taste and getting used to the quirks, i find emacs very useful useful. For editing linux system files, I generally prefer vim for its speed.

Here is my .emacs file. The matlab.el file can be found easily by googling. Just copy paste below to enable, ruby mode, matlab mode, auto-indentation etc. If the font(bitstream vera sans mono) is not available on your system is not available, just change the font to “terminal”, i find that tolerable for programming. Acknowledgments are due to the different people on the Internet for posting their .emacs file, unfortunately i never did remember the URLs from which i took the code snippets.

;;[C .emacs

;;; uncomment this line to disable loading of “default.el” at startup
(setq inhibit-default-init t)

;; turn on font-lock mode
(when (fboundp ‘global-font-lock-mode)
(global-font-lock-mode t))

;; enable visual feedback on selections
;(setq transient-mark-mode t)

;; default to better frame titles
(setq frame-title-format
(concat “%b – emacs@” system-name))

;; default to unified diffs
(setq diff-switches “-u”)
(custom-set-variables
;; custom-set-variables was added by Custom.
;; If you edit it by hand, you could mess it up, so be careful.
;; Your init file should contain only one such instance.
;; If there is more than one, they won’t work right.
‘(case-fold-search t)
‘(current-language-environment “Latin-1”)
‘(default-input-method “latin-1-prefix”)
‘(global-font-lock-mode t nil (font-lock))
‘(text-mode-hook (quote (turn-on-auto-fill text-mode-hook-identify)))
‘(transient-mark-mode t)
‘(visible-cursor t))
(set-default-font “-bitstream-bitstream vera sans mono-medium-r-normal-*-12-*-75-75-m-*-*-*”)
;; Make text mode as default and turn on Auto Fill
(setq default-major-mode ‘text-mode)
(setq text-mode-hook ‘turn-on-auto-fill)
;; For ruby
(autoload ‘ruby-mode “ruby-mode” “Mode for editing ruby source files”)
(add-to-list ‘auto-mode-alist ‘(“\.rb$” . ruby-mode))
(add-to-list ‘interpreter-mode-alist ‘(“ruby” . ruby-mode))
(autoload ‘run-ruby “inf-ruby” “Run an inferior Ruby process”)
(autoload ‘inf-ruby-keys “inf-ruby” “Set local key defs for inf-ruby in ruby-mode”)
(setq scroll-step 1)
(setq scroll-conservatively 1)
(global-set-key “em” ‘goto-line)
(global-set-key (read-kbd-macro “<delete>”) ‘delete-char)
;;(load “/usr/local/share/lush/etc/lush.el”)
(add-to-list ‘load-path “/nfs1/krishnan/.emacs.d/”)
(autoload ‘matlab-mode “/nfs1/krishnan/.emacs.d/matlab.el” “Matlab Editing Mode” t)
(add-to-list ‘auto-mode-alist ‘(“\.m$” . matlab-mode))
(setq matlab-indent-function t)
(autoload ‘matlab-shell “matlab” “Interactive MATLAB mode.” t)
(setq matlab-shell-command-switches ‘(“-nojvm”))

(global-set-key [(f9)] ‘compile)
(setq compilation-window-height 8 )
(setq compilation-finish-function
(lambda (buf str)
(if (string-match “exited abnormally” str)
;;there were errors
(message “compilation errors, press C-x ` to visit”)
;;no errors, make the compilation window go away in 0.5 seconds
(run-at-time 0.5 nil ‘delete-windows-on buf)
(message “NO COMPILATION ERRORS!”))))

(set-cursor-color “wheat”)
(autoload ‘python-mode “python-mode” “Python Mode.” t)
(add-to-list ‘auto-mode-alist ‘(“\.py\'” . python-mode))
(add-to-list ‘interpreter-mode-alist ‘(“python” . python-mode))

(add-hook ‘python-mode-hook
(lambda ()
(set (make-variable-buffer-local ‘beginning-of-defun-function)
‘py-beginning-of-def-or-class)
(setq outline-regexp “def\|class “)))

(custom-set-faces
;; custom-set-faces was added by Custom.
;; If you edit it by hand, you could mess it up, so be careful.
;; Your init file should contain only one such instance.
;; If there is more than one, they won’t work right.
‘(default ((t (:stipple nil :background “gray20” :foreground “wheat” :inverse-video nil :box nil :strike-through nil :overline nil :underline nil :slant normal :weight normal :height 120 :width normal :family “bitstream-bitstream vera sans mono”)))))

Advertisements
Post a comment or leave a trackback: Trackback URL.

Comments

  • Reza  On September 1, 2007 at 6:27 am

    Hi,

    Hope my question is not silly; I have Fedora 7 as my O.S. Do you know where is my “.emacs” file. I can’t find it in my home directory.

    Thanks,
    Reza

  • anoopl  On May 27, 2009 at 12:12 am

    Hi,
    Thanks for the blog. could you you suggest any good svn plugin and tips.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: