1. Toby Davies
  2. shared


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 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
	 (local-file (file-relative-name
		      (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 ()
  (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)
     (- (save-excursion
	  (forward-whitespace 1)
     :type 'apropos-button))
  (goto-char 1)
  (insert "Choose from the available man pages:\n")
  (toggle-read-only 1))

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

(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)

(setq mouse-autoselect-window t)