My .emacs file
Here is my .emacs file.
;;All the "plugins" are kept in this folder except the ones that are split over more than 1 .el file.
(add-to-list 'load-path "~/LispDev/")
;;Set the default font
(set-default-font "9x15")
;;Set scroll bar to appear on the right
(setq scroll-bar-mode-explicit t)
(set-scroll-bar-mode 'right)
;;Uniquify buffer names: Append path if buffer names are identical
(require 'uniquify)
(setq uniquify-buffer-name-style 'post-forward-angle-brackets)
;;Specify modes for Lisp file extensions so that we can turn on syntax
;;highlighting for Lisp files with non-standard extensions
(setq auto-mode-alist
(append '(("\.lisp$" . lisp-mode)
("\.lsp$" . lisp-mode)
("\.cl$" . lisp-mode)
("\.asd$" . lisp-mode)
("\.system$" . lisp-mode)) auto-mode-alist))
;;There are 2 ways to interact with Lisp from within Emacs.
;;The first one uses the ACL ELI (Emacs Lisp Interaction) provided by Allegro.
;;The second one, that I prefer to use, is SLIME (Superior Lisp Interaction Mode for Emacs)
;;I have commented out ELI and kept SLIME. You can keep both if you prefer.
;;Begin ELI
;; ACL ELI stuff that is to be ignored, for now.
;; ;; Setting up the ACL ELI (Allegro Common Lisp's Emacs Lisp Interface)
;; (load "/usr/local/acl81/eli/fi-site-init")
;; ;; These are the inputs to the run-common-lisp function
;; (setq fi:common-lisp-image-name "/usr/local/acl81/mlisp")
;; (setq fi:common-lisp-host "localhost")
;; (setq fi:common-lisp-directory "~/")
;; ;; This function starts up lisp with your defaults.
;; (defun run-common-lisp ()
;; (interactive)
;; (fi:common-lisp fi:common-lisp-buffer-name
;; fi:common-lisp-directory
;; fi:common-lisp-image-name
;; fi:common-lisp-image-arguments
;; fi:common-lisp-host
;; fi:common-lisp-image-file))
;; ;; Pressing C-x-4-l will start up ACL from within Emacs
;; ;; Set up a keybinding for `run-common-lisp':
;; (progn
;; (setq ctlx-4-map (make-keymap))
;; (define-key ctl-x-map "4" ctlx-4-map)
;; (define-key ctlx-4-map "l" 'run-common-lisp))
;; To auto-run the ELI when starting Emacs
;;(run-common-lisp)
;;End ELI
;;Begin SLIME
;;Update this path to the correct location.
(add-to-list 'load-path "~/LispDev/slime/")
(require 'slime-autoloads)
;;Disable the SLIME startup animation.
(setq slime-startup-animation nil)
(eval-after-load "slime"
'(progn
(add-to-list 'load-path "~/LispDev/slime/contrib/")
(slime-setup '(slime-fancy slime-banner slime-presentations slime-tramp slime-asdf))
(setq slime-complete-symbol*-fancy t)
(setq slime-complete-symbol-function 'slime-fuzzy-complete-symbol)))
;;Specify the Lisp program you are using. Default is "lisp"
;;If the Allegro directory is not in your PATH environment variable
;;this should be a fully qualified path.
;;choose one of the below based on Express or non-Express usage
;;(setq inferior-lisp-program "alisp")
(setq inferior-lisp-program "/usr/local/acl81/mlisp")
;;To use the ELisp indentation while programming in CL.
(load "cl-indent")
(put 'if 'common-lisp-indent-function '(nil nil &body))
;;End SLIME
;;Download and extract the HyperSpec at a given location.
;;You can get the documentation from Habib or from here:
;;ftp://ftp.lispworks.com/pub/software_tools/reference/HyperSpec-7-0.tar.gz
;;Use the following code to point to the given location.
;;That way if you work offline, you can still access the HyperSpec.
(setq common-lisp-hyperspec-root "~/LispDev/docs/HyperSpec/")
(setq common-lisp-hyperspec-symbol-table (concat common-lisp-hyperspec-root "Data/Map_Sym.txt"))
;;Download and extract CLtL2 at a given location.
;;It is available in the FTP.
;;Use the following code to point to the given location.
;;That way if you work offline, you can still access CLtL2
(setq cltl2-url "file:///home/habib/LispDev/docs/cltl/clm/node1.html")
;;Add the URL and ACLDOC paths to see the ACL documentation in a new browser window
;;If you are using Emacs 22 and above, no need for the following line. It is only needed in Emacs 21.x
(add-to-list 'load-path "~/LispDev/url/")
(require 'url)
(require 'acldoc)
;;The location of ACL docs
(setq acldoc-local-root "/usr/local/acl81")
(setq acldoc-use-local t)
;;Press C-F1 with the cursor on a symbol and then press Enter to get the ACL docs for the given symbol.
;;Or you can type M-x acldoc with the point on the chosen symbol.
(define-key lisp-mode-map (kbd "C-c a") 'acldoc)
;;By default, the Enter key will just take you to a new-line.
;;After that you have to press Tab to get the correct indentation.
;;Add a hook that will redefine the Enter key to be 'newline-and-indent.
;;That way you don't have to press Tab at the beginning of every line.
(add-hook 'lisp-mode-hook
'(lambda ()
(define-key lisp-mode-map [?\C-m] 'newline-and-indent)
(define-key lisp-mode-map [?\C-j] 'newline)))
(custom-set-variables
;;custom-set-variables was added by Custom -- don't edit or cut/paste it!
;;Your init file should contain only one such instance.
'(auto-compression-mode t nil (jka-compr))
'(blink-matching-paren-on-screen t)
'(case-fold-search t)
'(case-mode "case-insensitive-lower")
'(compilation-mode-hook nil t)
'(current-language-environment "English")
'(debug-on-error t)
'(default-input-method "rfc1345")
'(easy-menu-precalculate-equivalent-keybindings t)
'(global-font-lock-mode t nil (font-lock))
'(save-place t nil (saveplace))
'(show-paren-mode t nil (paren))
'(show-paren-style (quote mixed))
'(text-mode-hook (quote (turn-on-auto-fill text-mode-hook-identify)))
'(transient-mark-mode t))
;;My chosen background is black and chosen text colour is white. You can change that here:
(custom-set-faces
;;custom-set-faces was added by Custom -- don't edit or cut/paste it!
;;Your init file should contain only one such instance.
'(default ((t (:stipple nil
;;:background "black"
:background "gray10"
:foreground "white"
:inverse-video nil
:box nil
:strike-through nil
:overline nil
:underline nil
:slant normal
:weight normal
:width normal))))
'(show-paren-match-face ((((class color)) (:bold t :background "red")))))
(put 'downcase-region 'disabled nil)
(setq standard-indent 2)
(mouse-wheel-mode t)
;;Show line-number in the mode line
(line-number-mode 1)
;;Show column-number in the mode line
(column-number-mode 1)
;;Disables the starting 'splash' screen of Emacs
(setq inhibit-startup-message t)
(setq font-lock-maximum-decoration t)
;;Begin Tabbar
;;Tabbar will show tabs in Emacs allowing you to click and goto a particular tab. Quite useful!
(require 'tabbar)
(tabbar-mode 1)
(global-set-key [(control shift up)] 'tabbar-backward-group)
(global-set-key [(control shift down)] 'tabbar-forward-group)
(global-set-key [(control shift left)] 'tabbar-backward)
(global-set-key [(control shift right)] 'tabbar-forward)
(set-face-attribute
'tabbar-default-face nil
:background "gray60")
(set-face-attribute
'tabbar-unselected-face nil
:background "gray85"
:foreground "gray30"
:box t)
(set-face-attribute
'tabbar-selected-face nil
:background "white"
:foreground "black"
:box nil)
(set-face-attribute
'tabbar-button-face nil
:box '(:line-width 8 :color "gray72" :style released-button))
(set-face-attribute
'tabbar-separator-face nil
:height 0.7)
(defun tabbar-buffer-groups (buffer)
"Return the list of group names BUFFER belongs to.
Return only one group for each buffer."
(with-current-buffer (get-buffer buffer)
(cond
((or (get-buffer-process (current-buffer))
(memq major-mode
'(comint-mode compilation-mode)))
'("Misc")
)
((member (buffer-name)
'("*scratch*"))
'("Main")
)
((member (buffer-name)
'("*Messages*"))
'("Misc")
)
((eq major-mode 'dired-mode)
'("Main")
)
((memq major-mode
'(fundamental-mode help-mode apropos-mode Info-mode Man-mode))
'("Misc")
)
((memq major-mode
'(tex-mode latex-mode text-mode xml-mode))
'("Main")
)
((memq major-mode
'(rmail-mode
rmail-edit-mode vm-summary-mode vm-mode mail-mode
mh-letter-mode mh-show-mode mh-folder-mode
gnus-summary-mode message-mode gnus-group-mode
gnus-article-mode score-mode gnus-browse-killed-mode))
'("Mail")
)
((memq major-mode
'(html-mode))
'("HTML")
)
(t
'("Main")
)
)))
;;End Tabbar
;;Begin Tramp
;;Tramp allows you to access a remote file from within your Emacs over a secure SSH link.
;;Download and install tramp if you are using Emacs 21.4. I think it's already present in Emacs 22 and above.
;;(require 'tramp)
;;(setq tramp-default-method "ssh")
;;End Tramp
;;hl-sexp-mode highlights the s-expression containing point.
(require 'hl-sexp)
(autoload 'hl-sexp-mode "hl-sexp"
"Minor mode to highlight s-expression at point."
t)
(require 'mic-paren)
(paren-activate)
;;Begin Paredit
;;Paredit will turn Emacs into a "structured text editor". You manipulate s-expressions, and not lines of text.
;;It also keeps all your parentheses nicely balanced.
;;Install paredit by placing `paredit.el' in `/path/to/elisp', a
;;directory of your choice, and adding to your .emacs file:
(require 'paredit)
(autoload 'paredit-mode "paredit"
"Minor mode for pseudo-structurally editing Lisp code."
t)
;;Toggle Paredit Mode with `M-x paredit-mode', or enable it
;;always in a major mode `M' (e.g., 'lisp' or 'scheme') with along with others:
(mapc (lambda (mode)
(let ((hook (intern (concat (symbol-name mode)
"-mode-hook"))))
(add-hook hook (lambda ()
(paredit-mode +1)
(paren-toggle-matching-quoted-paren 1)
(paren-toggle-matching-paired-delimiter 1)
(hl-sexp-mode +1)))))
'(emacs-lisp lisp inferior-lisp slime slime-repl repl))
;;End Paredit
;;Begin lispdoc search engine
(defun lispdoc ()
"Searches lispdoc.com for SYMBOL, which is by default the symbol
currently under the cursor"
(interactive)
(let* ((word-at-point (word-at-point))
(symbol-at-point (symbol-at-point))
(default (symbol-name symbol-at-point))
(inp (read-from-minibuffer
(if (or word-at-point symbol-at-point)
(concat "Symbol (default " default "): ")
"Symbol (no default): "))))
(if (and (string= inp "") (not word-at-point) (not
symbol-at-point))
(message "you didn't enter a symbol!")
(let ((search-type (read-from-minibuffer
"full-text (f) or basic (b) search (default b)? ")))
(browse-url (concat "http://lispdoc.com?q="
(if (string= inp "")
default
inp)
"&search="
(if (string-equal search-type "f")
"full+text+search"
"basic+search")))))))
;;Key-binding to search lispdoc.com for the given symbol at point.
(define-key lisp-mode-map (kbd "C-c l") 'lispdoc)
;;End lispdoc search engine
;;Will highlight the current line for you
;;(global-hl-line-mode 1)
;;Autostart Slime
;;(slime)
;;(add-to-list 'load-path "~/LispDev/color-theme-6.6.0/")
;;(require 'color-theme)
;;(color-theme-initialize)
;;(color-theme-gnome2)
(add-to-list 'load-path "~/LispDev/")
;;Set the default font
(set-default-font "9x15")
;;Set scroll bar to appear on the right
(setq scroll-bar-mode-explicit t)
(set-scroll-bar-mode 'right)
;;Uniquify buffer names: Append path if buffer names are identical
(require 'uniquify)
(setq uniquify-buffer-name-style 'post-forward-angle-brackets)
;;Specify modes for Lisp file extensions so that we can turn on syntax
;;highlighting for Lisp files with non-standard extensions
(setq auto-mode-alist
(append '(("\.lisp$" . lisp-mode)
("\.lsp$" . lisp-mode)
("\.cl$" . lisp-mode)
("\.asd$" . lisp-mode)
("\.system$" . lisp-mode)) auto-mode-alist))
;;There are 2 ways to interact with Lisp from within Emacs.
;;The first one uses the ACL ELI (Emacs Lisp Interaction) provided by Allegro.
;;The second one, that I prefer to use, is SLIME (Superior Lisp Interaction Mode for Emacs)
;;I have commented out ELI and kept SLIME. You can keep both if you prefer.
;;Begin ELI
;; ACL ELI stuff that is to be ignored, for now.
;; ;; Setting up the ACL ELI (Allegro Common Lisp's Emacs Lisp Interface)
;; (load "/usr/local/acl81/eli/fi-site-init")
;; ;; These are the inputs to the run-common-lisp function
;; (setq fi:common-lisp-image-name "/usr/local/acl81/mlisp")
;; (setq fi:common-lisp-host "localhost")
;; (setq fi:common-lisp-directory "~/")
;; ;; This function starts up lisp with your defaults.
;; (defun run-common-lisp ()
;; (interactive)
;; (fi:common-lisp fi:common-lisp-buffer-name
;; fi:common-lisp-directory
;; fi:common-lisp-image-name
;; fi:common-lisp-image-arguments
;; fi:common-lisp-host
;; fi:common-lisp-image-file))
;; ;; Pressing C-x-4-l will start up ACL from within Emacs
;; ;; Set up a keybinding for `run-common-lisp':
;; (progn
;; (setq ctlx-4-map (make-keymap))
;; (define-key ctl-x-map "4" ctlx-4-map)
;; (define-key ctlx-4-map "l" 'run-common-lisp))
;; To auto-run the ELI when starting Emacs
;;(run-common-lisp)
;;End ELI
;;Begin SLIME
;;Update this path to the correct location.
(add-to-list 'load-path "~/LispDev/slime/")
(require 'slime-autoloads)
;;Disable the SLIME startup animation.
(setq slime-startup-animation nil)
(eval-after-load "slime"
'(progn
(add-to-list 'load-path "~/LispDev/slime/contrib/")
(slime-setup '(slime-fancy slime-banner slime-presentations slime-tramp slime-asdf))
(setq slime-complete-symbol*-fancy t)
(setq slime-complete-symbol-function 'slime-fuzzy-complete-symbol)))
;;Specify the Lisp program you are using. Default is "lisp"
;;If the Allegro directory is not in your PATH environment variable
;;this should be a fully qualified path.
;;choose one of the below based on Express or non-Express usage
;;(setq inferior-lisp-program "alisp")
(setq inferior-lisp-program "/usr/local/acl81/mlisp")
;;To use the ELisp indentation while programming in CL.
(load "cl-indent")
(put 'if 'common-lisp-indent-function '(nil nil &body))
;;End SLIME
;;Download and extract the HyperSpec at a given location.
;;You can get the documentation from Habib or from here:
;;ftp://ftp.lispworks.com/pub/software_tools/reference/HyperSpec-7-0.tar.gz
;;Use the following code to point to the given location.
;;That way if you work offline, you can still access the HyperSpec.
(setq common-lisp-hyperspec-root "~/LispDev/docs/HyperSpec/")
(setq common-lisp-hyperspec-symbol-table (concat common-lisp-hyperspec-root "Data/Map_Sym.txt"))
;;Download and extract CLtL2 at a given location.
;;It is available in the FTP.
;;Use the following code to point to the given location.
;;That way if you work offline, you can still access CLtL2
(setq cltl2-url "file:///home/habib/LispDev/docs/cltl/clm/node1.html")
;;Add the URL and ACLDOC paths to see the ACL documentation in a new browser window
;;If you are using Emacs 22 and above, no need for the following line. It is only needed in Emacs 21.x
(add-to-list 'load-path "~/LispDev/url/")
(require 'url)
(require 'acldoc)
;;The location of ACL docs
(setq acldoc-local-root "/usr/local/acl81")
(setq acldoc-use-local t)
;;Press C-F1 with the cursor on a symbol and then press Enter to get the ACL docs for the given symbol.
;;Or you can type M-x acldoc with the point on the chosen symbol.
(define-key lisp-mode-map (kbd "C-c a") 'acldoc)
;;By default, the Enter key will just take you to a new-line.
;;After that you have to press Tab to get the correct indentation.
;;Add a hook that will redefine the Enter key to be 'newline-and-indent.
;;That way you don't have to press Tab at the beginning of every line.
(add-hook 'lisp-mode-hook
'(lambda ()
(define-key lisp-mode-map [?\C-m] 'newline-and-indent)
(define-key lisp-mode-map [?\C-j] 'newline)))
(custom-set-variables
;;custom-set-variables was added by Custom -- don't edit or cut/paste it!
;;Your init file should contain only one such instance.
'(auto-compression-mode t nil (jka-compr))
'(blink-matching-paren-on-screen t)
'(case-fold-search t)
'(case-mode "case-insensitive-lower")
'(compilation-mode-hook nil t)
'(current-language-environment "English")
'(debug-on-error t)
'(default-input-method "rfc1345")
'(easy-menu-precalculate-equivalent-keybindings t)
'(global-font-lock-mode t nil (font-lock))
'(save-place t nil (saveplace))
'(show-paren-mode t nil (paren))
'(show-paren-style (quote mixed))
'(text-mode-hook (quote (turn-on-auto-fill text-mode-hook-identify)))
'(transient-mark-mode t))
;;My chosen background is black and chosen text colour is white. You can change that here:
(custom-set-faces
;;custom-set-faces was added by Custom -- don't edit or cut/paste it!
;;Your init file should contain only one such instance.
'(default ((t (:stipple nil
;;:background "black"
:background "gray10"
:foreground "white"
:inverse-video nil
:box nil
:strike-through nil
:overline nil
:underline nil
:slant normal
:weight normal
:width normal))))
'(show-paren-match-face ((((class color)) (:bold t :background "red")))))
(put 'downcase-region 'disabled nil)
(setq standard-indent 2)
(mouse-wheel-mode t)
;;Show line-number in the mode line
(line-number-mode 1)
;;Show column-number in the mode line
(column-number-mode 1)
;;Disables the starting 'splash' screen of Emacs
(setq inhibit-startup-message t)
(setq font-lock-maximum-decoration t)
;;Begin Tabbar
;;Tabbar will show tabs in Emacs allowing you to click and goto a particular tab. Quite useful!
(require 'tabbar)
(tabbar-mode 1)
(global-set-key [(control shift up)] 'tabbar-backward-group)
(global-set-key [(control shift down)] 'tabbar-forward-group)
(global-set-key [(control shift left)] 'tabbar-backward)
(global-set-key [(control shift right)] 'tabbar-forward)
(set-face-attribute
'tabbar-default-face nil
:background "gray60")
(set-face-attribute
'tabbar-unselected-face nil
:background "gray85"
:foreground "gray30"
:box t)
(set-face-attribute
'tabbar-selected-face nil
:background "white"
:foreground "black"
:box nil)
(set-face-attribute
'tabbar-button-face nil
:box '(:line-width 8 :color "gray72" :style released-button))
(set-face-attribute
'tabbar-separator-face nil
:height 0.7)
(defun tabbar-buffer-groups (buffer)
"Return the list of group names BUFFER belongs to.
Return only one group for each buffer."
(with-current-buffer (get-buffer buffer)
(cond
((or (get-buffer-process (current-buffer))
(memq major-mode
'(comint-mode compilation-mode)))
'("Misc")
)
((member (buffer-name)
'("*scratch*"))
'("Main")
)
((member (buffer-name)
'("*Messages*"))
'("Misc")
)
((eq major-mode 'dired-mode)
'("Main")
)
((memq major-mode
'(fundamental-mode help-mode apropos-mode Info-mode Man-mode))
'("Misc")
)
((memq major-mode
'(tex-mode latex-mode text-mode xml-mode))
'("Main")
)
((memq major-mode
'(rmail-mode
rmail-edit-mode vm-summary-mode vm-mode mail-mode
mh-letter-mode mh-show-mode mh-folder-mode
gnus-summary-mode message-mode gnus-group-mode
gnus-article-mode score-mode gnus-browse-killed-mode))
'("Mail")
)
((memq major-mode
'(html-mode))
'("HTML")
)
(t
'("Main")
)
)))
;;End Tabbar
;;Begin Tramp
;;Tramp allows you to access a remote file from within your Emacs over a secure SSH link.
;;Download and install tramp if you are using Emacs 21.4. I think it's already present in Emacs 22 and above.
;;(require 'tramp)
;;(setq tramp-default-method "ssh")
;;End Tramp
;;hl-sexp-mode highlights the s-expression containing point.
(require 'hl-sexp)
(autoload 'hl-sexp-mode "hl-sexp"
"Minor mode to highlight s-expression at point."
t)
(require 'mic-paren)
(paren-activate)
;;Begin Paredit
;;Paredit will turn Emacs into a "structured text editor". You manipulate s-expressions, and not lines of text.
;;It also keeps all your parentheses nicely balanced.
;;Install paredit by placing `paredit.el' in `/path/to/elisp', a
;;directory of your choice, and adding to your .emacs file:
(require 'paredit)
(autoload 'paredit-mode "paredit"
"Minor mode for pseudo-structurally editing Lisp code."
t)
;;Toggle Paredit Mode with `M-x paredit-mode', or enable it
;;always in a major mode `M' (e.g., 'lisp' or 'scheme') with along with others:
(mapc (lambda (mode)
(let ((hook (intern (concat (symbol-name mode)
"-mode-hook"))))
(add-hook hook (lambda ()
(paredit-mode +1)
(paren-toggle-matching-quoted-paren 1)
(paren-toggle-matching-paired-delimiter 1)
(hl-sexp-mode +1)))))
'(emacs-lisp lisp inferior-lisp slime slime-repl repl))
;;End Paredit
;;Begin lispdoc search engine
(defun lispdoc ()
"Searches lispdoc.com for SYMBOL, which is by default the symbol
currently under the cursor"
(interactive)
(let* ((word-at-point (word-at-point))
(symbol-at-point (symbol-at-point))
(default (symbol-name symbol-at-point))
(inp (read-from-minibuffer
(if (or word-at-point symbol-at-point)
(concat "Symbol (default " default "): ")
"Symbol (no default): "))))
(if (and (string= inp "") (not word-at-point) (not
symbol-at-point))
(message "you didn't enter a symbol!")
(let ((search-type (read-from-minibuffer
"full-text (f) or basic (b) search (default b)? ")))
(browse-url (concat "http://lispdoc.com?q="
(if (string= inp "")
default
inp)
"&search="
(if (string-equal search-type "f")
"full+text+search"
"basic+search")))))))
;;Key-binding to search lispdoc.com for the given symbol at point.
(define-key lisp-mode-map (kbd "C-c l") 'lispdoc)
;;End lispdoc search engine
;;Will highlight the current line for you
;;(global-hl-line-mode 1)
;;Autostart Slime
;;(slime)
;;(add-to-list 'load-path "~/LispDev/color-theme-6.6.0/")
;;(require 'color-theme)
;;(color-theme-initialize)
;;(color-theme-gnome2)