Difference between revisions of "Configure .emacs file"
From Notes_Wiki
m |
m |
||
Line 1: | Line 1: | ||
<yambe:breadcrumb>Emacs</yambe:breadcrumb> | <yambe:breadcrumb self="Configure .emacs file">Emacs|Emacs</yambe:breadcrumb> | ||
=Configure .emacs file= | =Configure .emacs file= | ||
Line 175: | Line 175: | ||
<yambe:breadcrumb self="Configure .emacs file">Emacs|Emacs</yambe:breadcrumb> | |||
<yambe:breadcrumb>Emacs</yambe:breadcrumb> |
Revision as of 08:46, 12 September 2018
<yambe:breadcrumb self="Configure .emacs file">Emacs|Emacs</yambe:breadcrumb>
Configure .emacs file
Use following as .emacs configuration. If there are already few lines in .emacs file then these lines can be appended / prepended to existing file:
;; .emacs - Assumes emacs 24.4.1+, org 8.2.10-34+ ;; Considerable information learned from http://www.aaronbedra.com/emacs.d/ ;; Set full username and email address (setq user-full-name "Saurabh Barjatiya") (setq user-mail-address "saurabh@sbarjatiya.com") ;Modify path as neeed ;(setenv "PATH" (concat "/usr/local/bin:/opt/local/bin:/usr/bin:/bin" (getenv "PATH"))) ;Package common lisp is required to add more functionality to emacs lisp to ;allow easier configuration of emacs. Without this loop used further in this file is not available. (require 'cl) ;; Initialize built-in package manager (load "package") (package-initialize) (add-to-list 'package-archives '("marmalade" . "http://marmalade-repo.org/packages/")) (add-to-list 'package-archives '("melpa" . "http://melpa.milkbox.net/packages/") t) (setq package-archive-enable-alist '(("melpa" deft magit))) ;; define list of default packages to install (defvar saurabh/packages '(ac-slime auto-complete autopair clojure-mode coffee-mode csharp-mode deft erlang feature-mode flycheck gist go-mode graphviz-dot-mode haml-mode haskell-mode htmlize magit markdown-mode marmalade nodejs-repl o-blog org paredit php-mode puppet-mode restclient rvm scala-mode smex sml-mode solarized-theme web-mode writegood-mode yaml-mode) "Default packages") ;;Install default packages (defun saurabh/packages-installed-p () (loop for pkg in saurabh/packages when (not (package-installed-p pkg)) do (return nil) finally (return t))) (unless (saurabh/packages-installed-p) (message "%s" "Refreshing package database...") (package-refresh-contents) (dolist (pkg saurabh/packages) (when (not (package-installed-p pkg)) (package-install pkg)))) ;; default to better frame titles (setq frame-title-format (concat "%b - emacs@" (system-name))) ;; default to unified diffs (setq diff-switches "-u") ;;Preventing emacs from creating backup files (setq make-backup-files nil) ;;Preventing emacs from creating auto-save files (setq auto-save-default nil) ;;Use visual-line-mode for word wrap (global-visual-line-mode 1) ;;Wrap lines at 70 columns (set-fill-column 70) ;;Wrap lines at 70 columns and enable auto-fill-mode automatically (setq-default fill-column 70) (add-hook 'text-mode-hook 'turn-on-auto-fill) ;;Set default font-size to 120 (12pt) (set-face-attribute 'default nil :height 120) ;;Setting up Emacs for use with Erlang ;;Update the below mentioned paths appropriately based on installation (add-to-list 'load-path "/usr/lib64/erlang/lib/tools-2.6.6.5/emacs/") (require 'erlang-start) (add-to-list 'auto-mode-alist '("\\.erl?$" . erlang-mode)) (add-to-list 'auto-mode-alist '("\\.hrl?$" . erlang-mode)) (add-to-list 'auto-mode-alist '("\\.escript?$" . erlang-mode)) (setq erlang-root-dir "/usr/lib64/erlang") (add-to-list 'exec-path "/usr/lib64/erlang/bin") (setq erlang-man-root-dir "/usr/lib64/erlang/man") ;;Disable splash screen at start-up (setq inhibit-splash-screen t) ;;Make emacs copy-paste M-w, C-y work with system copy-paste (setq x-select-enable-clipboard t) ;;To maximize emacs window at start-up (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)) ) (toggle-fullscreen) ;; PDFs visited in Org-mode are opened in Evince and not in the default choice (add-hook 'org-mode-hook '(lambda () (delete '("\\.pdf\\'" . default) org-file-apps) (add-to-list 'org-file-apps '("\\.pdf\\'" . "evince %s")))) ;;For setting tab to 4 spaces for .py programs (add-hook 'python-mode-hook (lambda () (setq indent-tabs-mode 'nil) (setq tab-width 4) (setq python-indent 4))) ;;To set proper command for exporting latex to pdf from org-mode (setq org-latex-to-pdf-process (quote ("pdflatex %f" "bibtex %b" "pdflatex %f"))) (setq org-latex-pdf-process (quote ("pdflatex %f" "bibtex %b" "pdflatex %f"))) ;;Add INPROGRESS along with TODO, DONE. Also enable flyspell-mode and writegood-mode ;;while org-mode is active (setq org-log-done t org-todo-keywords '((sequence "TODO" "INPROGRESS" "DONE")) org-todo-keyword-faces '(("INPROGRESS" . (:foreground "blue" :weight bold)))) (add-hook 'org-mode-hook (lambda () (flyspell-mode))) (add-hook 'org-mode-hook (lambda () (writegood-mode)))
<yambe:breadcrumb self="Configure .emacs file">Emacs|Emacs</yambe:breadcrumb>