shared / .emacs

(push "~/.emacs.d" load-path)

(require 'thingatpt)
(require 'ipython)
(require 'flymake)
(require 'flymake-cursor)
(require 'mediawiki)
(require 'autopair)

(defvar autopair-modes '(python-mode))
(defun turn-on-autopair-mode () (autopair-mode 1))
(dolist (mode autopair-modes) (add-hook (intern (concat (symbol-name mode) "-hook")) 'turn-on-autopair-mode))


(setq-default indent-tabs-mode nil)
(setq column-number-mode t)
(show-paren-mode t)

(add-to-list 'auto-mode-alist '("\\.org\\'" . org-mode))
(add-to-list 'auto-mode-alist '("\\.pl\\'" . prolog-mode))
(global-set-key "\C-cl" 'org-store-link)
(global-set-key "\C-ca" 'org-agenda)
(global-set-key "\C-cb" 'org-iswitchb)
(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.
 '(background-color "gray5")
 '(browse-url-browser-function (quote browse-url-generic))
 '(browse-url-generic-program "sensible-browser")
 '(font-use-system-font t)
 '(foreground-color "ivory")
 '(inhibit-startup-screen t)
 '(initial-buffer-choice t)
 '(ispell-dictionary "british" t)
 '(org-agenda-files (quote ("~/org.d/"))))

(define-button-type 'apropos-button
  'action 'button-woman
  'follow-link t)

(defun flymake-pyflakes-init ()
  (let* ((temp-file (flymake-init-create-temp-buffer-copy
		     'flymake-create-temp-inplace))
	 (local-file (file-relative-name
		      temp-file
		      (file-name-directory buffer-file-name))))
    (list "pycheck"  (list local-file))))

(add-to-list 'flymake-allowed-file-name-masks
             '("\\.py\\'" flymake-pyflakes-init))

(add-hook 'python-mode-hook
	  (lambda ()
	    (unless (eq buffer-file-name nil)
	      (flymake-mode 1)
	      (local-set-key [f2] 'flymake-goto-prev-error)
	      (local-set-key [f3] 'flymake-goto-next-error))))

(defun woman-at-point ()
  (interactive)
  (message (symbol-name (symbol-at-point)))
  (woman (symbol-name (symbol-at-point))))

(defun button-woman (button)
  (woman (button-label button)))

(defun shell-command-buffer (cmd)
  (let ((map (make-sparse-keymap)))
    (switch-to-buffer (generate-new-buffer cmd))
    (display-buffer (current-buffer))
    (insert (shell-command-to-string cmd))))

(defun shell-apropos-buffer (cmd)
  (interactive "s")
  (message cmd)
  (shell-command-buffer (concat "apropos " cmd))
  (while (> (point) 1)
    (forward-line -1)
    (move-to-column 0)
    (make-text-button
     (point)
     (- (save-excursion
	  (forward-whitespace 1)
	  (point))
	1)
     :type 'apropos-button))
  (goto-char 1)
  (insert "Choose from the available man pages:\n")
  (toggle-read-only 1))


(setq latex-mode-hook 
      '(lambda ()
	 (ispell-minor-mode)))

(defun set-colors-function (frame)
  (select-frame frame)
  (set-background-color "gray5")
  (set-foreground-color "ivory"))

(add-hook 'after-make-frame-functions 'set-colors-function)

(tool-bar-mode nil)
(menu-bar-mode nil)
(scroll-bar-mode nil)

(setq mouse-autoselect-window t)
Tip: Filter by directory path e.g. /media app.js to search for public/media/app.js.
Tip: Use camelCasing e.g. ProjME to search for ProjectModifiedEvent.java.
Tip: Filter by extension type e.g. /repo .js to search for all .js files in the /repo directory.
Tip: Separate your search with spaces e.g. /ssh pom.xml to search for src/ssh/pom.xml.
Tip: Use ↑ and ↓ arrow keys to navigate and return to view the file.
Tip: You can also navigate files with Ctrl+j (next) and Ctrl+k (previous) and view the file with Ctrl+o.
Tip: You can also navigate files with Alt+j (next) and Alt+k (previous) and view the file with Alt+o.