Configuring Mutt and Emacs with AUCTeX

Lately I have been very busy with my MS studies and finding it difficult to find time for anything else. One of the things I have had to do is submit one assignment atleast every week. It is expected that you turn in those assignments in PDF format and no, a shoddily word to PDF converted document doesn’t look anywhere professional. I had to pick up LaTeX quickly for the task and it is fucking awesome. I could never get formatting right whenever I had to use MS Word, though yes I never took the time to really learn it either, but, use of command specifiers kinda thingy to get what you want in LaTeX seems easy to me.

Now, having been using Emacs for the past few months, what better tool to use for churning out documents with LaTeX than Emacs and AUCTeX combo!

So, this link helped me get Emacs with AUCTeX running without any problem. In case you are not a fan of Emacs, have a look at Gummi. I did my first two assignments with it and it was damn simple to use. No clutter, simple and you see the preview on the side as you type. And in case you would like to use external packages for LaTeX in gummi, refer the below link.

I have also been using Mutt as my mail client for a while. Not having to use the mouse really makes working with stuff faster, be it Emacs or Mutt. These two links should make setting up Mutt easier for anybody.

Command line for the win!!!!!!! And thanks to both of the guys and Pamela Toman for their informative articles.


I started using Emacs a while back and can’t believe how I worked without it in gedit. One can customise Emacs anyway one likes. Here is my .emacs file which enables gtags mode for C files, indentation for C source files, named sessions saving/naming, automatic brace pairings, maximise on opening emacs and changing frames with shift and arrow keys. Do note that nothing in the below .emacs file is my work, it has all been collected from different places on the internet.

Most helpful has been:

;; 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.
["#212526" "#ff4b4b" "#b4fa70" "#fce94f" "#729fcf" "#e090d7" "#8cc4ff" "#eeeeec"])
'(custom-enabled-themes (quote (deeper-blue)))
'(inhibit-startup-screen t))
;; 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.

(when (>= emacs-major-version 24)
  (require 'package)
  (add-to-list 'package-archives '("melpa" . "") t)

(add-hook 'c-mode-hook 'ggtags-mode)

(desktop-save-mode 1)

(require 'cl)

(setq-default c-basic-offset 4 c-default-style "linux")
(setq-default tab-width 4 indent-tabs-mode t)

(require 'autopair)

 '(initial-frame-alist (quote ((fullscreen . maximized)))))

(global-auto-revert-mode t)


(setq windmove-wrap-around t)

(add-to-list 'load-path "~/.emacs.d/lisp/")

(require 'sr-speedbar)

(defun c-lineup-arglist-tabs-only (ignored)
 "Line up argument lists by tabs, not spaces"
 (let* ((anchor (c-langelem-pos c-syntactic-element))
   (column (c-langelem-2nd-pos c-syntactic-element))
   (offset (- (1+ column) anchor))
   (steps (floor offset c-basic-offset)))
  (* (max steps 1)

(add-hook 'c-mode-common-hook
          (lambda ()
          ;; Add kernel style
           '("linux" (c-offsets-alist

(add-hook 'c-mode-hook
          (lambda ()
            (let ((filename (buffer-file-name)))
            ;; Enable kernel mode for the appropriate files
            (when (and filename
                       (string-match (expand-file-name "~/src/linux-trees")
             (setq indent-tabs-mode t)
             (c-set-style "linux-tabs-only")))))

(require 'desktop)

(defvar my-desktop-session-dir
 (concat (getenv "HOME") "/.emacs.d/desktop-sessions/")
 "*Directory to save desktop sessions in")

(defvar my-desktop-session-name-hist nil
 "Desktop session name history")

(defun my-desktop-save (&optional name)
 "Save desktop by name."
 (unless name
   (setq name (my-desktop-get-session-name "Save session" t)))
 (when name
   (make-directory (concat my-desktop-session-dir name) t)
   (desktop-save (concat my-desktop-session-dir name) t)))

(defun my-desktop-save-and-clear ()
  "Save and clear desktop."
  (call-interactively 'my-desktop-save)
  (setq desktop-dirname nil))

(defun my-desktop-read (&optional name)
  "Read desktop by name."
  (unless name
    (setq name (my-desktop-get-session-name "Load session")))
  (when name
    (desktop-read (concat my-desktop-session-dir name))))

(defun my-desktop-change (&optional name)
  "Change desktops by name."
  (let ((name (my-desktop-get-current-name)))
    (when name
      (my-desktop-save name))
    (call-interactively 'my-desktop-read)))

(defun my-desktop-name ()
  "Return the current desktop name."
  (let ((name (my-desktop-get-current-name)))
    (if name
        (message (concat "Desktop name: " name))
      (message "No named desktop loaded"))))

(defun my-desktop-get-current-name ()
  "Get the current desktop name."
  (when desktop-dirname
    (let ((dirname (substring desktop-dirname 0 -1)))
      (when (string= (file-name-directory dirname) my-desktop-session-dir)
        (file-name-nondirectory dirname)))))

(defun my-desktop-get-session-name (prompt &optional use-default)
  "Get a session name."
  (let* ((default (and use-default (my-desktop-get-current-name)))
         (full-prompt (concat prompt (if default
                                         (concat " (default " default "): ")
                                       ": "))))
  (completing-read full-prompt (and (file-exists-p my-desktop-session-dir)
                                    (directory-files my-desktop-session-dir))
                   nil nil nil my-desktop-session-name-hist default)))

(defun my-desktop-kill-emacs-hook ()
  "Save desktop before killing emacs."
  (when (file-exists-p (concat my-desktop-session-dir "last-session"))
    (setq desktop-file-modtime
          (nth 5 (file-attributes (desktop-full-file-name (concat my-desktop-session-dir "last-session"))))))
  (my-desktop-save "last-session"))

(add-hook 'kill-emacs-hook 'my-desktop-kill-emacs-hook)