Commit 37dbc4ab authored by Duncan Bayne's avatar Duncan Bayne

Split out Emacs config into separate files

parent af08a38b
......@@ -5,6 +5,6 @@ emacs.d/ido.last
emacs.d/recentf
emacs.d/session*
emacs.d/tramp
emacs.d/personal.el
emacs.d/99-personal.el
ido.last
.#tramp
This diff is collapsed.
;;
;; Thanks to:
;; + http://emacswiki.org/emacs/InteractivelyDoThings
;; + http://shreevatsa.wordpress.com/
;; + http://www.emacswiki.org/emacs/EmacsNiftyTricks
;; + http://xahlee.org/emacs/emacs_make_modern.html
;;
(duncans_emacs:add-to-load-path '("~/.emacs.d/ws-trim"))
(require 'flx-ido)
(require 'ido)
(require 'ido-vertical-mode)
(require 'ps-ccrypt)
(column-number-mode 1)
(delete-selection-mode 1)
(global-hl-line-mode 1)
(global-linum-mode 1)
(transient-mark-mode 1)
(setq-default indent-tabs-mode nil)
(setq-default tab-width 2)
(setq indent-line-function 'insert-tab)
(setq semanticdb-default-save-directory "~/.emacs.d/semantic_cache")
(flx-ido-mode 1)
(ido-everywhere 1)
(ido-mode 1)
(ido-vertical-mode 1)
(setq ido-enable-flex-matching t)
(setq ido-use-faces nil)
(setq ido-vertical-define-keys 'C-n-and-C-p-only)
(setq vc-follow-symlinks t)
(global-auto-revert-mode 1)
(defun sudo-edit (&optional arg)
"Edit currently visited file as root. With a prefix ARG prompt for a file to visit. Will also prompt for a file to visit if current buffer is not visiting a file."
(interactive "P")
(if (or arg (not buffer-file-name))
(find-file (concat "/sudo:root@localhost:"
(ido-read-file-name "Find file(as root): ")))
(find-alternate-file (concat "/sudo:root@localhost:" buffer-file-name))))
(global-set-key (kbd "C-x C-r") 'sudo-edit)
(require 'ws-trim)
(global-ws-trim-mode t)
(set-default 'ws-trim-level 2)
(setq ws-trim-global-modes '(guess (not message-mode eshell-mode haml-mode)))
(setq auto-save-default nil)
(setq make-backup-files nil)
(require 'uniquify)
(setq uniquify-buffer-name-style 'reverse)
(load "editorconfig")
(editorconfig-mode 1)
(require 'undo-tree)
(global-undo-tree-mode)
(global-set-key (kbd "s-b") 'browse-url-at-point)
(require 'avy)
(global-set-key (kbd "M-s") 'avy-goto-word-1)
;;
;; Thanks to:
;; + http://www.arminsadeghi.com/slickedit_and_emacs
;;
(global-set-key (kbd "s-q") 'magit-status)
;; a sensible font size for a 15" 1080p LCD
(when (member "DejaVu Sans Mono" (font-family-list))
(set-face-attribute 'default nil :font "DejaVu Sans Mono 10"))
(when window-system
(set-frame-parameter nil 'background-mode 'dark)
(when (not (display-graphic-p (selected-frame)))
(set-terminal-parameter (frame-terminal frame) 'background-mode mode))
(scroll-bar-mode -1))
;; hide the tool bar but show the menu bar
(if window-system
(progn
(tool-bar-mode 0)
(menu-bar-mode 0)))
(setq-default frame-title-format
(list '((buffer-file-name " %f"
(dired-directory
dired-directory
(revert-buffer-function " %b"
("%b - Dir: " default-directory)))))))
;; allow us to use the X-Windows clipboard
(setq x-select-enable-clipboard t) ; as above
(setq interprogram-paste-function 'x-cut-buffer-or-selection-value)
;;
;; Thanks to:
;; + http://emacsredux.com/blog/2013/06/21/eval-and-replace/
;;
(setq auto-mode-alist (cons '("emacs$" . lisp-mode) auto-mode-alist))
(defun eval-and-replace ()
"Replace the preceding sexp with its value."
(interactive)
(backward-kill-sexp)
(condition-case nil
(prin1 (eval (read (current-kill 0)))
(current-buffer))
(error (message "Invalid expression")
(insert (current-kill 0)))))
(global-set-key (kbd "C-c e") 'eval-and-replace)
;;
;; Thanks to:
;; + http://crypt.codemancers.com/posts/2013-09-26-setting-up-emacs-as-development-environment-on-osx/
;; + https://github.com/ldeck/ldeck-starter-kit
;; + http://stackoverflow.com/users/523044/tyler
;;
(duncans_emacs:add-to-load-path '("~/.emacs.d/yari.el"))
(require 'feature-mode)
(require 'yaml-mode)
(require 'yari)
(global-font-lock-mode 1)
(autoload 'ruby-mode "ruby-mode" "Ruby editing mode." t)
(duncans_emacs:set-mode
'ruby-mode
'("Gemfile$"
"\\.gemspec$"
"Guardfile$"
"\\.prawn$"
"\\.rake$"
"Rakefile$"
"\\.rb$"
"\\.rsel$"))
(setq yari-ri-program-name (replace-regexp-in-string "\n$" "" (shell-command-to-string "which ri")))
(setq yari-ruby-program-name (replace-regexp-in-string "\n$" "" (shell-command-to-string "which ruby")))
(defun yari-bind-key ()
(local-set-key (kbd "C-h r") 'yari))
(add-hook 'ruby-mode-hook 'yari-bind-key)
(autoload 'feature-mode "feature-mode" "Cucumber feature editing mode." t)
(duncans_emacs:set-mode 'feature-mode '("\\.feature$"))
(duncans_emacs:set-mode 'yaml-mode '("\\.yml$"))
(add-hook 'yaml-mode-hook '(lambda () (define-key yaml-mode-map "\C-m" 'newline-and-indent)))
(global-set-key (kbd "C-+") 'text-scale-increase)
(global-set-key (kbd "C--") 'text-scale-decrease)
(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))
(require 'coffee-mode)
(require 'haml-mode)
(require 'js2-mode)
(require 'sass-mode)
(setq coffee-tab-width 2)
(duncans_emacs:set-mode 'coffee-mode '("\\.coffee$"))
(duncans_emacs:set-mode
'css-mode
'("\\.css$"
"\\.scss$"))
(duncans_emacs:set-mode
'haml-mode
'("\\.haml$"
"\\.hamlc$"
"\\.hamljs$"))
(duncans_emacs:set-mode 'sass-mode '("\\.sass$"))
(autoload 'inform-mode "inform-mode" "Inform editing mode." t)
(autoload 'inform-maybe-mode "inform-mode" "Inform/C header editing mode.")
(duncans_emacs:set-mode 'inform-maybe-mode '("\\.h\\'"))
(duncans_emacs:set-mode 'inform-mode '("\\.inf\\'"))
(duncans_emacs:add-to-load-path '("~/.emacs.d/emotion-iconous-mode"))
(require 'emotion-iconous-mode)
(defun disable-linum-mode ()
(linum-mode 0))
(add-hook 'term-mode-hook 'disable-linum-mode)
(add-hook 'jabber-chat-mode-hook 'disable-linum-mode)
(defun hipchat-join (room)
(interactive "sRoom name: ")
(jabber-groupchat-join
(jabber-read-account)
(concat hipchat-number "_" room "@conf.hipchat.com")
hipchat-nickname
t)
(require 'jabber-emoicon))
(custom-set-variables '(jabber-auto-reconnect t))
(add-hook 'jabber-alert-message-hooks 'jabber-message-beep)
(defun my-message-mode-setup ()
(setq fill-column 72)
(turn-on-auto-fill))
(add-hook 'message-mode-hook 'my-message-mode-setup)
(duncans_emacs:set-mode
'mail-mode
'("\\.eml$"))
(add-hook 'mail-mode-hook 'auto-fill-mode)
(if (and
(not (equal system-type 'windows-nt)))
(duncans_emacs:create-terminals
'("tests"
"server"
"guard"
"misc")))
(global-set-key (kbd "C-x c") 'duncans_emacs:create-or-switch-to-term)
(require 'slime)
(add-hook 'lisp-mode-hook (lambda () (slime-mode t)))
(add-hook 'inferior-lisp-mode-hook (lambda () (inferior-slime-mode t)))
(setq inferior-lisp-program "sbcl")
(slime-setup '(slime-fancy slime-asdf))
(require 'find-file-in-project)
(global-set-key (kbd "C-x F") 'find-name-dired)
(global-set-key (kbd "C-x t") 'find-file-in-project)
(mapc '(lambda (ext) (add-to-list 'ffip-patterns ext))
'("*"))
(setq ffip-limit 102400)
(setq ffip-find-options "-not -wholename '*.a' -not -regex '.*\/\.git\/.*' -not -regex '.*\/\.db\/.*' -not -regex '.*\/node_modules\/.*' -not -regex '.*\/tmp/.*'")
(setq ffip-prefer-ido-mode t)
(global-set-key (kbd "C-x M-f") 'find-grep-dired)
(setq find-grep-options "-q -i")
(require 'tomatinho)
(global-set-key (kbd "<f12>") 'tomatinho)
(global-set-key (kbd "s-<return>") 'tomatinho-interactive-deliberate-pause)
(setq scheme-program-name "racket")
(defun scheme-mode-quack-hook ()
(require 'quack)
(setq quack-fontify-style 'emacs))
(add-hook 'scheme-mode-hook 'scheme-mode-quack-hook)
(autoload 'org-present "org-present" nil t)
(add-hook 'org-present-mode-hook
(lambda ()
(linum-mode 0)
(global-hl-line-mode 0)
(org-present-big)
(org-display-inline-images)
(visual-line-mode)))
(add-hook 'org-present-mode-quit-hook
(lambda ()
(linum-mode 1)
(global-hl-line-mode 1)
(org-present-small)
(org-remove-inline-images)
(setq visual-line-mode nil)))
(add-hook 'org-mode-hook (lambda () (toggle-truncate-lines)))
(setq org-startup-indented t)
(setq org-hide-leading-stars nil)
(require 'diff-hl)
(global-diff-hl-mode)
(require 'ansi-color)
(defun display-ansi-colors ()
(interactive)
(ansi-color-apply-on-region (point-min) (point-max)))
(add-to-list 'auto-mode-alist '("\\.log\\'" . display-ansi-colors))
(duncans_emacs:set-mode
'cypher-mode
'("\\.cql$"))
(require 'clj-refactor)
(defun my-clojure-mode-hook ()
(clj-refactor-mode 1)
(yas-minor-mode 1) ; for adding require/use/import statements
;; This choice of keybinding leaves cider-macroexpand-1 unbound
(cljr-add-keybindings-with-prefix "C-c C-m"))
(add-hook 'clojure-mode-hook #'my-clojure-mode-hook)
......@@ -34,19 +34,18 @@
(term-send-raw-string (concat "cd " new-directory "\n"))))))
(buffer-list)))
(defun duncans_emacs:create-or-switch-to-terminal (terminal-name)
(defun duncans_emacs:create-or-switch-to-term (terminal-name)
"Creates or switches to a named terminal, earmuffing the name if it isn't already."
(interactive (list (ido-completing-read "Buffer name: " (duncans_emacs:term-buffer-names))))
(interactive (list (ido-completing-read "Term buffer: " (duncans_emacs:term-buffer-names))))
(if (string= "" terminal-name)
(message "Refusing to create buffer with empty name")
(let ((new-buffer-name (duncans_emacs:earmuff-name terminal-name)))
(let ((new-buffer-name (duncans_emacs:earmuffenate terminal-name)))
(if (get-buffer new-buffer-name)
(switch-to-buffer new-buffer-name)
(progn
(require 'multi-term)
(setq multi-term-program "/usr/bin/zsh")
(multi-term)
(set-buffer "*terminal<1>*")
(set-buffer (multi-term))
(rename-buffer new-buffer-name))))))
(defun duncans_emacs:create-terminals (terminal-names)
......@@ -55,10 +54,10 @@
(setq multi-term-program "/usr/bin/zsh")
(mapcar
(lambda (desired-name)
(duncans_emacs:create-or-switch-to-terminal desired-name))
(duncans_emacs:create-or-switch-to-term desired-name))
terminal-names))
(defun duncans_emacs:earmuff-name (name)
(defun duncans_emacs:earmuffenate (name)
"Surrounds name with earmuffs, if it isn't already."
(let ((new-name name))
(if (not (string-prefix-p "*" new-name))
......
......@@ -214,7 +214,7 @@
((:url . "http://elpa.gnu.org/packages/dbus-codegen.html")
(:keywords "comm" "dbus" "convenience"))])
(debbugs .
[(0 9 5)
[(0 9 7)
((soap-client
(3 1 1))
(cl-lib
......@@ -312,7 +312,7 @@
((:keywords "convenience")
(:url . "https://github.com/ergoemacs/ergoemacs-mode"))])
(excorporate .
[(0 7 3)
[(0 7 5)
((emacs
(24 1))
(fsm
......@@ -540,6 +540,13 @@
nil "Authoring and publishing tool for Emacs" tar
((:keywords "hypermedia")
(:url . "http://mwolson.org/projects/EmacsMuse.html"))])
(myers .
[(0 1)
((emacs
(25)))
"Random-access singly-linked lists" single
((:url . "http://elpa.gnu.org/packages/myers.html")
(:keywords "list" "containers"))])
(nameless .
[(1 0 1)
((emacs
......@@ -598,7 +605,7 @@
((:url . "https://github.com/michael-heerdegen/on-screen.el")
(:keywords "convenience"))])
(org .
[(20160530)
[(20160620)
nil "Outline-based notes management and organizer" tar nil])
(osc .
[(0 1)
......@@ -628,7 +635,7 @@
((:url . "http://elpa.gnu.org/packages/poker.html")
(:keywords "games"))])
(python .
[(0 25 1)
[(0 25 2)
((emacs
(24 1))
(cl-lib
......@@ -684,7 +691,7 @@
((:url . "http://elpa.gnu.org/packages/sed-mode.html")
(:keywords))])
(seq .
[(2 15)
[(2 16)
nil "Sequence manipulation functions" tar
((:keywords "sequences")
(:url . "http://elpa.gnu.org/packages/seq.html"))])
......@@ -909,7 +916,7 @@
((:keywords "multimedia" "xpm")
(:url . "http://www.gnuvola.org/software/xpm/"))])
(yasnippet .
[(0 9 1)
[(0 10 0)
((cl-lib
(0 5)))
"Yet another snippet extension for Emacs." tar
......
Good signature from 474F05837FBDEF9B GNU ELPA Signing Agent <elpasign@elpa.gnu.org> (trust undefined) created at 2016-06-06T07:05:01+1000 using DSA
\ No newline at end of file
Good signature from 474F05837FBDEF9B GNU ELPA Signing Agent <elpasign@elpa.gnu.org> (trust undefined) created at 2016-06-23T07:05:01+1000 using DSA
\ No newline at end of file
(1
(emacs-profiles .
[(20160605 1130)
((emacs
(24))
(cl-lib
(0 5)))
"Configuration profiles for Emacs" single])
(zone-nyan .
[(0 2 2)
((esxml
......@@ -1415,7 +1408,7 @@
[(0 0 1)
nil "get stuff from pinboard" single])
(picpocket .
[(16)
[(22)
nil "Image viewer" single])
(pickup .
[(0 0 3)
......@@ -3373,7 +3366,7 @@
(2 2 0)))
"Modern API for working with files and directories" single])
(eyebrowse .
[(0 6 9)
[(0 7 0)
((dash
(2 7 0))
(emacs
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment