Emacs Lisp Makefile
Switch branches/tags
Nothing to show
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Failed to load latest commit information.
ert-tests
extensions
snippets/org-mode
.gitignore
.gitmodules
Makefile
ReadMe.org
alias.org
beta.org
custom_functions.org
gnus.el
init.el
keyboard.org
latex.org
myorgmode.org
mytime.org
packages.org

ReadMe.org

Emacs configuration

Usage

  • Clone this repo(Warning: Backup existing ~/.emacs.d/ and ~/.emacs)
    git clone http://github.com/psachin/.emacs.d.git ~/.emacs.d
        
  • Update submodules. This will enable hidepw (Optional)
    cd ~/.emacs.d
    git submodule init
    git submodule update
        
  • Start Emacs

Contribute

  • Feel free to send Pull Requests
  • Create new issues

Gnus

  • Optionally edit gnus.el and copy the file as ~/.gnus.el

Minimal config

Change user name and Email

 ;; Load my details
 (setq user-full-name "Sachin"
	   user-mail-address "psachin@redhat.com")

Do not mess up init.el

;; Me: Emacs..
;; Emacs: Yes Master?
;; Me: Put your customization inside custom.el. I don't want init.el to be messed up by you.
;; Emacs: As you wish Master.
(setq custom-file (expand-file-name "custom.el" user-emacs-directory))
(when (file-exists-p custom-file)
  (load custom-file))

Turn of all decorations

;; Turn off windows decoration
(if window-system
    (progn
      (tool-bar-mode 0)
      (menu-bar-mode 0)
      (scroll-all-mode 0)
      (scroll-bar-mode 0)
      (tooltip-mode 0))
  (menu-bar-mode 0))

Turn on the theme

