emacs-config/init.el

121 lines
5.3 KiB
EmacsLisp
Raw Normal View History

2012-11-21 23:46:21 +00:00
;; Generic Emacs stuff
(add-to-list 'load-path "~/.emacs.d/modes/")
(add-to-list 'load-path "~/.emacs.d/misc/")
(show-paren-mode 1)
2013-02-22 14:16:16 +00:00
;; multi-term
;;(require 'multi-term)
;;(setq multi-term-program "/bin/bash")
2013-02-22 14:16:16 +00:00
;; CSS Mode needs to be applied to scss files.
(add-to-list 'auto-mode-alist '("\\.scss" . css-mode))
(setq-default css-indent-offset 2)
2012-11-21 23:46:21 +00:00
;; Always use spaces instead of tabs, a tab is 4 spaces by default
(setq-default tab-always-indent t)
2012-11-21 23:46:21 +00:00
(setq-default indent-tabs-mode nil)
(setq-default tab-width 4)
(setq-default tab-stop-list (number-sequence 4 120 4))
(setq-default tab-always-indent 'complete)
2012-11-21 23:46:21 +00:00
;; WhiteSpace hilighting
(require 'whitespace)
(setq whitespace-style (quote (face trailing tabs tab-mark empty lines-tail)))
(setq-default whitespace-line-column 80)
(global-whitespace-mode 1)
;; Markdown http://jblevins.org/projects/markdown-mode/markdown-mode.el
(autoload 'markdown-mode "markdown-mode"
"Major mode for editing Markdown files" t)
(add-to-list 'auto-mode-alist '("\\.text\\'" . markdown-mode))
(add-to-list 'auto-mode-alist '("\\.markdown\\'" . markdown-mode))
(add-to-list 'auto-mode-alist '("\\.md\\'" . markdown-mode))
(add-to-list 'auto-mode-alist '("\\.mdwn\\'" . markdown-mode))
;; C, use k&r style by default (naev)
(setq-default c-default-style "k&r"
c-basic-offset 3)
;; Kivy (ref:https://github.com/kivy/kivy/blob/master/kivy/tools/highlight/kivy-mode.el)
(require 'kivy-mode)
(add-to-list 'auto-mode-alist '("\\.kv$" . kivy-mode))
2012-11-21 23:46:21 +00:00
;; Python!
;; Prevent ropemacs from overriding emacs shortcuts
;;(setq ropemacs-enable-shortcuts nil)
;;(setq ropemacs-local-prefix "C-c C-p")
;; Load of a bunch of stuff for pymacs : http://pymacs.progiciels-bpi.ca/pymacs.html#installation
;;(autoload 'pymacs-apply "pymacs")
;;(autoload 'pymacs-call "pymacs")
;;(autoload 'pymacs-eval "pymacs" nil t)
;;(autoload 'pymacs-exec "pymacs" nil t)
;;(autoload 'pymacs-load "pymacs" nil t)
;;(autoload 'pymacs-autoload "pymacs")
;;(eval-after-load "pymacs"
;; '(add-to-list 'pymacs-load-path YOUR-PYMACS-DIRECTORY"))
;;(require 'pymacs)
;; Load ropemacs
;;(pymacs-load "ropemacs" "rope-")
;; SCSS
;;(autoload 'scss-mode "scss-mode")
;;(add-to-list 'auto-mode-alist '("\\.scss\\'" . scss-mode))
;;(setq-default scss-compile-at-save nil)
2012-11-21 23:46:21 +00:00
;; PHP and Drupal-Modes
;; http://stackoverflow.com/questions/898063/making-php-mode-and-other-cc-mode-derived-modes-compatible-with-emacs-23
;; Use autoload for php-mode and drupal-mode to avoid occasionaly errors on some
;; systems when loading from init. See the above question on stack overflow
(autoload 'php-mode "php-mode" "Major mode for editing php code." t)
(autoload 'drupal-mode "drupal-mode" "Major mode for editing drupal php files." t)
;(require 'php-mode)
;(require 'drupal-mode)
2012-11-21 23:46:21 +00:00
(add-to-list 'auto-mode-alist '("\\.\\(module\\|test\\|install\\|theme\\)$" . drupal-mode))
(add-to-list 'auto-mode-alist '("\\.\\(php\\|inc\\)$" . php-mode))
(add-to-list 'auto-mode-alist '("\\.info" . conf-windows-mode))
(defun my-php-hook-function ()
(set (make-local-variable 'compile-command) (format "phpcs --report=emacs --standard=PEAR %s" (buffer-file-name))))
2012-11-21 23:46:21 +00:00
(add-hook 'php-mode-hook 'my-php-hook-function)
(defun my-drupal-hook-function ()
(set (make-local-variable 'compile-command) (format "phpcs --report=emacs --extensions=php,module,inc,install,test,profile,theme --standard=Drupal %s" (buffer-file-name))))
2012-11-21 23:46:21 +00:00
(add-hook 'drupal-mode-hook 'my-drupal-hook-function)
(autoload 'js2-mode "js2-mode" nil t)
(add-to-list 'auto-mode-alist '("\\.js$" . js2-mode))
;; Synax checking for PHP with flymake
;; http://sachachua.com/blog/2008/07/emacs-and-php-on-the-fly-syntax-checking-with-flymake/
;; https://github.com/illusori/emacs-flymake
;; http://www.emacswiki.org/emacs/FlyMake
(require 'flymake)
(defun flymake-php-init ()
"Use php to check the syntax of the current file."
(let* ((temp (flymake-init-create-temp-buffer-copy 'flymake-create-temp-inplace))
(local (file-relative-name temp (file-name-directory buffer-file-name))))
(list "php" (list "-f" local "-l"))))
(add-to-list 'flymake-err-line-patterns
'("\\(Parse\\|Fatal\\) error: +\\(.*?\\) in \\(.*?\\) on line \\([0-9]+\\)$" 3 4 nil 2))
(add-to-list 'flymake-allowed-file-name-masks '("\\.php$" flymake-php-init))
;; Drupal-type extensions
(add-to-list 'flymake-allowed-file-name-masks
'("\\.\\(inc\\|module\\|test\\|install\\|theme\\)$"
flymake-php-init))
(add-hook 'php-mode-hook (lambda () (flymake-mode 1)))
(add-hook 'php-mode-hook (lambda ()
(define-key php-mode-map '[M-S-up]
'flymake-goto-prev-error)))
(add-hook 'php-mode-hook (lambda ()
(define-key php-mode-map '[M-S-down]
'flymake-goto-next-error)))
(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.
)
(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.
'(flymake-errline ((((class color) (background light)) (:background "magenta" :foreground "red")))))