Permalink
Browse files

Merge magnars/master

  • Loading branch information...
2 parents ad64dfa + 91ba3ce commit 8a1f14909ebf7c5dfc07129e2c17f3850c43696a @cjohansen committed Jul 14, 2013
Showing with 5,459 additions and 694 deletions.
  1. +35 −26 .gitmodules
  2. +93 −3 .mc-lists.el
  3. +28 −25 README.md
  4. +54 −16 appearance.el
  5. +28 −16 custom.el
  6. +15 −42 defuns/buffer-defuns.el
  7. +13 −25 defuns/clj-defuns.el
  8. +68 −26 defuns/editing-defuns.el
  9. +11 −0 defuns/js2r-defuns.el
  10. +62 −8 defuns/misc-defuns.el
  11. +11 −0 defuns/project-defuns.el
  12. +1 −1 defuns/snippet-helpers.el
  13. +60 −32 init.el
  14. +54 −12 key-bindings.el
  15. +68 −6 mac.el
  16. +4 −0 mode-mappings.el
  17. +14 −1 my-misc.el
  18. +14 −0 project-archetypes/clj-ring-archetype.el
  19. +12 −0 project-archetypes/clj-ring/.gitignore
  20. +2 −0 project-archetypes/clj-ring/resources/public/css/reset.css
  21. +17 −0 project-archetypes/clj-ring/src/__project_name__/core.clj
  22. +10 −0 project-archetypes/emacs-package-archetype.el
  23. +4 −0 project-archetypes/emacs-package/.gitignore
  24. +22 −0 project-archetypes/emacs-package/.travis.yml
  25. +7 −0 project-archetypes/emacs-package/Carton
  26. +59 −0 project-archetypes/emacs-package/README.md
  27. +29 −0 project-archetypes/emacs-package/__project-name__.el
  28. +3 −0 project-archetypes/emacs-package/features/__project-name__.feature
  29. +23 −0 project-archetypes/emacs-package/features/step-definitions/__project-name__-steps.el
  30. +19 −0 project-archetypes/emacs-package/features/support/env.el
  31. +3 −0 project-archetypes/emacs-package/run-tests.sh
  32. +13 −0 project-archetypes/emacs-package/run-travis-ci.sh
  33. +45 −0 project-archetypes/emacs-package/watch-tests.watchr
  34. +13 −0 project-archetypes/emacs-snippets-archetype.el
  35. +3 −0 project-archetypes/emacs-snippets/Carton
  36. +45 −0 project-archetypes/emacs-snippets/README.md
  37. +71 −0 project-archetypes/emacs-snippets/__target__-snippets.el
  38. +6 −0 project-archetypes/emacs-snippets/snippets/__major-mode__/example-snippet-with-docs
  39. +16 −0 project-archetypes/js-buster-browser-archetype.el
  40. +1 −0 project-archetypes/js-buster-browser/.gitignore
  41. +1 −0 project-archetypes/js-buster-browser/.rvmrc
  42. +8 −0 project-archetypes/js-buster-browser/README.md
  43. +26 −0 project-archetypes/js-buster-browser/autolint.js
  44. +8 −0 project-archetypes/js-buster-browser/buster.js
  45. +492 −0 project-archetypes/js-buster-browser/external/cull.js
  46. +321 −0 project-archetypes/js-buster-browser/external/dome.js
  47. +1 −0 project-archetypes/js-buster-browser/lib/main.js
  48. +10 −0 project-archetypes/js-buster-browser/package.json
  49. +1 −0 project-archetypes/js-buster-browser/run-tests.sh
  50. +7 −0 project-archetypes/js-buster-browser/test/main-test.js
  51. +2 −0 project-archetypes/js-buster-browser/todo.org
  52. +38 −0 project-archetypes/js-buster-browser/watch-tests.watchr
  53. +9 −0 sane-defaults.el
  54. +33 −7 setup-clojure-mode.el
  55. +8 −5 setup-dired.el
  56. +2 −4 setup-ffip.el
  57. +35 −0 setup-flycheck.el
  58. +1 −0 setup-hippie.el
  59. +32 −44 setup-html-mode.el
  60. +30 −4 setup-ido.el
  61. +122 −4 setup-js2-mode.el
  62. +15 −0 setup-magit.el
  63. +3 −2 setup-org.el
  64. +22 −20 setup-package.el
  65. +78 −13 setup-paredit.el
  66. +40 −0 setup-rgrep.el
  67. +3 −0 setup-ruby-mode.el
  68. +29 −0 setup-skewer.el
  69. +0 −121 setup-slime-js.el
  70. +8 −13 setup-yasnippet.el
  71. +1 −0 site-lisp/angular-snippets
  72. +1 −1 site-lisp/buster-snippets
  73. +1 −1 site-lisp/change-inner
  74. +1 −0 site-lisp/clj-refactor
  75. +0 −1 site-lisp/coffee-mode
  76. +1 −1 site-lisp/dash
  77. +1 −0 site-lisp/datomic-snippets
  78. +1 −1 site-lisp/expand-region
  79. +1 −0 site-lisp/flx
  80. +1 −0 site-lisp/flycheck
  81. +1 −1 site-lisp/js2-refactor
  82. +0 −1 site-lisp/mark-multiple
  83. +110 −0 site-lisp/mouse-slider-mode.el
  84. +1 −1 site-lisp/multiple-cursors
  85. +1 −95 site-lisp/oppdrag-mode.el
  86. +78 −0 site-lisp/project-archetypes/project-archetypes.el
  87. +0 −1 site-lisp/ruby-end
  88. +1 −1 site-lisp/s
  89. +1 −0 site-lisp/simplezen
  90. +184 −0 site-lisp/skewer-mode/README.md
  91. +2 −0 site-lisp/skewer-mode/TODO
  92. +24 −0 site-lisp/skewer-mode/UNLICENSE
  93. +67 −0 site-lisp/skewer-mode/cache-table.el
  94. +9 −0 site-lisp/skewer-mode/example.html
  95. +204 −0 site-lisp/skewer-mode/skewer-bower.el
  96. +131 −0 site-lisp/skewer-mode/skewer-css.el
  97. +51 −0 site-lisp/skewer-mode/skewer-everything.user.js
  98. +128 −0 site-lisp/skewer-mode/skewer-html.el
  99. +509 −0 site-lisp/skewer-mode/skewer-mode.el
  100. +124 −0 site-lisp/skewer-mode/skewer-repl.el
  101. +386 −0 site-lisp/skewer-mode/skewer.js
  102. +1 −1 site-lisp/smart-forward
  103. +1 −1 site-lisp/tagedit
  104. +1 −0 site-lisp/tern
  105. +0 −1 site-lisp/zencoding
  106. +5 −0 snippets/crappy-jsp-mode/elvariable
  107. +5 −0 snippets/html-mode/link
  108. +2 −3 snippets/html-mode/oocss-module
  109. +5 −0 snippets/html-mode/strong
  110. +13 −0 snippets/js-mode/directive-oiiku-shared
  111. +5 −0 snippets/js-mode/for
  112. +3 −2 snippets/js-mode/immediately-invoked-function-expression.yasnippet
  113. +1 −1 snippets/js-mode/node.require.yasnippet
  114. +8 −0 snippets/js-mode/try
  115. +16 −0 themes/default-black-theme.el
  116. +803 −0 themes/prez-theme.el
  117. +10 −41 users/fimasvee/init.el
  118. +11 −37 users/fimasvee/js2r-keys.el
  119. +3 −1 users/fimasvee/mu3e.el
  120. +12 −0 users/fimasvee/my-defuns.el
  121. +69 −25 users/fimasvee/project-mappings.el
  122. +23 −0 users/fimasvee/travel-mode.el