;; Load in-built dark theme
(if window-system
    (load-theme 'tango-dark)
  (load-theme 'wombat))

I want you to greet me, Emacs!

;; Greeting from Emacs
(setq-default inhibit-startup-screen t
              initial-scratch-message ";; Welcome Master

"
              inhibit-splash-screen t)

General configuration

  • Frame title
    ;; Frame title
    (setq frame-title-format "Emacser")
        
  • Set visible bell
    ;; Set visible bell
    (setq visible-bell t)
        
  • Show matching parenthesis
    ;; Show matching parenthesis
    (show-paren-mode t)
    (setq-default show-paren-style 'parenthesis) ; highlight just brackets
    ;; (setq show-paren-style 'expression) ; highlight bracket expression
        
  • Elisp function docs
    ;; Show elisp function docs in result bar
    (add-hook 'emacs-lisp-mode-hook 'turn-on-eldoc-mode)
    (add-hook 'lisp-interaction-mode-hook 'turn-on-eldoc-mode)
    (add-hook 'ielm-mode-hook 'turn-on-eldoc-mode)
        
  • modeline
    ;;; Minor mode tweaks
    ;; Enable column-number mode
    (column-number-mode t)
    
    ;; Battery
    (ignore-errors (display-battery-mode t))
    (setq battery-mode-line-format "[%p/%L]")
    
    ;; Date/time
    (display-time-mode t)
    (setq display-time-24hr-format t)
    (setq display-time-format "[%d-%m(%b)-%Y-%H:%M]")
    
    ;; File size
    (size-indication-mode t)
    
    ;; Show funtion name in a mode line
    (which-function-mode t)
        
  • Editing
    ;;; Editing
    ;; Delete selected text while typing
    (delete-selection-mode t)
    
    ;; Turn on word wrap
    (add-hook 'text-mode-hook '(lambda ()
                                 (auto-fill-mode t)))
    
    ;; Enable subword for all programing modes
    (add-hook 'prog-mode-hook 'subword-mode)
    
    ;; Enable pretty syntax highlighting everywhere
    (global-font-lock-mode t)
    
    ;; Wrap lines automatically
    (auto-fill-mode t)
    
    ;; Indicate empty line
    (setq-default indicate-empty-lines t)
    (setq-default show-trailing-whitespace t)
    
    ;; Expand some words and auto-correct
    (setq save-abbrevs 'silently)
    (setq-default abbrev-mode t)
        
  • Dired
    ;;; Dired
    ;; Hide DOT files with M-o
    (require 'dired-x)
    (setq dired-omit-files "^\\...+$")
    
    (add-hook 'dired-mode-hook
              (lambda ()
                ;; Set dired-x buffer-local variables here.  For example:
                (dired-omit-mode 1)
                ))
    
    ;; Auto complete with ignore case
    (setq-default read-buffer-completion-ignore-case t)
    (setq-default read-file-name-completion-ignore-case t)
    
    ;; Save all backup files in user space
    (setq backup-directory-alist '((".*" . "~/.emacs.d/emacs-saves")))
        
  • File
    ;;; File
    ;; File encoding
    (prefer-coding-system 'utf-8)
    (setq-default buffer-file-coding-system 'utf-8-auto-unix)
    
    ;; limit to 80 chars
    ;; TODO: to apply only code other than java.core
    (require 'whitespace)
    (setq whitespace-line-column 80) ;; limit line length
    (setq whitespace-style '(face lines-tail))
    (add-hook 'prog-mode-hook 'whitespace-mode)
    (global-whitespace-mode +1)
    
    ;; Full path of buffer in mode-line
    (setq uniquify-buffer-name-style 'forward)
        
  • Misc
    ;;; Misc
    ;; Save history
    (savehist-mode 1)
    
    ;; Lazy prompting. Change "yes or no" to "y or n"
    ;; http://dl.dropboxusercontent.com/u/3968124/sacha-emacs.html
    (fset 'yes-or-no-p 'y-or-n-p)
    
    ;; Make TAB key always call a indent command
    (setq-default tab-always-indent t)
    
    ;; Make TAB key do indent first and then completion
    (setq-default tab-always-indent 'complete)
    
    ;; Fill a line with space after a period
    (setq sentence-end-double-space nil)
    
    ;; Modes for certain file extensions
    ;; add C++ mode for .ino files(Arduino files)
    (add-to-list 'auto-mode-alist
                 '("\\.ino\\.pde\\'" . c++-mode)
                 '("\\.h\\'" . c++-mode))
    
    ;; Enable Allman Style of indentation for C code. OpenSource for you, Jan 2014.
    (setq-default c-default-style "linux"
                  c-basic-offset 4)
    
    
    ;; hide DOT files with M-o
    (require 'dired-x)
    (setq dired-omit-files "^\\...+$")
    
    (add-hook 'dired-mode-hook
              (lambda ()
                ;; Set dired-x buffer-local variables here.  For example:
                (dired-omit-mode 1)))
        
  • Start Emacs server
    ;; Start Emacs server
    (require 'server)
    (unless (server-running-p)
      (server-start))
        

Org Mode

Org mode customizations

;;; Load org.el
(org-babel-load-file (concat user-emacs-directory "myorgmode.org"))

LaTeX

I want to have special section for LaTeX

;;; Load latex.el
(org-babel-load-file (concat user-emacs-directory "latex.org"))

Alias

;;; Load aliases.el
(org-babel-load-file (concat user-emacs-directory "alias.org"))

Packages

;;; Load packages.el
(org-babel-load-file (concat user-emacs-directory "packages.org"))

Keyboard config

;;; Load keyboard.el
(org-babel-load-file (concat user-emacs-directory "keyboard.org"))

Custom Functions

All my custom functions

;;; Load custom_functions.el
(org-babel-load-file (concat user-emacs-directory "custom_functions.org"))

My time

Appointment customizations

;;; Load mytime.el
(org-babel-load-file (concat user-emacs-directory "mytime.org"))

Beta

New settings/features/packages I want to test before including them to my real configuration.

;;; Load beta.el
(org-babel-load-file (concat user-emacs-directory "beta.org"))