archan’s emacs 20022014

February 20, 2014

;; emacs 18022014 arp@archan.org

;; add package repository and install missing packages
(require 'package)
(setq package-archives '(("melpa" . "http://melpa.milkbox.net/packages/")))
(setq package-list '(autopair dart-mode flymake-cursor flymake-google-cpplint flymake-python-pyflakes flymake-easy google-c-style jedi-direx direx jedi auto-complete epc ctable concurrent deferred pony-mode popup web-mode))
;; find : C-h v package-activated-list
(package-initialize)
(when (not package-archive-contents)
  (package-refresh-contents))
(dolist (package package-list)
  (when (not (package-installed-p package))
    (package-install package)))

;; default customization
(custom-set-variables
 '(inhibit-splash-screen t)
 '(inhibit-startup-message t)
 '(tool-bar-mode nil)
 '(column-number-mode t)
 '(cua-mode 1 nil (cua-base))
 '(global-font-lock-mode 1)
 '(global-linum-mode t)
 '(ido-mode t nil (ido))
 '(make-backup-files nil)
 '(show-paren-mode t)
 )

;; set all windows (emacs's “frames”) to some defaults
(setq initial-frame-alist '((width . 100) (height . 54)))
(setq default-frame-alist
      '((menu-bar-lines . 1)
        (left-fringe)
        (right-fringe)
        (tool-bar-lines . 0)
        (width . 100)
        (height . 52)
        ))
(set-frame-parameter nil 'font "Dejavu Sans Mono-9")
(global-hl-line-mode 1)
;(load-theme 'misterioso)
(set-face-background 'highlight "white smoke")

;; Prevent accidentally killing emacs.
(global-set-key [(control x) (control c)]
  '(lambda ()
     (interactive)
     (if (y-or-n-p-with-timeout "Exit Emacs ? " 4 nil)
         (save-buffers-kill-emacs))))

;; enable autopairing
(require 'autopair)
(autopair-global-mode)
(setq autopair-autowrap t)

;; custom key-bindings
(define-key global-map (kbd "RET") 'newline-and-indent)
(global-set-key "\M-l" 'goto-line)
(global-set-key (kbd "<f2>") 'save-buffer)
(global-set-key (kbd "<f10>") 'switch-to-buffer)
(global-set-key (kbd "<f11>") 'next-buffer)
(global-set-key (kbd "<f12>") 'prev-window)
(defun prev-window ()
   (interactive)
   (other-window -1))

;; text-mode hooks
(add-hook 'text-mode-hook 'text-file-handle)
(defun text-file-handle()
  (turn-on-auto-fill)
  (set-fill-column 80)
  (setq indent-tabs-mode nil )
  (setq tab-width 4 )
  )

;; python-mode hooks
(require 'python-mode)
(add-to-list 'auto-mode-alist '("\\.py\\'" . python-mode))
(add-hook 'python-mode-hook 'python-file-handle)
(defun python-file-handle()
  ; remove whitespaces
  (add-hook 'before-save-hook 'delete-trailing-whitespace)
  ; python indentation
  (setq indent-tabs-mode t)
  (setq tab-width (default-value 'tab-width))
  )
; flymake-python-pyflakes
(require 'flymake-python-pyflakes)
(add-hook 'python-mode-hook 'flymake-python-pyflakes-load)
(setq flymake-python-pyflakes-executable "flake8")
; python-jedi auto-complete
(require 'jedi)
(add-hook 'python-mode-hook 'jedi:setup)
(setq jedi:setup-keys t)
(setq jedi:complete-on-dot t)
; flymake faces
(custom-set-faces
 '(flymake-errline ((((class color)) (:background "ivory1"))))
 '(flymake-warnline ((((class color)) (:background "ivory2")))))

;; dart-mode hooks
(require 'dart-mode)
(add-to-list 'auto-mode-alist '("\\.dart\\'" . dart-mode))
(add-hook 'dart-mode-hook 'dart-file-handle)
(defun python-file-handle()
  )

Advertisements

One Response to “archan’s emacs 20022014”


  1. BEING THAT I’M A REGULAR THERE AND OWN MY OWN MUG THAT’D BE AWESOME Click https://twitter.com/moooker1


Leave a Reply

Please log in using one of these methods to post your comment:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: