Skip to content

Instantly share code, notes, and snippets.

@ibrow
Created October 25, 2010 11:39
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save ibrow/644822 to your computer and use it in GitHub Desktop.
Save ibrow/644822 to your computer and use it in GitHub Desktop.
My .emacs file
(add-to-list 'load-path "~/bin/emacs")
(setq-default indent-tabs-mode nil)
(setq standard-indent 4)
(setq tab-width 4)
(setq c-default-style "k&r" c-basic-offset 4)
; SUP email
(autoload 'post-mode "post.elc" "post-mode." t)
(add-to-list 'auto-mode-alist '("sup\\.\\(compose\\|forward\\|reply\\|resume\\)-mode$" . post-mode))
(add-hook 'post-mode-hook 'turn-on-flyspell)
; iSpell key bindings
(global-set-key [f5] 'ispell-buffer)
(global-set-key [f6] 'ispell-word)
; iMenu key binding
(global-set-key [ctrl-,] 'ispell-word)
;(autoload 'php-mode "php-mode.el" "Php mode." t)
;(setq auto-mode-alist (append '(("/*.\.php[345]?$" . php-mode)) auto-mode-alist))
; Colour Themes
(require 'color-theme)
(color-theme-initialize)
(color-theme-calm-forest)
;; Font Size
(set-face-attribute 'default nil :height 100)
; F3 to insert filename
; from http://stackoverflow.com/questions/455345/in-emacs-how-to-insert-file-name-in-shell-command
(define-key minibuffer-local-map [f3]
(lambda() (interactive) (insert (buffer-file-name (nth 1 (buffer-list))))))
; Hippie Expand to tab
(global-set-key [C-tab] 'hippie-expand)
;; Auto Complete
(require 'auto-complete-config)
(add-to-list 'ac-dictionary-directories "~/bin/emacs/ac-dict")
(ac-config-default)
(global-auto-complete-mode t)
(define-key ac-complete-mode-map "\t" 'ac-expand)
(define-key ac-complete-mode-map "\r" 'ac-complete)
(define-key ac-complete-mode-map "\M-n" 'ac-next)
(define-key ac-complete-mode-map "\M-p" 'ac-previous)
;;************************************************************
;; configure HTML editing
;;************************************************************
;;
;; (load "javascript")
(autoload 'espresso-mode "espresso" "Start espresso-mode" t)
(add-to-list 'auto-mode-alist '("\\.js$" . espresso-mode))
(add-to-list 'auto-mode-alist '("\\.json$" . espresso-mode))
(require 'php-mode)
;; Flymake for PHP
(require 'flymake)
(add-hook 'php-mode-hook (lambda() (flymake-mode 1)))
(define-key php-mode-map '[M-S-up] 'flymake-goto-prev-error)
(define-key php-mode-map '[M-S-down] 'flymake-goto-next-error)
;; configure css-mode
(autoload 'css-mode "css-mode")
(add-to-list 'auto-mode-alist '("\\.css\\'" . css-mode))
(setq cssm-indent-function #'cssm-c-style-indenter)
(setq cssm-indent-level '4)
(add-hook 'php-mode-user-hook 'turn-on-font-lock)
(require 'mmm-mode)
(setq mmm-global-mode 'maybe)
;; set up an mmm group for fancy html editing
(mmm-add-group
'fancy-html
'(
(html-php-tagged
:submode php-mode
:face mmm-code-submode-face
:front "<[?]php"
:back "[?]>")
(html-css-attribute
:submode css-mode
:face mmm-declaration-submode-face
:front "styleREMOVEME=\""
:back "\"")))
;; What files to invoke the new html-mode for?
(add-to-list 'auto-mode-alist '("\\.inc\\'" . html-mode))
(add-to-list 'auto-mode-alist '("\\.phtml\\'" . html-mode))
;(add-to-list 'auto-mode-alist '("\\.php[34]?\\'" . html-mode))
(add-to-list 'auto-mode-alist '("\\.[sj]?html?\\'" . html-mode))
(add-to-list 'auto-mode-alist '("\\.jsp\\'" . html-mode))
;; What features should be turned on in this html-mode?
(add-to-list 'mmm-mode-ext-classes-alist '(html-mode nil html-js))
(add-to-list 'mmm-mode-ext-classes-alist '(html-mode nil embedded-css))
(add-to-list 'mmm-mode-ext-classes-alist '(html-mode nil fancy-html))
;; Not exactly related to editing HTML: enable editing help with mouse-3 in all sgml files
(defun go-bind-markup-menu-to-mouse3 ()
(define-key sgml-mode-map [(down-mouse-3)] 'sgml-tags-menu))
(add-hook 'sgml-mode-hook 'go-bind-markup-menu-to-mouse3)
;; clear background for PHP
(set-face-background 'mmm-default-submode-face nil)
(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.
'(php-file-patterns nil))
(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.
)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment