Permalink
Browse files

Merge branch 'master' of http://github.com/magnars/.emacs.d

  • Loading branch information...
2 parents 235eb1c + 776b4bc commit 4af32502d578503972ec8359216fe4581de9ee45 @cjohansen committed Feb 12, 2014
View
@@ -13,6 +13,7 @@
back-to-indentation-or-beginning
backward-sexp
c-electric-backspace
+ c-electric-colon
c-electric-delete-forward
c-electric-paren
c-electric-pound
@@ -22,6 +23,9 @@
change-inner
change-number-at-point
change-outer
+ cider-eval-last-sexp
+ clj-hippie-expand-no-case-fold
+ cljr-unwind
cua-replace-region
cua-set-mark
delete-blank-lines
@@ -37,6 +41,7 @@
forward-sexp
god-mode-repeat
hippie-expand-no-case-fold
+ html-paragraph
html-wrap-in-tag
isearch-forward-use-region
insert-postfix-whitespace
@@ -50,6 +55,7 @@
kill-and-retry-line
kill-region-or-backward-word
kill-sexp
+ live-cycle-clj-coll
magit-stage-item
markdown-enter-key
move-line-down
@@ -59,6 +65,7 @@
move-to-window-line-top-bottom
new-line-above
open-line-above
+ open-line-and-indent
open-line-below
org-beginning-of-line
org-delete-backward-char
@@ -74,6 +81,7 @@
paredit-backslash
paredit-backward
paredit-backward-barf-sexp
+ paredit-backward-down
paredit-backward-slurp-sexp
paredit-backward-up
paredit-close-round
@@ -134,6 +142,8 @@
transpose-params
transpose-sexps
wrap-region-trigger
+ yaml-electric-backspace
+ yaml-electric-dash-and-dot
yank-indented
yas-expand
zap-up-to-char
@@ -142,6 +152,7 @@
(setq mc/cmds-to-run-once
'(
adv-insert-new-number
+ beginning-of-buffer
cleanup-buffer
describe-key
dired-toggle-read-only
View
@@ -19,9 +19,11 @@
(defun clj-jump-to-other-file (arg)
(interactive "P")
(let ((file (clj-other-file-name)))
- (if (or (file-exists-p file) arg)
- (find-file file)
- (error "%s not found." file))))
+ (cond
+ ((file-exists-p file) (find-file file))
+ (arg (find-file file)
+ (save-buffer))
+ (t (error "%s not found." file)))))
(defun clj-jump-to-other-file-other-window (arg)
(interactive "P")
View
@@ -23,9 +23,10 @@
(defun new-line-dwim ()
(interactive)
- (let ((break-open-pair (or (and (looking-back "{") (looking-at "}"))
- (and (looking-back ">") (looking-at "<"))
- (and (looking-back "\\[") (looking-at "\\]")))))
+ (let ((break-open-pair (or (and (looking-back "{" 1) (looking-at "}"))
+ (and (looking-back ">" 1) (looking-at "<"))
+ (and (looking-back "(" 1) (looking-at ")"))
+ (and (looking-back "\\[" 1) (looking-at "\\]")))))
(newline)
(when break-open-pair
(save-excursion
View
@@ -56,7 +56,6 @@
'(magit
paredit
move-text
- god-mode
gist
htmlize
visual-regexp
@@ -79,6 +78,8 @@
gitconfig-mode
gitignore-mode
clojure-mode
+ groovy-mode
+ prodigy
cider
cider-tracing
textile-mode)))
@@ -118,6 +119,9 @@
(require 'setup-html-mode)
(require 'setup-paredit)
+(require 'prodigy)
+(global-set-key (kbd "C-x M-m") 'prodigy)
+
;; Font lock dash.el
(eval-after-load "dash" '(dash-enable-font-lock))
@@ -128,7 +132,8 @@
restclient-mode-hook
js-mode-hook
ruby-mode
- markdown-mode)
+ markdown-mode
+ groovy-mode)
(add-hook it 'turn-on-smartparens-mode))
;; Language specific setup files
View
@@ -153,6 +153,8 @@
(fset 'quick-switch-buffer [?\C-x ?b return])
(global-set-key (kbd "s-b") 'quick-switch-buffer)
+(global-set-key (kbd "s-y") 'bury-buffer)
+
;; Revert without any fuss
(global-set-key (kbd "M-<escape>") (λ (revert-buffer t t)))
View
@@ -5,6 +5,7 @@
;; Emacs lisp
(add-to-list 'auto-mode-alist '("Carton$" . emacs-lisp-mode))
+(add-to-list 'auto-mode-alist '("Cask$" . emacs-lisp-mode))
;; CSS
(add-to-list 'auto-mode-alist '("\\.scss$" . css-mode))
@@ -65,6 +66,7 @@
;; Groovy
(autoload 'groovy-mode "groovy-mode")
(add-to-list 'auto-mode-alist '("\\.groovy$" . groovy-mode))
+(add-to-list 'auto-mode-alist '("\\.gradle$" . groovy-mode))
;; Clojure
(autoload 'clojure-mode "clojure-mode")
View
@@ -32,8 +32,12 @@
;; Use normal tabs in makefiles
(add-hook 'makefile-mode-hook 'indent-tabs-mode)
-;; Trademark on C-x 8 t m
+;; More neat bindings for C-x 8
(global-set-key (kbd "C-x 8 t m") (λ (insert "")))
+(global-set-key (kbd "C-x 8 ( c )") (λ (insert "©")))
+(global-set-key (kbd "C-x 8 - >") (λ (insert "")))
+(global-set-key (kbd "C-x 8 8") (λ (insert "")))
+(global-set-key (kbd "C-x 8 ( c )") (λ (insert "©")))
;; Add JSP expansions to html-mode
(eval-after-load "sgml-mode" '(require 'jsp-expansions))
View
@@ -56,6 +56,10 @@
(recentf-mode 1)
(setq recentf-max-saved-items 100) ;; just 20 is too recent
+;; Save minibuffer history
+(savehist-mode 1)
+(setq history-length 1000)
+
;; Undo/redo window configuration with C-c <left>/<right>
(winner-mode 1)
View
@@ -13,13 +13,27 @@
(add-hook 'clojure-mode-hook (lambda () (clj-refactor-mode 1)))
+(define-key clojure-mode-map (kbd "C->") 'cljr-thread)
+(define-key clojure-mode-map (kbd "C-<") 'cljr-unwind)
+
(define-key clojure-mode-map (kbd "s-j") 'clj-jump-to-other-file)
+(define-key clojure-mode-map (kbd "C-.") 'clj-hippie-expand-no-case-fold)
+
+(defun clj-hippie-expand-no-case-fold ()
+ (interactive)
+ (let ((old-syntax (char-to-string (char-syntax ?/))))
+ (modify-syntax-entry ?/ " ")
+ (hippie-expand-no-case-fold)
+ (modify-syntax-entry ?/ old-syntax)))
+
(require 'cider)
(define-key cider-repl-mode-map (kbd "<home>") nil)
(define-key cider-repl-mode-map (kbd "C-,") 'complete-symbol)
(define-key cider-mode-map (kbd "C-,") 'complete-symbol)
+(define-key cider-mode-map (kbd "C-c C-q") 'nrepl-close)
+(define-key cider-mode-map (kbd "C-c C-Q") 'cider-quit)
;; Indent and highlight more commands
(put-clojure-indent 'match 'defun)
@@ -42,5 +56,58 @@
;; Enable eldoc in Clojure buffers
(add-hook 'cider-mode-hook 'cider-turn-on-eldoc-mode)
+;; Cycle between () {} []
+
+(defun live-delete-and-extract-sexp ()
+ "Delete the sexp and return it."
+ (interactive)
+ (let* ((begin (point)))
+ (forward-sexp)
+ (let* ((result (buffer-substring-no-properties begin (point))))
+ (delete-region begin (point))
+ result)))
+
+(defun live-cycle-clj-coll ()
+ "convert the coll at (point) from (x) -> {x} -> [x] -> (x) recur"
+ (interactive)
+ (let* ((original-point (point)))
+ (while (and (> (point) 1)
+ (not (equal "(" (buffer-substring-no-properties (point) (+ 1 (point)))))
+ (not (equal "{" (buffer-substring-no-properties (point) (+ 1 (point)))))
+ (not (equal "[" (buffer-substring-no-properties (point) (+ 1 (point))))))
+ (backward-char))
+ (cond
+ ((equal "(" (buffer-substring-no-properties (point) (+ 1 (point))))
+ (insert "{" (substring (live-delete-and-extract-sexp) 1 -1) "}"))
+ ((equal "{" (buffer-substring-no-properties (point) (+ 1 (point))))
+ (insert "[" (substring (live-delete-and-extract-sexp) 1 -1) "]"))
+ ((equal "[" (buffer-substring-no-properties (point) (+ 1 (point))))
+ (insert "(" (substring (live-delete-and-extract-sexp) 1 -1) ")"))
+ ((equal 1 (point))
+ (message "beginning of file reached, this was probably a mistake.")))
+ (goto-char original-point)))
+
+(define-key clojure-mode-map (kbd "C-´") 'live-cycle-clj-coll)
+
+;; Warn about missing nREPL instead of doing stupid things
+
+(defun nrepl-warn-when-not-connected ()
+ (interactive)
+ (message "Oops! You're not connected to an nREPL server. Please run M-x cider or M-x cider-jack-in to connect."))
+
+(define-key clojure-mode-map (kbd "C-M-x") 'nrepl-warn-when-not-connected)
+(define-key clojure-mode-map (kbd "C-x C-e") 'nrepl-warn-when-not-connected)
+(define-key clojure-mode-map (kbd "C-c C-e") 'nrepl-warn-when-not-connected)
+(define-key clojure-mode-map (kbd "C-c C-l") 'nrepl-warn-when-not-connected)
+(define-key clojure-mode-map (kbd "C-c C-r") 'nrepl-warn-when-not-connected)
+(define-key clojure-mode-map (kbd "C-c C-z") 'nrepl-warn-when-not-connected)
+(define-key clojure-mode-map (kbd "C-c C-k") 'nrepl-warn-when-not-connected)
+(define-key clojure-mode-map (kbd "C-c C-n") 'nrepl-warn-when-not-connected)
+
+;; ------------
+
+;; TODO: Loot more stuff from:
+;; - https://github.com/overtone/emacs-live/blob/master/packs/dev/clojure-pack/config/paredit-conf.el
+
(provide 'setup-clojure-mode)
View
@@ -1,9 +1,5 @@
(require 'find-file-in-project)
(require 's)
-(require 'eproject)
-
-;; Use eproject to find project root
-(setq ffip-project-root-function 'eproject-root)
;; No need to be stingy
(setq ffip-limit 4096)
@@ -14,7 +10,7 @@
"Return an alist of all filenames in the project and their path."
(let ((file-alist nil))
(mapcar (lambda (file)
- (let ((file-cons (cons (s-chop-prefix (eproject-root) (expand-file-name file))
+ (let ((file-cons (cons (s-chop-prefix (file-truename (ffip-project-root)) (expand-file-name file))
(expand-file-name file))))
(add-to-list 'file-alist file-cons)
file-cons))
@@ -52,12 +48,13 @@
;; Default excludes - override with ffip-local-excludes
-(setq ffip-find-options
- (ffip--create-exclude-find-options
- '("node_modules"
- "target"
- "overlays"
- "build"
- "vendor")))
+(setq-default ffip-find-options
+ (ffip--create-exclude-find-options
+ '("node_modules"
+ "target"
+ "overlays"
+ "build"
+ "vendor"
+ ".cask")))
(provide 'setup-ffip)
View
@@ -6,6 +6,19 @@
(set-face-foreground 'diff-removed "#ff0000")
(set-default 'magit-stage-all-confirm nil)
+(set-default 'magit-unstage-all-confirm nil)
+
+(eval-after-load 'ediff
+ '(progn
+ (set-face-foreground 'ediff-odd-diff-B "#ffffff")
+ (set-face-background 'ediff-odd-diff-B "#292521")
+ (set-face-foreground 'ediff-even-diff-B "#ffffff")
+ (set-face-background 'ediff-even-diff-B "#292527")
+
+ (set-face-foreground 'ediff-odd-diff-A "#ffffff")
+ (set-face-background 'ediff-odd-diff-A "#292521")
+ (set-face-foreground 'ediff-even-diff-A "#ffffff")
+ (set-face-background 'ediff-even-diff-A "#292527")))
;; todo:
;; diff-added-face diff-changed-face
@@ -117,4 +130,9 @@
(require-package 'git-messenger)
(global-set-key (kbd "C-x v p") #'git-messenger:popup-message)
+;; Don't bother me with flyspell keybindings
+
+(eval-after-load "flyspell"
+ '(define-key flyspell-mode-map (kbd "C-.") nil))
+
(provide 'setup-magit)
View
@@ -13,4 +13,8 @@
(defadvice kill-whole-line (after fix-cookies activate)
(myorg-update-parent-cookie))
+(setq org-directory "~/Dropbox/org")
+(setq org-default-notes-file (concat org-directory "/notes.org"))
+(define-key global-map (kbd "M-<f6>") 'org-capture)
+
(provide 'setup-org)
Submodule fold-this updated 2 files
+9 −1 README.md
+14 −2 fold-this.el
Submodule s updated 4 files
+14 −0 README.md
+6 −1 dev/examples.el
+5 −0 readme-template.md
+12 −2 s.el
View
@@ -34,9 +34,9 @@
(delete-region (region-beginning) (region-end))
(god-local-mode -1))
-(define-key god-local-mode-map (kbd "'")
- (λ (when (use-region-p)
- (my-delete-region-and-go-to-insert-mode))))
+;; (define-key god-local-mode-map (kbd "'")
+;; (λ (when (use-region-p)
+;; (my-delete-region-and-go-to-insert-mode))))
;; PHP
(autoload 'php-mode "php-mode")
@@ -1,6 +1,6 @@
(defun wte--unique-filename (stub &optional index)
(setq index (or index 1))
- (let ((filename (concat "~/projects/what-the-emacsd/posts/"
+ (let ((filename (concat "~/stuff/what-the-emacsd/resources/posts/"
stub
".el"
(if (< index 10) "-0" "-")
Oops, something went wrong.

0 comments on commit 4af3250

Please sign in to comment.