View
61 .gitmodules
@@ -7,12 +7,6 @@
[submodule "site-lisp/jade-mode"]
path = site-lisp/jade-mode
url = https://github.com/brianc/jade-mode
-[submodule "site-lisp/coffee-mode"]
- path = site-lisp/coffee-mode
- url = https://github.com/defunkt/coffee-mode
-[submodule "site-lisp/mark-multiple"]
- path = site-lisp/mark-multiple
- url = https://github.com/magnars/mark-multiple.el.git
[submodule "site-lisp/ace-jump-mode"]
path = site-lisp/ace-jump-mode
url = https://github.com/winterTTr/ace-jump-mode.git
@@ -82,33 +76,48 @@
[submodule "site-lisp/buster-mode"]
path = site-lisp/buster-mode
url = https://github.com/magnars/buster-mode.git
-[submodule "site-lisp/ruby-end"]
- path = site-lisp/ruby-end
- url = https://github.com/rejeep/ruby-end.git
-[submodule "site-lisp/zencoding"]
- path = site-lisp/zencoding
- url = https://github.com/rooney/zencoding.git
[submodule "site-lisp/change-inner"]
path = site-lisp/change-inner
url = https://github.com/magnars/change-inner.el.git
[submodule "site-lisp/crappy-jsp-mode"]
- path = site-lisp/crappy-jsp-mode
- url = git://github.com/magnars/crappy-jsp-mode.git
+ path = site-lisp/crappy-jsp-mode
+ url = git://github.com/magnars/crappy-jsp-mode.git
[submodule "site-lisp/s"]
- path = site-lisp/s
- url = https://github.com/magnars/s.el.git
+ path = site-lisp/s
+ url = https://github.com/magnars/s.el.git
[submodule "site-lisp/dash"]
- path = site-lisp/dash
- url = https://github.com/magnars/dash.el.git
+ path = site-lisp/dash
+ url = https://github.com/magnars/dash.el.git
[submodule "site-lisp/multifiles"]
- path = site-lisp/multifiles
- url = https://github.com/magnars/multifiles.el.git
+ path = site-lisp/multifiles
+ url = https://github.com/magnars/multifiles.el.git
[submodule "site-lisp/tagedit"]
- path = site-lisp/tagedit
- url = https://github.com/magnars/tagedit.git
+ path = site-lisp/tagedit
+ url = https://github.com/magnars/tagedit.git
[submodule "site-lisp/fold-this"]
- path = site-lisp/fold-this
- url = https://github.com/magnars/fold-this.el.git
+ path = site-lisp/fold-this
+ url = https://github.com/magnars/fold-this.el.git
[submodule "site-lisp/revealjs-mode"]
- path = site-lisp/revealjs-mode
- url = https://github.com/cjohansen/revealjs-mode.git
+ path = site-lisp/revealjs-mode
+ url = https://github.com/cjohansen/revealjs-mode.git
+[submodule "site-lisp/clj-refactor"]
+ path = site-lisp/clj-refactor
+ url = https://github.com/magnars/clj-refactor.el.git
+[submodule "site-lisp/tern"]
+ path = site-lisp/tern
+ url = https://github.com/marijnh/tern.git
+[submodule "site-lisp/simplezen"]
+ path = site-lisp/simplezen
+ url = https://github.com/magnars/simplezen.el.git
+[submodule "site-lisp/angular-snippets"]
+ path = site-lisp/angular-snippets
+ url = https://github.com/magnars/angular-snippets.el.git
+[submodule "site-lisp/flx"]
+ path = site-lisp/flx
+ url = https://github.com/lewang/flx.git
+[submodule "site-lisp/flycheck"]
+ path = site-lisp/flycheck
+ url = https://github.com/lunaryorn/flycheck.git
+[submodule "site-lisp/datomic-snippets"]
+ path = site-lisp/datomic-snippets
+ url = https://github.com/magnars/datomic-snippets.git
View
96 .mc-lists.el
@@ -4,12 +4,20 @@
(setq mc/cmds-to-run-for-all
'(
ac-complete
+ adv-dash
+ adv-dot
+ adv-enter
+ adv-gt
+ adv-open-curly
+ adv-tab
back-to-indentation-or-beginning
+ backward-sexp
c-electric-backspace
c-electric-delete-forward
c-electric-paren
c-electric-semi&comma
c-electric-slash
+ c-electric-star
change-inner
change-number-at-point
change-outer
@@ -18,53 +26,135 @@
delete-blank-lines
dired-back-to-start-of-files
duplicate-current-line-or-region
+ end-of-buffer
eval-and-replace
+ eval-last-sexp
fold-this
forward-paragraph
+ forward-sentence
+ forward-sexp
hippie-expand-no-case-fold
html-wrap-in-tag
isearch-forward-use-region
js2-beginning-of-line
js2-end-of-line
js2-insert-and-indent
js2r-inline-var
+ js2r-move-line-up
+ js2r-split-string
js2r-var-to-this
+ kill-and-retry-line
kill-region-or-backward-word
+ kill-sexp
magit-stage-item
markdown-enter-key
move-line-down
move-line-up
+ move-text-down
+ move-text-up
+ move-to-window-line-top-bottom
new-line-above
+ open-line-above
+ open-line-below
org-beginning-of-line
org-delete-backward-char
org-delete-char
org-end-of-line
org-metaleft
org-metaright
+ org-return-indent
org-self-insert-command
org-shiftright
+ org-yank
orgtbl-self-insert-command
+ paredit-backslash
+ paredit-backward
+ paredit-backward-up
+ paredit-close-round
+ paredit-close-square
+ paredit-comment-dwim
+ paredit-doublequote
+ paredit-forward
+ paredit-forward-delete
+ paredit-forward-down
+ paredit-forward-kill-word
+ paredit-forward-slurp-sexp
+ paredit-forward-up
+ paredit-join-sexps
+ paredit-kill
+ paredit-kill-region-or-backward-word
+ paredit-newline
+ paredit-open-curly
+ paredit-open-round
+ paredit-open-square
+ paredit-raise-sexp
+ paredit-reindent-defun
+ paredit-semicolon
+ paredit-splice-sexp
+ paredit-split-sexp
+ paredit-wrap-round
+ paredit-wrap-round-from-behind
+ paredit-wrap-square
quoted-insert
ruby-electric-brace
save-region-or-current-line
sgml-delete-tag
sgml-slash
+ skeleton-pair-insert-maybe
slime-space
+ sp--self-insert-command
+ sp-remove-active-pair-overlay
+ sp-self-insert-command
+ subtract-number-at-point
+ tagedit-forward-slurp-tag
+ tagedit-insert-dot
+ tagedit-insert-equal
+ tagedit-insert-exclamation-mark
+ tagedit-insert-gt
+ tagedit-insert-hash
+ tagedit-insert-lt
+ tagedit-insert-quote
+ tagedit-kill
+ tagedit-kill-attribute
+ tagedit-maybe-insert-slash
+ tagedit-raise-tag
+ tagedit-splice-tag
+ tern-ac-dot-complete
+ toggle-assert-refute
+ toggle-quotes
+ touch-buffer-file
+ transpose-params
+ transpose-sexps
wrap-region-trigger
yank-indented
yas/expand
+ zap-up-to-char
))
(setq mc/cmds-to-run-once
'(
- ace-jump-mode
+ adv-insert-new-number
+ cleanup-buffer
+ describe-key
+ dired-toggle-read-only
+ edebug-next-mode
eval-expression
+ goto-line-with-feedback
+ handle-switch-frame
+ ido-switch-buffer
js2r-extract-var
js2r-rename-var
- quit-window
- sgml-maybe-name-self
+ jump-between-source-and-test-files
+ magit-status
+ mc/add-cursor-on-click
+ mc/add-cursors-to-all-matches
+ multiple-cursors-mode
+ persp-switch
+ shell
smex
toggle-read-only
view-echo-area-messages
wgrep-change-to-wgrep-mode
+ wgrep-finish-edit
+ wgrep-save-all-buffers
))
View
53 README.md
@@ -6,14 +6,7 @@ You can also see some thoughts behind the settings on my [What the .emacs.d!?](h
## Setup
-To grab all the dependencies, either:
-
- git clone git://github.com/magnars/.emacs.d.git
- cd .emacs.d
- git submodule init
- git submodule update
-
-or on git v1.6.5 or later:
+To grab all the dependencies:
git clone --recursive git://github.com/magnars/.emacs.d.git
@@ -22,21 +15,16 @@ that are best handled by the package manager.
## Install emacs on mac
-I use Cocoa Emacs, installed like this:
-
- brew install emacs --cocoa
-
-You can also get the very latest Emacs:
-
- brew install emacs --cocoa --use-git-head --HEAD
-
-To open it with Alfred or Quicksilver, you have to copy `Emacs.app` into
-`/Applications` instead of the symlink that brew places there.
+I use [Emacs For Mac OS X](http://emacsformacosx.com).
## Tips for using these emacs settings
If you want to use my settings straight out of the box, here are some things to note:
+ * I recommend starting with a blank emacs +
+ [Technomancy's better-defaults package](https://github.com/technomancy/better-defaults),
+ and then dig through this repo for useful nuggets.
+
* The key bindings are optimized for a norwegian keyboard layout.
* Start by reading up on all the cool stuff in key-bindings.el.
@@ -49,18 +37,13 @@ If you want to use my settings straight out of the box, here are some things to
* `C-h` is rebound to backspace, like in the shell. Get help on `F1` instead.
- * Autocomplete with `C-.`
+ * Autocomplete with `C-.` (autocomplete entire lines with `C-:`)
* expand-region is your friend. Find its bound key by doing `F1 f er/expand-region`
- * annoying-arrows suggests alternative ways of moving around if you use the
- arrow keys excessively.
-
* Undo with `C-_` and redo with `M-_`. Watch the undo-tree with `C-x u`
- * Easily add functions to the F-keys with `M-: (f5 <sexps here>)`, example `(f5 (flush-lines "console.log"))`
-
- * Quickly jump anywhere in the buffer by pressing `fn` plus the starting letter of a word.
+ * Quickly jump anywhere in the buffer with `C-ø` then the starting letter of a word.
* Indent and clean up white space in the entire buffer with `C-c n`
@@ -70,6 +53,26 @@ If you want to use my settings straight out of the box, here are some things to
* Watch [emacsrocks.com](http://emacsrocks.com)
+### Additional setup
+
+#### tern.js
+
+If you want [tern](http://ternjs.net/) in your javascript, you need to
+install [node](http://nodejs.org) and run `npm install` in the
+`.emacs/site-lisp/tern` directory.
+
+#### nrepl-inspect
+
+If you want [nrepl-inspect](https://github.com/vitalreactor/nrepl-inspect)
+to work, you need to:
+
+ - Go to `.emacs.d/site-lisp/nrepl-inspect` and do `lein install`
+ - Configure your `~/.lein/profiles.clj`:
+
+ {:user {:dependencies [[nrepl-inspect "0.3.0"]]
+ :repl-options {:nrepl-middleware
+ [inspector.middleware/wrap-inspect]}}}
+
## Survival guide for the first week of emacs
When you start using emacs for the first time, your habits fight you every inch
View
70 appearance.el
@@ -3,22 +3,50 @@
color-theme-is-global t
truncate-partial-width-windows nil)
-(set-face-background 'region "#464740")
-
;; Highlight current line
(global-hl-line-mode 1)
-;; Customize background color of lighlighted line
-(set-face-background 'hl-line "#222222")
+;; Set custom theme path
+(setq custom-theme-directory (concat user-emacs-directory "themes"))
+
+(dolist
+ (path (directory-files custom-theme-directory t "\\w+"))
+ (when (file-directory-p path)
+ (add-to-list 'custom-theme-load-path path)))
+
+;; Default theme
+(defun use-presentation-theme ()
+ (interactive)
+ (disable-theme 'default-black)
+ (load-theme 'prez)
+ (when (boundp 'magnars/presentation-font)
+ (set-face-attribute 'default nil :font magnars/presentation-font)))
+
+(defun use-default-theme ()
+ (interactive)
+ (disable-theme 'prez)
+ (load-theme 'default-black)
+ (when (boundp 'magnars/default-font)
+ (set-face-attribute 'default nil :font magnars/default-font)))
-;; Highlight in yasnippet
-(set-face-background 'yas/field-highlight-face "#333399")
+(defun toggle-presentation-mode ()
+ (interactive)
+ (if (string= (frame-parameter nil 'font) magnars/default-font)
+ (use-presentation-theme)
+ (use-default-theme)))
+
+(global-set-key (kbd "C-<f9>") 'toggle-presentation-mode)
+
+(use-default-theme)
;; Preeeetty font in Emacs 24/Ubuntu
(if is-mac nil
(set-default-font "DejaVu Sans Mono")
(set-face-attribute 'default nil :height 105))
+;; Don't defer screen updates when performing operations
+(setq redisplay-dont-pause t)
+
;; org-mode colors
(setq org-todo-keyword-faces
'(
@@ -30,26 +58,36 @@
;; Highlight matching parentheses when the point is on them.
(show-paren-mode 1)
-;; No menu bars
-(menu-bar-mode -1)
-
(when window-system
(setq frame-title-format '(buffer-file-name "%f" ("%b")))
- (turn-off-tool-bar)
(tooltip-mode -1)
- (turn-off-tool-bar)
(blink-cursor-mode -1))
-(add-hook 'before-make-frame-hook 'turn-off-tool-bar)
-
-;; Ditch them scrollbars
-(scroll-bar-mode -1)
-
;; Make zooming affect frame instead of buffers
(require 'zoom-frm)
;; Sweet window-splits
(defadvice split-window-right (after balance activate) (balance-windows))
(defadvice delete-window (after balance activate) (balance-windows))
+;; Unclutter the modeline
+(require 'diminish)
+(eval-after-load "yasnippet" '(diminish 'yas/minor-mode))
+(eval-after-load "eldoc" '(diminish 'eldoc-mode))
+(eval-after-load "paredit" '(diminish 'paredit-mode))
+(eval-after-load "tagedit" '(diminish 'tagedit-mode))
+(eval-after-load "elisp-slime-nav" '(diminish 'elisp-slime-nav-mode))
+(eval-after-load "skewer-mode" '(diminish 'skewer-mode))
+(eval-after-load "skewer-css" '(diminish 'skewer-css-mode))
+(eval-after-load "skewer-html" '(diminish 'skewer-html-mode))
+(eval-after-load "smartparens" '(diminish 'smartparens-mode))
+
+(defmacro rename-modeline (package-name mode new-name)
+ `(eval-after-load ,package-name
+ '(defadvice ,mode (after rename-modeline activate)
+ (setq mode-name ,new-name))))
+
+(rename-modeline "js2-mode" js2-mode "JS2")
+(rename-modeline "clojure-mode" clojure-mode "Clj")
+
(provide 'appearance)
View
44 custom.el
@@ -1,22 +1,34 @@
-(custom-set-faces
- ;; custom-set-faces 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.
- '(default ((t (:inherit nil :stipple nil :background "Black" :foreground "White" :inverse-video nil :box nil :strike-t*hrough nil :overline nil :underline nil :slant normal :weight normal :width normal :height 105))))
- '(diff-refine-change ((t (:background "midnight blue"))))
- '(highlight ((((class color) (min-colors 88) (background dark)) (:background "#111111"))))
- '(js2-function-param-face ((t (:foreground "LightGoldenrod"))))
- '(mumamo-background-chunk-submode ((((class color) (min-colors 88) (background dark)) nil)))
- '(show-paren-match ((nil (:background "#333399"))))
- '(show-paren-mismatch ((((class color)) (:background "red")))))
+;; (custom-set-faces
+;; ;; custom-set-faces 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.
+;; '(default ((t (:inherit nil :stipple nil :background "Black" :foreground "White" :inverse-video nil :box nil :strike-t*hrough nil :overline nil :underline nil :slant normal :weight normal :width nor
+;; '(diff-refine-change ((t (:background "midnight blue"))))
+;; '(highlight ((((class color) (min-colors 88) (background dark)) (:background "#111111"))))
+;; '(js2-function-param-face ((t (:foreground "LightGoldenrod"))))
+;; '(mumamo-background-chunk-submode ((((class color) (min-colors 88) (background dark)) nil)))
+;; '(show-paren-match ((nil (:background "#333399"))))
+;; '(show-paren-mismatch ((((class color)) (:background "red")))))
+;; (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.
+;; '(fill-column 80)
+;; '(ido-use-filename-at-point nil)
+;; '(safe-local-variable-values (quote ((eval font-lock-add-keywords nil (quote (("defexamples\\|def-example-group\\| => " (0 (quote font-lock-keyword-face)))))) (eval when (and (buffer-file-name) (fil
+;; '(send-mail-function (quote smtpmail-send-it)))
(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.
- '(fill-column 80)
- '(ido-use-filename-at-point nil)
- '(safe-local-variable-values (quote ((eval font-lock-add-keywords nil (quote (("defexamples\\|def-example-group\\| => " (0 (quote font-lock-keyword-face)))))) (eval when (and (buffer-file-name) (file-regular-p (buffer-file-name)) (string-match-p "^[^.]" (buffer-file-name))) (emacs-lisp-mode)) (eval font-lock-add-keywords nil (quote (("defexamples\\| => " (0 (quote font-lock-keyword-face)))))) (encoding . utf-8))))
- '(send-mail-function (quote smtpmail-send-it)))
+ '(custom-safe-themes (quote ("f3ec2da81c2b1f66f911fe47843a09055754b40fafaddcce79bbd4d781161329" default))))
+(custom-set-faces
+ ;; custom-set-faces 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.
+ )
View
57 defuns/buffer-defuns.el
@@ -34,6 +34,11 @@
(emacs-lisp-mode)
))
+(defun split-window-right-and-move-there-dammit ()
+ (interactive)
+ (split-window-right)
+ (windmove-right))
+
(defun toggle-window-split ()
(interactive)
(if (= (count-windows) 2)
@@ -127,37 +132,6 @@ Symbols matching the text at point are put first in the completion list."
(push-mark (point))
(goto-char position))))
-;;; These belong in coding-hook:
-
-;; We have a number of turn-on-* functions since it's advised that lambda
-;; functions not go in hooks. Repeatedly evaling an add-to-list with a
-;; hook value will repeatedly add it since there's no way to ensure
-;; that a lambda doesn't already exist in the list.
-
-(defun local-column-number-mode ()
- (make-local-variable 'column-number-mode)
- (column-number-mode t))
-
-(defun local-comment-auto-fill ()
- (set (make-local-variable 'comment-auto-fill-only-comments) t)
- (auto-fill-mode t))
-
-(defun turn-on-hl-line-mode ()
- (if window-system (hl-line-mode t)))
-
-(defun turn-on-save-place-mode ()
- (setq save-place t))
-
-(defun turn-on-whitespace ()
- (whitespace-mode t))
-
-(defun turn-off-tool-bar ()
- (tool-bar-mode -1))
-
-(add-hook 'coding-hook 'local-column-number-mode)
-(add-hook 'coding-hook 'local-comment-auto-fill)
-(add-hook 'coding-hook 'turn-on-hl-line-mode)
-
(defun untabify-buffer ()
(interactive)
(untabify (point-min) (point-max)))
@@ -166,28 +140,27 @@ Symbols matching the text at point are put first in the completion list."
(interactive)
(indent-region (point-min) (point-max)))
-(defun cleanup-buffer-safe ()
- "Perform a bunch of safe operations on the whitespace content of a buffer.
-Does not indent buffer, because it is used for a before-save-hook, and that
-might be bad."
- (interactive)
- (untabify-buffer)
- (delete-trailing-whitespace)
- (set-buffer-file-coding-system 'utf-8))
-
(defun cleanup-buffer ()
"Perform a bunch of operations on the whitespace content of a buffer.
Including indent-buffer, which should not be called automatically on save."
(interactive)
- (cleanup-buffer-safe)
+ (untabify-buffer)
+ (delete-trailing-whitespace)
(indent-buffer))
(defun file-name-with-one-directory (file-name)
(concat (cadr (reverse (split-string file-name "/"))) "/"
(file-name-nondirectory file-name)))
+(require 's)
+
+(defvar user-home-directory (concat (expand-file-name "~") "/"))
+
+(defun shorter-file-name (file-name)
+ (s-chop-prefix user-home-directory file-name))
+
(defun recentf--file-cons (file-name)
- (cons (file-name-with-one-directory file-name) file-name))
+ (cons (shorter-file-name file-name) file-name))
(defun recentf-ido-find-file ()
"Find a recent file using ido."
View
38 defuns/clj-defuns.el
@@ -1,32 +1,20 @@
-(defvar clj-project-name "intelliadv"
- "Name of the project")
+(require 's)
-(make-variable-buffer-local 'clj-project-name)
+(defun clj--src-file-name-from-test (name)
+ (s-with name
+ (s-replace "/test/" "/src/")
+ (s-replace "_test.clj" ".clj")))
-(defun clj-source-path-snippet ()
- (concat "/src/" clj-project-name "/"))
-
-(defun clj-test-path-snippet ()
- (concat "/test/" clj-project-name "/test/"))
-
-(defun clj-in-source-file-p ()
- (string-match-p (clj-source-path-snippet) (buffer-file-name)))
-
-(defun clj-in-test-file-p ()
- (string-match-p (clj-test-path-snippet) (buffer-file-name)))
+(defun clj--test-file-name-from-src (name)
+ (s-with name
+ (s-replace "/src/" "/test/")
+ (s-replace ".clj" "_test.clj")))
(defun clj-other-file-name ()
- (when (not (or (clj-in-test-file-p)
- (clj-in-source-file-p)))
- (error "I can't seem to find my bearings. Where are we again?"))
- (or (and (clj-in-source-file-p)
- (replace-regexp-in-string (clj-source-path-snippet)
- (clj-test-path-snippet)
- (buffer-file-name)))
- (and (clj-in-test-file-p)
- (replace-regexp-in-string (clj-test-path-snippet)
- (clj-source-path-snippet)
- (buffer-file-name)))))
+ (let ((name (buffer-file-name)))
+ (if (string-match-p "/test/" name)
+ (clj--src-file-name-from-test name)
+ (clj--test-file-name-from-src name))))
(defun clj-jump-to-other-file (arg)
(interactive "P")
View
94 defuns/editing-defuns.el
@@ -1,4 +1,4 @@
-;; Basic text editing defuns
+;;; editing-defuns.el --- Basic text editing defuns -*- lexical-binding: t; -*-
(defun open-line-below ()
(interactive)
@@ -21,42 +21,72 @@
(indent-for-tab-command))
(indent-for-tab-command))
+(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 "\\]")))))
+ (newline)
+ (when break-open-pair
+ (save-excursion
+ (newline)
+ (indent-for-tab-command)))
+ (indent-for-tab-command)))
+
(defun duplicate-current-line-or-region (arg)
"Duplicates the current line or region ARG times.
If there's no region, the current line will be duplicated."
(interactive "p")
- (save-excursion
- (if (region-active-p)
- (duplicate-region arg)
- (duplicate-current-line arg))))
+ (if (region-active-p)
+ (let ((beg (region-beginning))
+ (end (region-end)))
+ (duplicate-region arg beg end)
+ (one-shot-keybinding "d" (λ (duplicate-region 1 beg end))))
+ (duplicate-current-line arg)
+ (one-shot-keybinding "d" 'duplicate-current-line)))
+
+(defun one-shot-keybinding (key command)
+ (set-temporary-overlay-map
+ (let ((map (make-sparse-keymap)))
+ (define-key map (kbd key) command)
+ map) t))
+
+(defun replace-region-by (fn)
+ (let* ((beg (region-beginning))
+ (end (region-end))
+ (contents (buffer-substring beg end)))
+ (delete-region beg end)
+ (insert (funcall fn contents))))
-(defun duplicate-region (num &optional start end)
+(defun duplicate-region (&optional num start end)
"Duplicates the region bounded by START and END NUM times.
If no START and END is provided, the current region-beginning and
-region-end is used. Adds the duplicated text to the kill ring."
+region-end is used."
(interactive "p")
- (let* ((start (or start (region-beginning)))
- (end (or end (region-end)))
- (region (buffer-substring start end)))
- (kill-ring-save start end)
- (goto-char start)
- (dotimes (i num)
- (insert region))))
-
-(defun duplicate-current-line (num)
+ (save-excursion
+ (let* ((start (or start (region-beginning)))
+ (end (or end (region-end)))
+ (region (buffer-substring start end)))
+ (goto-char end)
+ (dotimes (i num)
+ (insert region)))))
+
+(defun duplicate-current-line (&optional num)
"Duplicate the current line NUM times."
(interactive "p")
- (when (eq (point-at-eol) (point-max))
- (goto-char (point-max))
- (newline)
- (forward-char -1))
- (duplicate-region num (point-at-bol) (1+ (point-at-eol))))
+ (save-excursion
+ (when (eq (point-at-eol) (point-max))
+ (goto-char (point-max))
+ (newline)
+ (forward-char -1))
+ (duplicate-region num (point-at-bol) (1+ (point-at-eol)))))
;; automatically indenting yanked text if in programming-modes
(require 'dash)
(defvar yank-indent-modes '(prog-mode
+ sgml-mode
js2-mode)
"Modes in which to indent regions that are yanked (or yank-popped)")
@@ -187,18 +217,30 @@ region-end is used. Adds the duplicated text to the kill ring."
(goto-char (point-max))
(line-number-at-pos)))))
+(require 's)
+
(defun incs (s &optional num)
- (number-to-string (+ (or num 1) (string-to-number s))))
+ (let* ((inc (or num 1))
+ (new-number (number-to-string (+ inc (string-to-number s))))
+ (zero-padded? (s-starts-with? "0" s)))
+ (if zero-padded?
+ (s-pad-left (length s) "0" new-number)
+ new-number)))
(defun change-number-at-point (arg)
(interactive "p")
(unless (or (looking-at "[0-9]")
(looking-back "[0-9]"))
(error "No number to change at point"))
- (while (looking-back "[0-9]")
- (forward-char -1))
- (re-search-forward "[0-9]+" nil)
- (replace-match (incs (match-string 0) arg) nil nil))
+ (save-excursion
+ (while (looking-back "[0-9]")
+ (forward-char -1))
+ (re-search-forward "[0-9]+" nil)
+ (replace-match (incs (match-string 0) arg) nil nil)))
+
+(defun subtract-number-at-point (arg)
+ (interactive "p")
+ (change-number-at-point (- arg)))
(defun replace-next-underscore-with-camel (arg)
(interactive "p")
View
11 defuns/js2r-defuns.el
@@ -28,6 +28,17 @@
(jump-to-source-file-other-window arg)
(jump-to-test-file-other-window arg)))
+;; Duplicate object property node
+
+(defun js2r-duplicate-object-property-node ()
+ (interactive)
+ (js2r--guard)
+ (let ((node (js2r--closest 'js2-object-prop-node-p)))
+ (goto-char (js2-node-abs-pos node))
+ (skip-syntax-backward " >")
+ (insert (buffer-substring (point) (js2-node-abs-end node)) ",")
+ (skip-syntax-forward " >")))
+
;; Rename tests and sources
(defun js2r--rename-file (old-name new-name)
View
70 defuns/misc-defuns.el
@@ -26,18 +26,72 @@
(call-interactively 'goto-line))
(linum-mode -1)))
+;; start a httpd-server in current directory
+(defun httpd-start-here (directory port)
+ (interactive (list (read-directory-name "Root directory: " default-directory nil t)
+ (read-number "Port: " 8017)))
+ (setq httpd-root directory)
+ (setq httpd-port port)
+ (httpd-start)
+ (browse-url (concat "http://localhost:" (number-to-string port) "/")))
+
+;; shorthand for interactive lambdas
+(defmacro λ (&rest body)
+ `(lambda ()
+ (interactive)
+ ,@body))
+
+(global-set-key (kbd "s-l") (λ (insert "\u03bb")))
+
+;; command to help set up magit-gh-pulls
+(defun magit-gh-pulls-setup (repoid)
+ (interactive "suser/repo: ")
+ (shell-command "git config --add magit.extension gh-pulls")
+ (shell-command (concat "git config magit.gh-pulls-repo " repoid)))
+
+;; Increase/decrease selective display
+(defun inc-selective-display (arg)
+ (interactive "P")
+ (if (numberp arg)
+ (set-selective-display arg)
+ (if (numberp selective-display)
+ (set-selective-display (+ 2 selective-display))
+ (set-selective-display 2)))
+ (create-temp-selective-display-keymap))
+
+(defun dec-selective-display ()
+ (interactive)
+ (when (and (numberp selective-display)
+ (> selective-display 2))
+ (set-selective-display (- selective-display 2)))
+ (create-temp-selective-display-keymap))
+
+(defun clear-selective-display ()
+ (interactive)
+ (when (numberp selective-display)
+ (set-selective-display nil)))
+
+(defun create-temp-selective-display-keymap ()
+ (set-temporary-overlay-map
+ (let ((map (make-sparse-keymap)))
+ (define-key map (kbd "+") 'inc-selective-display)
+ (define-key map (kbd "-") 'dec-selective-display)
+ (define-key map (kbd "0") 'clear-selective-display)
+ map))
+ (message "Type + to reveal more, - for less, 0 to reset."))
+
;; Add spaces and proper formatting to linum-mode. It uses more room than
;; necessary, but that's not a problem since it's only in use when going to
;; lines.
(setq linum-format (lambda (line)
- (propertize
- (format (concat " %"
- (number-to-string
- (length (number-to-string
- (line-number-at-pos (point-max)))))
- "d ")
- line)
- 'face 'linum)))
+ (propertize
+ (format (concat " %"
+ (number-to-string
+ (length (number-to-string
+ (line-number-at-pos (point-max)))))
+ "d ")
+ line)
+ 'face 'linum)))
(defun isearch-yank-selection ()
"Put selection from buffer into search string."
View
11 defuns/project-defuns.el
@@ -0,0 +1,11 @@
+(defmacro project-specifics (name &rest body)
+ (declare (indent 1))
+ `(progn
+ (add-hook 'find-file-hook
+ (lambda ()
+ (when (string-match-p ,name (buffer-file-name))
+ ,@body)))
+ (add-hook 'dired-after-readin-hook
+ (lambda ()
+ (when (string-match-p ,name (dired-current-directory))
+ ,@body)))))
View
2 defuns/snippet-helpers.el
@@ -31,7 +31,7 @@
(substring (buffer-file-name) (length eproject-root))))))))
(defun snippet--clojure-namespace-under-test ()
- (replace-regexp-in-string ".test." "." (snippet--clojure-namespace-from-buffer-file-name)))
+ (replace-regexp-in-string "-test" "" (snippet--clojure-namespace-from-buffer-file-name)))
;; snippet-helper-helpers
View
92 init.el
@@ -14,6 +14,16 @@
(add-to-list 'load-path user-emacs-directory)
(add-to-list 'load-path site-lisp-dir)
+;; Keep emacs Custom-settings in separate file
+(setq custom-file (expand-file-name "custom.el" user-emacs-directory))
+(load custom-file)
+
+;; Are we on a mac?
+(setq is-mac (equal system-type 'darwin))
+
+;; Set up appearance early
+(require 'appearance)
+
;; Settings for currently logged in user
(setq user-settings-dir
(concat user-emacs-directory "users/" user-login-name))
@@ -24,10 +34,6 @@
(when (file-directory-p project)
(add-to-list 'load-path project)))
-;; Keep emacs Custom-settings in separate file
-(setq custom-file (expand-file-name "custom.el" user-emacs-directory))
-(load custom-file)
-
;; Write backup files to own directory
(setq backup-directory-alist
`(("." . ,(expand-file-name
@@ -41,33 +47,31 @@
(setq-default save-place t)
(setq save-place-file (expand-file-name ".places" user-emacs-directory))
-;; Are we on a mac?
-(setq is-mac (equal system-type 'darwin))
-
-;; Setup elnode before packages to stop it from starting a server
-;;(require 'setup-elnode)
-
;; Setup packages
(require 'setup-package)
;; Install extensions if they're missing
(defun init--install-packages ()
(packages-install
- (cons 'exec-path-from-shell melpa)
- (cons 'magit melpa)
- (cons 'paredit melpa)
- (cons 'move-text melpa)
- (cons 'gist melpa)
- (cons 'htmlize melpa)
- (cons 'elisp-slime-nav melpa)
- ;(cons 'elnode marmalade)
- (cons 'slime-js marmalade)
- (cons 'git-commit-mode melpa)
- (cons 'gitconfig-mode melpa)
- (cons 'gitignore-mode melpa)
- (cons 'clojure-mode melpa)
- (cons 'clojure-test-mode melpa)
- (cons 'nrepl melpa)))
+ '(magit
+ paredit
+ move-text
+ gist
+ htmlize
+ visual-regexp
+ flycheck
+ smartparens
+ ido-vertical-mode
+ simple-httpd
+ nodejs-repl
+ restclient
+ highlight-escape-sequences
+ elisp-slime-nav
+ git-commit-mode
+ gitconfig-mode
+ gitignore-mode
+ clojure-mode
+ nrepl)))
(condition-case nil
(init--install-packages)
@@ -79,7 +83,9 @@
(require 'sane-defaults)
;; Setup environment variables from the user's shell.
-(when is-mac (exec-path-from-shell-initialize))
+(when is-mac
+ (require-package 'exec-path-from-shell)
+ (exec-path-from-shell-initialize))
;; Setup extensions
(eval-after-load 'ido '(require 'setup-ido))
@@ -95,22 +101,43 @@
(require 'setup-html-mode)
(require 'setup-paredit)
+;; Default setup of smartparens
+(require 'smartparens-config)
+(setq sp-autoescape-string-quote nil)
+(--each '(css-mode-hook
+ restclient-mode-hook
+ js-mode-hook
+ markdown-mode)
+ (add-hook it 'turn-on-smartparens-mode))
+
;; Language specific setup files
(eval-after-load 'js2-mode '(require 'setup-js2-mode))
(eval-after-load 'ruby-mode '(require 'setup-ruby-mode))
(eval-after-load 'clojure-mode '(require 'setup-clojure-mode))
(eval-after-load 'markdown-mode '(require 'setup-markdown-mode))
-;; Load slime-js when asked for
-(autoload 'slime-js-jack-in-browser "setup-slime-js" nil t)
-(autoload 'slime-js-jack-in-node "setup-slime-js" nil t)
+;; Load stuff on demand
+(autoload 'skewer-start "setup-skewer" nil t)
+(autoload 'skewer-demo "setup-skewer" nil t)
+(autoload 'flycheck-mode "setup-flycheck" nil t)
+(autoload 'auto-complete-mode "auto-complete" nil t)
;; Map files to modes
(require 'mode-mappings)
;; Calendar stuff
(require 'setup-calendar)
+;; Highlight escape sequences
+(require 'highlight-escape-sequences)
+(hes-mode)
+(put 'font-lock-regexp-grouping-backslash 'face-alias 'font-lock-builtin-face)
+
+;; Visual regexp
+(require 'visual-regexp)
+(define-key global-map (kbd "M-&") 'vr/query-replace)
+(define-key global-map (kbd "M-/") 'vr/replace)
+
;; Functions (load all files in defuns-dir)
(setq defuns-dir (expand-file-name "defuns" user-emacs-directory))
(dolist (file (directory-files defuns-dir t "\\w+"))
@@ -145,14 +172,13 @@
(require 'key-bindings)
;; Misc
-(require 'appearance)
+(require 'project-archetypes)
(require 'my-misc)
(when is-mac (require 'mac))
;; Elisp go-to-definition with M-. and back again with M-,
(autoload 'elisp-slime-nav-mode "elisp-slime-nav")
-(add-hook 'emacs-lisp-mode-hook (lambda () (elisp-slime-nav-mode t)))
-(eval-after-load 'elisp-slime-nav '(diminish 'elisp-slime-nav-mode))
+(add-hook 'emacs-lisp-mode-hook (lambda () (elisp-slime-nav-mode t) (eldoc-mode 1)))
;; Email, baby
(require 'setup-mu4e)
@@ -164,12 +190,14 @@
;; Run at full power please
(put 'downcase-region 'disabled nil)
+(put 'upcase-region 'disabled nil)
(put 'narrow-to-region 'disabled nil)
;; Diminish modeline clutter
(require 'diminish)
(diminish 'yas/minor-mode)
+;; Unicode without the hassle
(require 'unicode-mode)
;; Conclude init by setting up specifics for the current user
View
66 key-bindings.el
@@ -6,6 +6,10 @@
;; Completion that uses many different methods to find options.
(global-set-key (kbd "C-.") 'hippie-expand-no-case-fold)
(global-set-key (kbd "C-:") 'hippie-expand-lines)
+(global-set-key (kbd "C-,") 'completion-at-point)
+
+(require 'misc)
+(global-set-key (kbd "s-.") 'copy-from-above-command)
;; Smart M-x
(global-set-key (kbd "M-x") 'smex)
@@ -38,6 +42,13 @@
(global-set-key (kbd "s-Å") 'mc/mark-previous-symbol-like-this)
(global-set-key (kbd "M-s-Æ") 'mc/mark-all-symbols-like-this)
+;; Extra multiple cursors stuff
+(global-set-key (kbd "C-~") 'mc/reverse-regions)
+(global-set-key (kbd "M-~") 'mc/sort-regions)
+(global-set-key (kbd "H-~") 'mc/insert-numbers)
+
+(global-set-key (kbd "C-S-<mouse-1>") 'mc/add-cursor-on-click)
+
;; Set anchor to start rectangular-region-mode
(global-set-key (kbd "C-M-SPC") 'set-rectangular-region-anchor)
@@ -61,13 +72,18 @@
(define-key key-translation-map [?\C-h] [?\C-?])
(global-set-key (kbd "<f1>") 'help-command)
+(global-set-key (kbd "M-h") 'kill-region-or-backward-word)
+
;; Transpose stuff with M-t
(global-unset-key (kbd "M-t")) ;; which used to be transpose-words
(global-set-key (kbd "M-t l") 'transpose-lines)
(global-set-key (kbd "M-t w") 'transpose-words)
(global-set-key (kbd "M-t s") 'transpose-sexps)
(global-set-key (kbd "M-t p") 'transpose-params)
+;; Interactive selective display
+(global-set-key (kbd "C-x $") 'inc-selective-display)
+
;; Change next underscore with a camel case
(global-set-key (kbd "C-c C--") 'replace-next-underscore-with-camel)
(global-set-key (kbd "M-s M--") 'snakeify-current-word)
@@ -79,19 +95,23 @@
;; Use M-w for copy-line if no active region
(global-set-key (kbd "M-w") 'save-region-or-current-line)
-(global-set-key (kbd "M-W") '(lambda () (interactive) (save-region-or-current-line 1)))
+(global-set-key (kbd "M-W") '(λ (save-region-or-current-line 1)))
;; Make shell more convenient, and suspend-frame less
(global-set-key (kbd "C-z") 'shell)
(global-set-key (kbd "C-x M-z") 'suspend-frame)
;; Zap to char
(global-set-key (kbd "M-z") 'zap-up-to-char)
+(global-set-key (kbd "s-z") (lambda (char) (interactive "cZap up to char backwards: ") (zap-up-to-char -1 char)))
+
(global-set-key (kbd "M-Z") 'zap-to-char)
+(global-set-key (kbd "s-Z") (lambda (char) (interactive "cZap to char backwards: ") (zap-to-char -1 char)))
;; iy-go-to-char - like f in Vim
(global-set-key (kbd "M-m") 'jump-char-forward)
(global-set-key (kbd "M-M") 'jump-char-backward)
+(global-set-key (kbd "s-m") 'jump-char-backward)
;; vim's ci and co commands
(global-set-key (kbd "M-I") 'change-inner)
@@ -101,6 +121,9 @@
(define-key global-map (kbd "C-+") 'zoom-frm-in)
(define-key global-map (kbd "C--") 'zoom-frm-out)
+(global-set-key (kbd "s-i") 'copy-inner)
+(global-set-key (kbd "s-o") 'copy-outer)
+
;; Create new frame
(define-key global-map (kbd "C-x C-n") 'make-frame-command)
@@ -117,6 +140,13 @@
(global-set-key (kbd "M-`") 'file-cache-minibuffer-complete)
(global-set-key (kbd "C-x C-b") 'ibuffer)
+;; toggle two most recent buffers
+(fset 'quick-switch-buffer [?\C-x ?b return])
+(global-set-key (kbd "s-b") 'quick-switch-buffer)
+
+;; Revert without any fuss
+(global-set-key (kbd "M-<escape>") (λ (revert-buffer t t)))
+
;; Edit file with sudo
(global-set-key (kbd "M-s e") 'sudo-edit)
@@ -125,15 +155,17 @@
;; Window switching
(windmove-default-keybindings) ;; Shift+direction
-(global-set-key (kbd "C-x -") 'rotate-windows)
-(global-set-key (kbd "C-x C--") 'toggle-window-split)
+(global-set-key (kbd "C-x -") 'toggle-window-split)
+(global-set-key (kbd "C-x C--") 'rotate-windows)
(global-unset-key (kbd "C-x C-+")) ;; don't zoom like this
+(global-set-key (kbd "C-x 3") 'split-window-right-and-move-there-dammit)
+
;; Add region to *multifile*
(global-set-key (kbd "C-!") 'mf/mirror-region-in-multifile)
;; Indentation help
-(global-set-key (kbd "M-j") (lambda () (interactive) (join-line -1)))
+(global-set-key (kbd "M-j") (λ (join-line -1)))
;; Help should search more than just commands
(global-set-key (kbd "<f1> a") 'apropos)
@@ -177,12 +209,15 @@
(global-set-key (kbd "C-S-r") 'isearch-backward)
;; Move more quickly
-(global-set-key (kbd "C-S-n") (lambda () (interactive) (next-line 5)))
-(global-set-key (kbd "C-S-p") (lambda () (interactive) (previous-line 5)))
-(global-set-key (kbd "C-S-f") (lambda () (interactive) (forward-char 5)))
-(global-set-key (kbd "C-S-b") (lambda () (interactive) (backward-char 5)))
-;; Convenience on ThinkPad Keyboard: Use back/forward as pg up/down
+(global-set-key (kbd "C-S-n") (λ (ignore-errors (next-line 5))))
+(global-set-key (kbd "C-S-p") (λ (ignore-errors (previous-line 5))))
+(global-set-key (kbd "C-S-f") (λ (ignore-errors (forward-char 5))))
+(global-set-key (kbd "C-S-b") (λ (ignore-errors (backward-char 5))))
+
+(global-set-key (kbd "H-*") 'beginning-of-buffer) ;; H-p
+(global-set-key (kbd "H-n") 'end-of-buffer)
+;; Convenience on ThinkPad Keyboard: Use back/forward as pg up/down
(global-set-key (kbd "<XF86Back>") 'scroll-down)
(global-set-key (kbd "<XF86Forward>") 'scroll-up)
(global-set-key (kbd "<XF86WakeUp>") 'beginning-of-buffer)
@@ -198,7 +233,7 @@
(global-set-key (kbd "C-c u") 'uncomment-region)
;; Eval buffer
-(global-set-key (kbd "C-c v") 'eval-buffer)
+(global-set-key (kbd "C-c C-k") 'eval-buffer)
;; Create scratch buffer
(global-set-key (kbd "C-c b") 'create-scratch-buffer)
@@ -219,7 +254,7 @@
;; Clever newlines
(global-set-key (kbd "<C-return>") 'open-line-below)
(global-set-key (kbd "<C-S-return>") 'open-line-above)
-(global-set-key (kbd "<M-return>") 'new-line-in-between)
+(global-set-key (kbd "<M-return>") 'new-line-dwim)
;; Duplicate region
(global-set-key (kbd "C-c d") 'duplicate-current-line-or-region)
@@ -244,6 +279,8 @@
;; Increase number at point (or other change based on prefix arg)
(global-set-key (kbd "C-M-+") 'change-number-at-point)
+(global-set-key (kbd "C-?") 'subtract-number-at-point)
+(eval-after-load 'undo-tree '(define-key undo-tree-map (kbd "C-?") nil))
;; Browse the kill ring
(global-set-key (kbd "C-x C-y") 'browse-kill-ring)
@@ -255,7 +292,7 @@
;; Jump from file to containing directory
(global-set-key (kbd "C-x C-j") 'dired-jump) (autoload 'dired-jump "dired")
-(global-set-key (kbd "C-x M-j") '(lambda () (interactive) (dired-jump 1)))
+(global-set-key (kbd "C-x M-j") '(λ (dired-jump 1)))
;; Easy-mode fullscreen rgrep
(global-set-key (kbd "M-s s") 'git-grep-fullscreen)
@@ -278,6 +315,7 @@
(global-unset-key (kbd "C-x C-o")) ;; which used to be delete-blank-lines (also bound to C-c C-<return>)
(global-set-key (kbd "C-x C-o ja") (ffip-create-pattern-file-finder "*.java"))
(global-set-key (kbd "C-x C-o js") (ffip-create-pattern-file-finder "*.js"))
+(global-set-key (kbd "C-x C-o ht") (ffip-create-pattern-file-finder "*.html"))
(global-set-key (kbd "C-x C-o jp") (ffip-create-pattern-file-finder "*.jsp"))
(global-set-key (kbd "C-x C-o cs") (ffip-create-pattern-file-finder "*.css"))
(global-set-key (kbd "C-x C-o cl") (ffip-create-pattern-file-finder "*.clj"))
@@ -288,6 +326,10 @@
(global-set-key (kbd "C-x C-o ph") (ffip-create-pattern-file-finder "*.php"))
(global-set-key (kbd "C-x C-o tx") (ffip-create-pattern-file-finder "*.txt"))
(global-set-key (kbd "C-x C-o vm") (ffip-create-pattern-file-finder "*.vm"))
+(global-set-key (kbd "C-x C-o xm") (ffip-create-pattern-file-finder "*.xml"))
+(global-set-key (kbd "C-x C-o pr") (ffip-create-pattern-file-finder "*.properties"))
+(global-set-key (kbd "C-x C-o in") (ffip-create-pattern-file-finder "*.ini"))
+(global-set-key (kbd "C-x C-o gr") (ffip-create-pattern-file-finder "*.groovy"))
;; View occurrence in occur mode
(define-key occur-mode-map (kbd "v") 'occur-mode-display-occurrence)
View
74 mac.el
@@ -1,14 +1,76 @@
+(require 'dash)
+
;; change command to meta, and ignore option to use weird Norwegian keyboard
-(setq mac-option-modifier 'none)
+(setq mac-option-modifier 'super)
(setq mac-command-modifier 'meta)
(setq ns-function-modifier 'hyper)
-;; mac friendly font
-(set-face-attribute 'default nil :font "Monaco-16")
+;; Norwegian mac-keyboard alt-keys)
+(define-key key-translation-map (kbd "s-8") (kbd "["))
+(define-key key-translation-map (kbd "s-(") (kbd "{"))
+(define-key key-translation-map (kbd "s-9") (kbd "]"))
+(define-key key-translation-map (kbd "s-)") (kbd "}"))
+(define-key key-translation-map (kbd "s-7") (kbd "|"))
+(define-key key-translation-map (kbd "s-/") (kbd "\\"))
+(define-key key-translation-map (kbd "M-s-7") (kbd "M-|"))
+
+(global-set-key (kbd "s-u") 'universal-argument)
+(global-set-key (kbd "s--") 'negative-argument)
+(--dotimes 5 (global-set-key (read-kbd-macro (format "s-%d" it)) 'digit-argument))
+
+;; redefine read-char, at least for invocation from elisp
+(defun read-char (&optional prompt) ;; (inherit-input-method seconds)
+ "Read a character from the command input (keyboard or macro).
+ It is returned as a number.
+ If the character has modifiers, they are resolved and reflected to the
+ character code if possible (e.g. C-SPC -> 0).
-;; make sure path is correct when launched as application
-(setenv "PATH" (concat "/usr/local/bin:" (getenv "PATH")))
-(push "/usr/local/bin" exec-path)
+ If the user generates an event which is not a character (i.e. a mouse
+ click or function key event), `read-char' signals an error. As an
+ exception, switch-frame events are put off until non-character events
+ can be read.
+ If you want to read non-character events, or ignore them, call
+ `read-event' or `read-char-exclusive' instead.
+
+ If the optional argument PROMPT is non-nil, display that as a prompt.
+ If the optional argument INHERIT-INPUT-METHOD is non-nil and some
+ input method is turned on in the current buffer, that input method
+ is used for reading a character.
+ If the optional argument SECONDS is non-nil, it should be a number
+ specifying the maximum number of seconds to wait for input. If no
+ input arrives in that time, return nil. SECONDS may be a
+ floating-point value."
+ ;; if (! NILP (prompt))
+ ;; message_with_string ("%s", prompt, 0);
+ ;; val = read_filtered_event (1, 1, 1, ! NILP (inherit_input_method),
+ ;; seconds);
+ ;; return (NILP (val) ? Qnil
+ ;; : make_number (char_resolve_modifier_mask (XINT (val))));
+ (let ((inherit-input-method nil) (seconds nil))
+ ;; `read-key' doesn't explicitly inhibit the input method, but in
+ ;; practice it disables at least quail input methods because it
+ ;; binds overriding-terminal-local-map.
+ (if inherit-input-method (error "Not implemented"))
+ (catch 'read-char-exclusive
+ (let ((timer (when seconds
+ (run-with-timer seconds nil
+ (lambda ()
+ (throw 'read-char-exclusive nil))))))
+ (unwind-protect
+ (let ((event (read-key prompt)))
+ (if (numberp event)
+ event
+ (setq unread-command-events
+ (nconc (mapcar 'identity (this-single-command-raw-keys))
+ unread-command-events))
+ (error "Non-character input-event")))
+ (when timer (cancel-timer timer)))))))
+
+;; mac friendly font
+(when window-system
+ (setq magnars/default-font "-apple-Monaco-medium-normal-normal-*-16-*-*-*-m-0-iso10646-1")
+ (setq magnars/presentation-font "-apple-Monaco-medium-normal-normal-*-28-*-*-*-m-0-iso10646-1")
+ (set-face-attribute 'default nil :font magnars/default-font))
;; keybinding to toggle full screen mode
(global-set-key (quote [M-f10]) (quote ns-toggle-fullscreen))
View
4 mode-mappings.el
@@ -9,6 +9,9 @@
;; CSS
(add-to-list 'auto-mode-alist '("\\.scss$" . css-mode))
+;; Restclient
+(add-to-list 'auto-mode-alist '("\\.restclient$" . restclient-mode))
+
;; Cucumber
(autoload 'feature-mode "feature-mode")
(add-to-list 'auto-mode-alist '("\\.feature$" . feature-mode))
@@ -76,6 +79,7 @@
(autoload 'js2-mode "js2-mode" nil t)
(add-to-list 'auto-mode-alist '("\\.js$" . js2-mode))
(add-to-list 'auto-mode-alist '("\\.json$" . javascript-mode))
+(add-to-list 'auto-mode-alist '("\\.jshintrc$" . javascript-mode))
(add-to-list 'magic-mode-alist '("#!/usr/bin/env node" . js2-mode))
;; Configuration files
View
15 my-misc.el
@@ -1,6 +1,18 @@
;; Seed the random-number generator
(random t)
+;; Keep region when undoing in region
+(defadvice undo-tree-undo (around keep-region activate)
+ (if (use-region-p)
+ (let ((m (set-marker (make-marker) (mark)))
+ (p (set-marker (make-marker) (point))))
+ ad-do-it
+ (goto-char p)
+ (set-mark m)
+ (set-marker p nil)
+ (set-marker m nil))
+ ad-do-it))
+
;; Whitespace-style
(setq whitespace-style '(trailing lines space-before-tab
indentation space-after-tab)
@@ -15,7 +27,8 @@
""])))
;; Various superfluous white-space. Just say no.
-(add-hook 'before-save-hook 'cleanup-buffer-safe)
+(add-hook 'before-save-hook 'whitespace-cleanup)
+(add-hook 'makefile-mode-hook 'indent-tabs-mode)
;; Newline after inserting closing tag in html-mode
(defadvice sgml-close-tag (after close-tag-then-newline activate)
View
14 project-archetypes/clj-ring-archetype.el
@@ -0,0 +1,14 @@
+(defun create-clj-ring (project-name)
+ (interactive "sProject name: ")
+ (pa-with-new-project project-name "clj-ring"
+ ((cons "__project-name__" project-name)
+ (cons "__project_name__" (s-snake-case project-name)))))
+
+(defun pa--testing-fn ()
+ (shell-command "rm -rf ~/projects/test-test" pa-out)
+ (create-clj-ring "test-test")
+ (find-file-other-window "~/projects/test-test"))
+
+(pa-declare-project-archetype "clj-ring" 'create-clj-ring)
+
+(provide 'clj-ring-archetype)
View
12 project-archetypes/clj-ring/.gitignore
@@ -0,0 +1,12 @@
+/target
+/lib
+/classes
+/checkouts
+pom.xml
+pom.xml.asc
+*.jar
+*.class
+.lein-deps-sum
+.lein-failures
+.lein-plugins
+.lein-repl-history
View
2 project-archetypes/clj-ring/resources/public/css/reset.css
@@ -0,0 +1,2 @@
+/* Eric Meyer's Reset CSS v2.0 - http://cssreset.com */
+html,body,div,span,object,iframe,h1,h2,h3,h4,h5,h6,p,blockquote,pre,a,abbr,acronym,address,big,cite,code,del,dfn,em,img,ins,kbd,q,s,samp,small,strike,strong,sub,sup,tt,var,b,u,i,center,dl,dt,dd,ol,ul,li,fieldset,form,label,legend,table,caption,tbody,tfoot,thead,tr,th,td,article,aside,canvas,details,embed,figure,figcaption,footer,header,hgroup,menu,nav,output,ruby,section,summary,time,mark,audio,video{border:0;font-size:100%;font:inherit;vertical-align:baseline;margin:0;padding:0}article,aside,details,figcaption,figure,footer,header,hgroup,menu,nav,section{display:block}body{line-height:1}ol,ul{list-style:none}blockquote,q{quotes:none}blockquote:before,blockquote:after,q:before,q:after{content:none}table{border-collapse:collapse;border-spacing:0}
View
17 project-archetypes/clj-ring/src/__project_name__/core.clj
@@ -0,0 +1,17 @@
+(ns __project-name__.core
+ (:use compojure.core)
+ (:use hiccup.core)
+ (:use hiccup.page)
+ (:require [compojure.route :as route]))
+
+(defn render-index []
+ (html5
+ [:head
+ [:meta {:charset "utf-8"}]
+ [:meta {:name "viewport"
+ :content "width=device-width, initial-scale=1.0, maximum-scale=1"}]]))
+
+(defroutes app
+ (GET "/" [] (render-index))
+ (route/resources "/")
+ (route/not-found "<h1>Page not found</h1>"))
View
10 project-archetypes/emacs-package-archetype.el
@@ -0,0 +1,10 @@
+(defun create-emacs-package (project-name description)
+ (interactive "sProject name: \nsDescription: ")
+ (pa-with-new-project project-name "emacs-package"
+ ((cons "__project-name__" project-name)
+ (cons "__description__" description))
+ (pa-sh "carton")))
+
+(pa-declare-project-archetype "emacs-package" 'create-emacs-package)
+
+(provide 'emacs-package-archetype)
View
4 project-archetypes/emacs-package/.gitignore
@@ -0,0 +1,4 @@
+*.elc
+.rvmrc
+/TAGS
+elpa
View
22 project-archetypes/emacs-package/.travis.yml
@@ -0,0 +1,22 @@
+language: emacs-lisp
+before_install:
+ - if [ "$EMACS" = 'emacs-snapshot' ]; then
+ sudo add-apt-repository -y ppa:cassou/emacs &&
+ sudo apt-get update -qq &&
+ sudo apt-get install -qq
+ emacs-snapshot-el emacs-snapshot-gtk emacs-snapshot;
+ fi
+ - if [ "$EMACS" = 'emacs24' ]; then
+ sudo add-apt-repository -y ppa:cassou/emacs &&
+ sudo apt-get update -qq &&
+ sudo apt-get install -qq
+ emacs24 emacs24-el emacs24-common-non-dfsg;
+ fi
+ - curl -fsSkL https://raw.github.com/rejeep/carton/master/go | sh
+ - export PATH="/home/travis/.carton/bin:$PATH"
+ - carton
+env:
+ - EMACS=emacs24 TAGS="--tags ~@requires-e24-3"
+ - EMACS=emacs-snapshot TAGS=""
+script:
+ ./run-travis-ci.sh
View
7 project-archetypes/emacs-package/Carton
@@ -0,0 +1,7 @@
+(source "melpa" "http://melpa.milkbox.net/packages/")
+
+(package-file "__project-name__.el")
+
+(development
+ (depends-on "ecukes")
+ (depends-on "espuds"))
View
59 project-archetypes/emacs-package/README.md
@@ -0,0 +1,59 @@
+# __project-name__.el [![Build Status](https://secure.travis-ci.org/magnars/__project-name__.el.png)](http://travis-ci.org/magnars/__project-name__.el)
+
+__description__
+
+## Installation
+
+I highly recommend installing __project-name__ through elpa.
+
+It's available on [marmalade](http://marmalade-repo.org/) and
+[melpa](http://melpa.milkbox.net/):
+
+ M-x package-install __project-name__
+
+You can also install the dependencies on your own, and just dump
+__project-name__ in your path somewhere:
+
+ - <a href="https://github.com/magnars/s.el">s.el</a>
+ - <a href="https://github.com/magnars/dash.el">dash.el</a>
+
+## Contribute
+
+Yes, please do. :-)
+
+All changes must be accompanied by feature tests, or I might break it later.
+They are written in [Ecukes](http://ecukes.info), a Cucumber for Emacs.
+
+You'll find the repo at:
+
+ https://github.com/magnars/__project-name__.el
+
+To fetch the test dependencies, install
+[carton](https://github.com/rejeep/carton) if you haven't already,
+then:
+
+ $ cd /path/to/__project-name__
+ $ carton
+
+Run the tests with:
+
+ $ ./run-tests.sh
+
+## License
+
+Copyright (C) 2013 Magnar Sveen
+
+Author: Magnar Sveen <magnars@gmail.com>
+
+This program is free software; you can redistribute it and/or modify
+it under the terms of the GNU General Public License as published by
+the Free Software Foundation, either version 3 of the License, or
+(at your option) any later version.
+
+This program is distributed in the hope that it will be useful,
+but WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+GNU General Public License for more details.
+
+You should have received a copy of the GNU General Public License
+along with this program. If not, see <http://www.gnu.org/licenses/>.
View
29 project-archetypes/emacs-package/__project-name__.el
@@ -0,0 +1,29 @@
+;;; __project-name__.el --- __description__
+
+;; Copyright (C) 2013 Magnar Sveen
+
+;; Author: Magnar Sveen <magnars@gmail.com>
+;; Version: 0.1.0
+;; Package-Requires: ((s "1.4.0") (dash "1.2.0"))
+
+;; This program is free software; you can redistribute it and/or modify
+;; it under the terms of the GNU General Public License as published by
+;; the Free Software Foundation, either version 3 of the License, or
+;; (at your option) any later version.
+
+;; This program is distributed in the hope that it will be useful,
+;; but WITHOUT ANY WARRANTY; without even the implied warranty of
+;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+;; GNU General Public License for more details.
+
+;; You should have received a copy of the GNU General Public License
+;; along with this program. If not, see <http://www.gnu.org/licenses/>.
+
+;;; Commentary:
+
+;; __description__
+
+;;; Code:
+
+(provide '__project-name__)
+;;; __project-name__.el ends here
View
3 project-archetypes/emacs-package/features/__project-name__.feature
@@ -0,0 +1,3 @@
+Feature:
+
+ Scenario:
View
23 project-archetypes/emacs-package/features/step-definitions/__project-name__-steps.el
@@ -0,0 +1,23 @@
+(eval-when-compile (require 'cl))
+
+(When "^I place the cursor after \"\\(.+\\)\"$"
+ (lambda (arg)
+ (goto-char (point-min))
+ (let ((search (search-forward arg nil t))
+ (message "Can not place cursor after '%s', because there is no such point: '%s'"))
+ (assert search nil message arg (espuds-buffer-contents)))))
+
+(When "^I place the cursor before \"\\(.+\\)\"$"
+ (lambda (arg)
+ (goto-char (point-max))
+ (let ((search (search-backward arg nil t))
+ (message "Can not place cursor before '%s', because there is no such point: '%s'"))
+ (assert search nil message arg (espuds-buffer-contents)))))
+
+(When "^I go to the \\(front\\|end\\) of the word \"\\(.+\\)\"$"
+ (lambda (pos word)
+ (goto-char (point-min))
+ (let ((search (re-search-forward (format "%s" word) nil t))
+ (message "Can not go to character '%s' since it does not exist in the current buffer: %s"))
+ (assert search nil message word (espuds-buffer-contents))
+ (if (string-equal "front" pos) (backward-word)))))
View
19 project-archetypes/emacs-package/features/support/env.el
@@ -0,0 +1,19 @@
+(let* ((current-directory (file-name-directory load-file-name))
+ (features-directory (expand-file-name ".." current-directory))
+ (project-directory (expand-file-name ".." features-directory)))
+ (setq __project-name__-root-path project-directory))
+
+(add-to-list 'load-path __project-name__-root-path)
+
+(require '__project-name__)
+(require 'espuds)
+(require 'ert)
+
+(Before
+ (switch-to-buffer
+ (get-buffer-create "*__project-name__*"))
+ (erase-buffer)
+ (fundamental-mode)
+ (deactivate-mark))
+
+(After)
View
3 project-archetypes/emacs-package/run-tests.sh
@@ -0,0 +1,3 @@
+#!/bin/sh -e
+ECUKES=$(find elpa/ecukes-*/ecukes | tail -1)
+carton exec "$ECUKES" "$@"
View
13 project-archetypes/emacs-package/run-travis-ci.sh
@@ -0,0 +1,13 @@
+#!/bin/sh -e
+
+cd "$(dirname "$0")"
+
+ECUKES_EMACS=${EMACS:-$(which emacs)}
+export ECUKES_EMACS
+
+echo "*** Emacs version ***"
+echo "ECUKES_EMACS = $ECUKES_EMACS"
+"$ECUKES_EMACS" --version
+echo
+
+exec ./run-tests.sh $TAGS
View
45 project-archetypes/emacs-package/watch-tests.watchr
@@ -0,0 +1,45 @@
+ENV["WATCHR"] = "1"
+system 'clear'
+
+def run(cmd)
+ `#{cmd}`
+end
+
+def run_all_tests
+ system('clear')
+ result = run "./run-tests.sh"
+ puts result
+end
+
+def run_test(file)
+ system('clear')
+ result = run "./run-tests.sh #{file} --verbose"
+ puts result
+end
+
+run_all_tests
+watch('.*.feature') { |file| run_test file }
+watch('.*.el') { run_all_tests }
+
+# Ctrl-\
+Signal.trap 'QUIT' do
+ puts " --- Running all tests ---\n\n"
+ run_all_tests
+end
+
+@interrupted = false
+
+# Ctrl-C
+Signal.trap 'INT' do
+ if @interrupted then
+ @wants_to_quit = true
+ abort("\n")
+ else
+ puts "Interrupt a second time to quit"
+ @interrupted = true
+ Kernel.sleep 1.5
+ # raise Interrupt, nil # let the run loop catch it
+ run_all_tests
+ @interrupted = false
+ end
+end
View
13 project-archetypes/emacs-snippets-archetype.el
@@ -0,0 +1,13 @@
+(defun create-emacs-snippets (target name website major-mode)
+ (interactive "sSnippets for (short name): \nsSnippets for (full name): \nsWebsite: \naMajor mode: ")
+ (pa-with-new-project (format "%s-snippets" target) "emacs-snippets"
+ ((cons "__target__" target)
+ (cons "__name__" name)
+ (cons "__website__" website)
+ (cons "__major-mode__" (format "%S" major-mode))
+ (cons "__year__" (format-time-string "%Y")))
+ (pa-sh "carton package")))
+
+(pa-declare-project-archetype "emacs-snippets" 'create-emacs-snippets)
+
+(provide 'emacs-snippets-archetype)
View
3 project-archetypes/emacs-snippets/Carton
@@ -0,0 +1,3 @@
+(source "melpa" "http://melpa.milkbox.net/packages/")
+
+(package-file "__target__-snippets.el")
View
45 project-archetypes/emacs-snippets/README.md
@@ -0,0 +1,45 @@
+# __target__-snippets.el
+
+Yasnippets for [__name__](__website__).
+
+## Installation
+
+I highly recommend installing __target__-snippets through elpa.
+
+It's available on [melpa](http://melpa.milkbox.net/):
+
+ M-x package-install __target__-snippets
+
+You can also install the dependencies on your own, and just dump
+__target__-snippets in your path somewhere:
+
+ - <a href="https://github.com/magnars/s.el">s.el</a>
+ - <a href="https://github.com/magnars/dash.el">dash.el</a>
+
+## Usage
+
+TODO: Write some stuff about available snippets.
+
+## Setup
+
+Well, you'll have to require it. You'll also need
+[yasnippets](https://github.com/capitaomorte/yasnippet) of course.
+
+ (require '__target__-snippets)
+
+## License
+
+Copyright (C) __year__ Magnar Sveen
+
+This program is free software; you can redistribute it and/or modify
+it under the terms of the GNU General Public License as published by
+the Free Software Foundation, either version 3 of the License, or
+(at your option) any later version.
+
+This program is distributed in the hope that it will be useful,
+but WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+GNU General Public License for more details.
+
+You should have received a copy of the GNU General Public License
+along with this program. If not, see <http://www.gnu.org/licenses/>.
View
71 project-archetypes/emacs-snippets/__target__-snippets.el
@@ -0,0 +1,71 @@
+;;; __target__-snippets.el --- Yasnippets for __name__
+
+;; Copyright (C) __year__ Magnar Sveen
+
+;; Author: Magnar Sveen <magnars@gmail.com>
+;; Keywords: snippets
+;; Version: 0.1.0
+;; Package-Requires: ((s "1.4.0") (dash "1.2.0") (yasnippet "0.6.1"))
+
+;; This program is free software; you can redistribute it and/or modify
+;; it under the terms of the GNU General Public License as published by
+;; the Free Software Foundation, either version 3 of the License, or
+;; (at your option) any later version.
+
+;; This program is distributed in the hope that it will be useful,
+;; but WITHOUT ANY WARRANTY; without even the implied warranty of
+;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+;; GNU General Public License for more details.
+
+;; You should have received a copy of the GNU General Public License
+;; along with this program. If not, see <http://www.gnu.org/licenses/>.
+
+;;; Commentary:
+
+;; Yasnippets for [__name__](__website__).
+;;
+;; Please visit README.md for more commentary.
+
+;;; Code:
+
+;;;###autoload
+(defun __target__-snippets-show-docs-at-point ()
+ (interactive)
+ (__target__-snippets/show-docs (__target__-snippets/closest-__target__-identifer)))
+
+(defvar __target__-snippets/docstrings
+ '(("key" . "docstring")
+ ("key" . "docstring")))
+
+(defvar __target__-snippets/docstrings-regexp
+ (regexp-opt (-map 'car __target__-snippets/docstrings)))
+
+(defun -aget (alist key)
+ (cdr (assoc key alist)))
+
+(defun __target__-snippets/show-docs (id)
+ (message (-aget __target__-snippets/docstrings id))
+ nil)
+
+(defun __target__-snippets/closest-__target__-identifer ()
+ (save-excursion
+ (search-forward " ")
+ (search-backward-regexp __target__-snippets/docstrings-regexp)
+ (match-string-no-properties 0)))
+
+(setq __target__-snippets-root (file-name-directory (or load-file-name
+ (buffer-file-name))))
+
+;;;###autoload
+(defun __target__-snippets-initialize ()
+ (let ((snip-dir (expand-file-name "snippets" __target__-snippets-root)))
+ (when (boundp 'yas-snippet-dirs)
+ (add-to-list 'yas-snippet-dirs snip-dir t))
+ (yas/load-directory snip-dir)))
+
+;;;###autoload
+(eval-after-load "yasnippet"
+ '(__target__-snippets-initialize))
+
+(provide '__target__-snippets)
+;;; __target__-snippets.el ends here
View
6 project-archetypes/emacs-snippets/snippets/__major-mode__/example-snippet-with-docs
@@ -0,0 +1,6 @@
+# -*- mode: snippet -*-
+# name: example
+# key: example
+# --
+example`
+(__target__-snippets/show-docs "example")`
View
16 project-archetypes/js-buster-browser-archetype.el
@@ -0,0 +1,16 @@
+(require 'magit)
+
+(defun create-js-buster-browser (project-name description global)
+ (interactive "sProject name: \nsDescription: \nsGlobal namespace: ")
+ (pa-with-new-project project-name "js-buster-browser"
+ ((cons "__project-name__" project-name)
+ (cons "__description__" description)
+ (cons "__GLOBAL__" global))
+ (magit-ignore-file ".rvmrc" nil t)
+ (magit-ignore-file "todo.org" nil t)
+ (pa-sh "npm link buster")
+ (pa-sh "npm install")))
+
+(pa-declare-project-archetype "js-buster-browser" 'create-js-buster-browser)
+
+(provide 'js-buster-browser-archetype)
View
1 project-archetypes/js-buster-browser/.gitignore
@@ -0,0 +1 @@
+node_modules
View
1 project-archetypes/js-buster-browser/.rvmrc
@@ -0,0 +1 @@
+rvm use 1.9.2@autotest --create
View
8 project-archetypes/js-buster-browser/README.md
@@ -0,0 +1,8 @@
+# __project-name__
+
+__description__
+
+## License
+
+Copyright © 2013, Magnar Sveen. uses semantic versioning. Code
+released under the BSD license.
View
26 project-archetypes/js-buster-browser/autolint.js
@@ -0,0 +1,26 @@
+module.exports = {
+ "paths": [
+ "test/**/*.js",
+ "lib/**/*.js"
+ ],
+
+ "linterOptions": {
+ "indent": 2,
+ "vars": true,
+ "nomen": true,
+ "sloppy": true,
+ "plusplus": true,
+ "predef": [
+ "assert",
+ "refute",
+ "buster",
+ "cull",
+ "dome",
+ "__GLOBAL__"
+ ]
+ },
+
+ "excludes": [
+ "external"
+ ]
+};
View
8 project-archetypes/js-buster-browser/buster.js
@@ -0,0 +1,8 @@
+exports["Browser tests"] = {
+ environment: "browser",
+ libs: ["external/cull.js", "external/dome.js"],
+ sources: ["lib/*.js"],
+ tests: ["test/*.js"],
+ extensions: [require("buster-lint")],
+ "buster-lint": require("./autolint")
+};
View
492 project-archetypes/js-buster-browser/external/cu