Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

First commit.

- sup
  • Loading branch information...
commit dd60b7d986edcd4a328d7d17d3aa77db4208db94 0 parents
@gnusosa authored
Showing with 23,819 additions and 0 deletions.
  1. +4 −0 .authinfo
  2. +17 −0 .gitignore
  3. +102 −0 .gitmodules
  4. +162 −0 .mc-lists.el
  5. +8 −0 .offlineimap.py
  6. +44 −0 .offlineimaprc
  7. +153 −0 README.md
  8. +85 −0 appearance.el
  9. +15 −0 custom.el
  10. +171 −0 defuns/buffer-defuns.el
  11. +15 −0 defuns/calendars.el
  12. +31 −0 defuns/clj-defuns.el
  13. +320 −0 defuns/editing-defuns.el
  14. +70 −0 defuns/file-defuns.el
  15. +251 −0 defuns/js2r-defuns.el
  16. +11 −0 defuns/lisp-defuns.el
  17. +182 −0 defuns/misc-defuns.el
  18. +11 −0 defuns/project-defuns.el
  19. +52 −0 defuns/snippet-helpers.el
  20. +243 −0 init.el
  21. +4 −0 jira-org.el
  22. +335 −0 key-bindings.el
  23. +90 −0 mac.el
  24. +89 −0 mode-mappings.el
  25. +41 −0 my-misc.el
  26. +14 −0 project-archetypes/clj-ring-archetype.el
  27. +12 −0 project-archetypes/clj-ring/.gitignore
  28. +2 −0  project-archetypes/clj-ring/resources/public/css/reset.css
  29. +17 −0 project-archetypes/clj-ring/src/__project_name__/core.clj
  30. +10 −0 project-archetypes/emacs-package-archetype.el
  31. +4 −0 project-archetypes/emacs-package/.gitignore
  32. +22 −0 project-archetypes/emacs-package/.travis.yml
  33. +7 −0 project-archetypes/emacs-package/Carton
  34. +59 −0 project-archetypes/emacs-package/README.md
  35. +29 −0 project-archetypes/emacs-package/__project-name__.el
  36. +3 −0  project-archetypes/emacs-package/features/__project-name__.feature
  37. +23 −0 project-archetypes/emacs-package/features/step-definitions/__project-name__-steps.el
  38. +19 −0 project-archetypes/emacs-package/features/support/env.el
  39. +3 −0  project-archetypes/emacs-package/run-tests.sh
  40. +13 −0 project-archetypes/emacs-package/run-travis-ci.sh
  41. +45 −0 project-archetypes/emacs-package/watch-tests.watchr
  42. +13 −0 project-archetypes/emacs-snippets-archetype.el
  43. +3 −0  project-archetypes/emacs-snippets/Carton
  44. +45 −0 project-archetypes/emacs-snippets/README.md
  45. +71 −0 project-archetypes/emacs-snippets/__target__-snippets.el
  46. +6 −0 project-archetypes/emacs-snippets/snippets/__major-mode__/example-snippet-with-docs
  47. +128 −0 sane-defaults.el
  48. +36 −0 setup-clojure-mode.el
  49. +55 −0 setup-dired.el
  50. +63 −0 setup-ffip.el
  51. +35 −0 setup-flycheck.el
  52. +170 −0 setup-hippie.el
  53. +71 −0 setup-html-mode.el
  54. +77 −0 setup-ido.el
  55. +263 −0 setup-js2-mode.el
  56. +107 −0 setup-magit.el
  57. +17 −0 setup-markdown-mode.el
  58. +118 −0 setup-mu4e.el
  59. +14 −0 setup-org.el
  60. +32 −0 setup-package.el
  61. +91 −0 setup-paredit.el
  62. +23 −0 setup-perspective.el
  63. +120 −0 setup-rgrep.el
  64. +28 −0 setup-ruby-mode.el
  65. +33 −0 setup-shell.el
  66. +43 −0 setup-yasnippet.el
  67. +1 −0  site-lisp/ace-jump-mode
  68. +1 −0  site-lisp/angular-snippets
  69. +1 −0  site-lisp/annoying-arrows-mode
  70. +615 −0 site-lisp/apache-mode.el
  71. +1 −0  site-lisp/bash-completion/.gitignore
  72. +117 −0 site-lisp/bash-completion/README.md
  73. +1,046 −0 site-lisp/bash-completion/bash-completion.el
  74. +639 −0 site-lisp/bash-completion/bash-completion_test.el
  75. +339 −0 site-lisp/bash-completion/license
  76. +170 −0 site-lisp/bash-completion/sz-testutils.el
  77. +1 −0  site-lisp/browse-kill-ring
  78. +1 −0  site-lisp/change-inner
  79. +1 −0  site-lisp/clj-refactor
  80. +1 −0  site-lisp/dash
  81. +1 −0  site-lisp/datomic-snippets
  82. +370 −0 site-lisp/delsel/delsel.el
  83. +293 −0 site-lisp/diminish.el
  84. +272 −0 site-lisp/dired-details.el
  85. +2 −0  site-lisp/eproject/.gitignore
  86. +39 −0 site-lisp/eproject/contrib/README
  87. +122 −0 site-lisp/eproject/contrib/eproject-tags.el
  88. +309 −0 site-lisp/eproject/eproject-extras.el
  89. +70 −0 site-lisp/eproject/eproject-tests.el
  90. +701 −0 site-lisp/eproject/eproject.el
  91. +28 −0 site-lisp/eproject/lang/README
  92. +1 −0  site-lisp/expand-region
  93. +1 −0  site-lisp/feature-mode
  94. +1 −0  site-lisp/fill-column-indicator
  95. +905 −0 site-lisp/fill-column-indicator.el
  96. +1 −0  site-lisp/find-file-in-project
  97. +1 −0  site-lisp/flycheck
  98. +1 −0  site-lisp/fold-this
  99. +1,532 −0 site-lisp/frame-cmds.el
  100. +313 −0 site-lisp/frame-fns.el
  101. +1 −0  site-lisp/hardcore-mode
  102. +1 −0  site-lisp/ido-ubiquitous
  103. +69 −0 site-lisp/jade-mode/README.md
  104. +27 −0 site-lisp/jade-mode/example.jade
  105. +69 −0 site-lisp/jade-mode/jade-mode.el
  106. +133 −0 site-lisp/jade-mode/sws-mode.el
  107. +1 −0  site-lisp/js2-mode
  108. +1 −0  site-lisp/js2-refactor
  109. +1 −0  site-lisp/jump-char
  110. +1,469 −0 site-lisp/markdown-mode.el
  111. +110 −0 site-lisp/mouse-slider-mode.el
  112. +1 −0  site-lisp/multifiles
  113. +1 −0  site-lisp/multiple-cursors
  114. +68 −0 site-lisp/oppdrag-mode.el
  115. +1 −0  site-lisp/perspective
  116. +78 −0 site-lisp/project-archetypes/project-archetypes.el
  117. +16 −0 site-lisp/rhtml-mode/DEPTREE
  118. +16 −0 site-lisp/rhtml-mode/LICENSE
  119. +10 −0 site-lisp/rhtml-mode/README
  120. +321 −0 site-lisp/rhtml-mode/rhtml-erb.el
  121. +177 −0 site-lisp/rhtml-mode/rhtml-fonts.el
  122. +107 −0 site-lisp/rhtml-mode/rhtml-mode.el
  123. +58 −0 site-lisp/rhtml-mode/rhtml-navigation.el
  124. +93 −0 site-lisp/rhtml-mode/rhtml-ruby-hook.el
  125. +522 −0 site-lisp/rhtml-mode/rhtml-sgml-hacks.el
  126. +70 −0 site-lisp/rhtml-mode/test.rhtml
  127. +1 −0  site-lisp/s
  128. +405 −0 site-lisp/shell-command.el
  129. +1 −0  site-lisp/simplezen
  130. +184 −0 site-lisp/skewer-mode/README.md
  131. +2 −0  site-lisp/skewer-mode/TODO
  132. +24 −0 site-lisp/skewer-mode/UNLICENSE
  133. +67 −0 site-lisp/skewer-mode/cache-table.el
  134. +9 −0 site-lisp/skewer-mode/example.html
  135. +204 −0 site-lisp/skewer-mode/skewer-bower.el
  136. +131 −0 site-lisp/skewer-mode/skewer-css.el
  137. +51 −0 site-lisp/skewer-mode/skewer-everything.user.js
  138. +128 −0 site-lisp/skewer-mode/skewer-html.el
  139. +509 −0 site-lisp/skewer-mode/skewer-mode.el
  140. +124 −0 site-lisp/skewer-mode/skewer-repl.el
  141. +386 −0 site-lisp/skewer-mode/skewer.js
  142. +1 −0  site-lisp/smart-forward
  143. +1 −0  site-lisp/smex
  144. +186 −0 site-lisp/smooth-scrolling.el
  145. +1 −0  site-lisp/tagedit
  146. +1 −0  site-lisp/tern
  147. +387 −0 site-lisp/top-mode.el
  148. +3,746 −0 site-lisp/undo-tree.el
  149. +1 −0  site-lisp/wgrep
  150. +1 −0  site-lisp/yaml-mode
  151. +309 −0 site-lisp/zoom-frm.el
  152. +5 −0 snippets/clojure-mode/namespace
  153. +6 −0 snippets/clojure-mode/test
  154. +9 −0 snippets/clojure-mode/testcase
  155. +5 −0 snippets/crappy-jsp-mode/elvariable
  156. +5 −0 snippets/emacs-lisp-mode/autoload
  157. +5 −0 snippets/emacs-lisp-mode/ends
  158. +5 −0 snippets/emacs-lisp-mode/provide.yasnippet
  159. +5 −0 snippets/emacs-lisp-mode/req
  160. +7 −0 snippets/feature-mode/feature
  161. +8 −0 snippets/feature-mode/scenario
  162. +7 −0 snippets/html-mode/c-forEach
  163. +5 −0 snippets/html-mode/c-if
  164. +5 −0 snippets/html-mode/code
  165. +5 −0 snippets/html-mode/em
  166. +15 −0 snippets/html-mode/html
  167. +5 −0 snippets/html-mode/include
  168. +5 −0 snippets/html-mode/input
  169. +4 −0 snippets/html-mode/kbd
  170. +5 −0 snippets/html-mode/link
  171. +10 −0 snippets/html-mode/media
  172. +10 −0 snippets/html-mode/oocss-module
  173. +5 −0 snippets/html-mode/script
  174. +5 −0 snippets/html-mode/strong
  175. +5 −0 snippets/js-mode/declare-global.yasnippet
  176. +13 −0 snippets/js-mode/directive-oiiku-shared
  177. +5 −0 snippets/js-mode/finn-element-builder
  178. +5 −0 snippets/js-mode/for
  179. +9 −0 snippets/js-mode/for-in
  180. +5 −0 snippets/js-mode/function.yasnippet
  181. +8 −0 snippets/js-mode/immediately-invoked-function-expression.yasnippet
  182. +5 −0 snippets/js-mode/jstd-doc
  183. +8 −0 snippets/js-mode/jstd.additionalTestCase.yasnippet
  184. +5 −0 snippets/js-mode/jstd.log.yasnippet
  185. +10 −0 snippets/js-mode/jstd.testCase.yasnippet
  186. +7 −0 snippets/js-mode/node.ifnode.yasnippet
  187. +5 −0 snippets/js-mode/node.module.exports.yasnippet
  188. +5 −0 snippets/js-mode/node.require.yasnippet
  189. +9 −0 snippets/js-mode/object.create
  190. +5 −0 snippets/js-mode/object.create-property
  191. +6 −0 snippets/js-mode/object.create-property+
  192. +5 −0 snippets/js-mode/this.yasnippet
  193. +8 −0 snippets/js-mode/try
  194. +1 −0  snippets/js2-mode/.yas-parents
  195. +12 −0 snippets/markdown-mode/octopress-post
  196. +7 −0 snippets/php-mode/fun
  197. +7 −0 snippets/php-mode/funs
  198. +7 −0 snippets/php-mode/private-function
  199. +7 −0 snippets/php-mode/public-function
  200. +5 −0 snippets/php-mode/req
  201. +5 −0 snippets/ruby-mode/assert_equal
  202. +7 −0 snippets/ruby-mode/class
  203. +7 −0 snippets/ruby-mode/def
  204. +7 −0 snippets/ruby-mode/def.self
  205. +7 −0 snippets/ruby-mode/deftest
  206. +7 −0 snippets/ruby-mode/do-block
  207. +12 −0 snippets/ruby-mode/testcase
  208. +16 −0 themes/default-black-theme.el
  209. +803 −0 themes/prez-theme.el
4 .authinfo
@@ -0,0 +1,4 @@
+machine imap.domain.com login personal@domain.com port 993 password pswd
+machine smtp.domain.com login personal@domain.com port 587 password pswd
+machine imap.domain.com login work@domain.com port 993 password pswd
+machine smtp.domain.com login work@domain.com port 587 password pswd
17 .gitignore
@@ -0,0 +1,17 @@
+auto-save-list
+backups
+*~
+.places
+session.*
+tramp
+elpa
+swank
+emms
+site-lisp/adventur-mode
+*.elc
+.DS_Store
+.yas-compiled-snippets.el
+.cask
+\#*\#
+*.orig
+url
102 .gitmodules
@@ -0,0 +1,102 @@
+[submodule "site-lisp/yaml-mode"]
+ path = site-lisp/yaml-mode
+ url = https://github.com/yoshiki/yaml-mode.git
+[submodule "site-lisp/js2-mode"]
+ path = site-lisp/js2-mode
+ url = https://github.com/magnars/js2-mode
+[submodule "site-lisp/jade-mode"]
+ path = site-lisp/jade-mode
+ url = https://github.com/brianc/jade-mode
+[submodule "site-lisp/ace-jump-mode"]
+ path = site-lisp/ace-jump-mode
+ url = https://github.com/winterTTr/ace-jump-mode.git
+[submodule "site-lisp/expand-region"]
+ path = site-lisp/expand-region
+ url = https://github.com/magnars/expand-region.el.git
+[submodule "site-lisp/perspective"]
+ path = site-lisp/perspective
+ url = https://github.com/magnars/perspective-el.git
+[submodule "site-lisp/delsel"]
+ path = site-lisp/delsel
+ url = https://github.com/emacsmirror/delsel.git
+[submodule "site-lisp/hardcore-mode"]
+ path = site-lisp/hardcore-mode
+ url = https://github.com/magnars/hardcore-mode.el.git
+[submodule "site-lisp/bash-completion"]
+ path = site-lisp/bash-completion
+ url = https://github.com/szermatt/emacs-bash-completion.git
+[submodule "site-lisp/eproject"]
+ path = site-lisp/eproject
+ url = https://github.com/jrockway/eproject.git
+[submodule "site-lisp/jump-char"]
+ path = site-lisp/jump-char
+ url = https://github.com/lewang/jump-char.git
+[submodule "site-lisp/multiple-cursors"]
+ path = site-lisp/multiple-cursors
+ url = https://github.com/magnars/multiple-cursors.el.git
+[submodule "site-lisp/js2-refactor"]
+ path = site-lisp/js2-refactor
+ url = https://github.com/magnars/js2-refactor.el.git
+[submodule "site-lisp/feature-mode"]
+ path = site-lisp/feature-mode
+ url = https://github.com/michaelklishin/cucumber.el.git
+[submodule "site-lisp/browse-kill-ring"]
+ path = site-lisp/browse-kill-ring
+ url = https://github.com/T-J-Teru/browse-kill-ring.git
+[submodule "site-lisp/find-file-in-project"]
+ path = site-lisp/find-file-in-project
+ url = https://github.com/technomancy/find-file-in-project
+[submodule "site-lisp/wgrep"]
+ path = site-lisp/wgrep
+ url = https://github.com/magnars/Emacs-wgrep
+[submodule "site-lisp/smex"]
+ path = site-lisp/smex
+ url = https://github.com/nonsequitur/smex.git
+[submodule "site-lisp/annoying-arrows-mode"]
+ path = site-lisp/annoying-arrows-mode
+ url = https://github.com/magnars/annoying-arrows-mode.el.git
+[submodule "site-lisp/fill-column-indicator"]
+ path = site-lisp/fill-column-indicator
+ url = https://github.com/alpaker/Fill-Column-Indicator.git
+[submodule "site-lisp/smart-forward"]
+ path = site-lisp/smart-forward
+ url = https://github.com/magnars/smart-forward.el.git
+[submodule "site-lisp/ido-ubiquitous"]
+ path = site-lisp/ido-ubiquitous
+ url = https://github.com/DarwinAwardWinner/ido-ubiquitous.git
+[submodule "site-lisp/change-inner"]
+ path = site-lisp/change-inner
+ url = https://github.com/magnars/change-inner.el.git
+[submodule "site-lisp/s"]
+ 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
+[submodule "site-lisp/multifiles"]
+ 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
+[submodule "site-lisp/fold-this"]
+ path = site-lisp/fold-this
+ url = https://github.com/magnars/fold-this.el.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/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
162 .mc-lists.el
@@ -0,0 +1,162 @@
+;; This file is automatically generated by the multiple-cursors extension.
+;; It keeps track of your preferences for running commands with multiple cursors.
+
+(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
+ cua-replace-region
+ cua-set-mark
+ 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
+ god-mode-repeat
+ hippie-expand-no-case-fold
+ html-wrap-in-tag
+ 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
+ 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-barf-sexp
+ 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-splice-sexp-killing-backward
+ paredit-split-sexp
+ paredit-wrap-round
+ paredit-wrap-round-from-behind
+ paredit-wrap-square
+ quoted-insert
+ save-region-or-current-line
+ set-rectangular-region-anchor
+ 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
+ '(
+ adv-insert-new-number
+ cleanup-buffer
+ describe-key
+ dired-toggle-read-only
+ edebug-next-mode
+ eval-expression
+ god-local-mode
+ goto-line-with-feedback
+ handle-switch-frame
+ ido-switch-buffer
+ js2r-extract-var
+ js2r-rename-var
+ 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
+ wgrep-change-to-wgrep-mode
+ wgrep-finish-edit
+ wgrep-save-all-buffers
+ ))
8 .offlineimap.py
@@ -0,0 +1,8 @@
+#!/usr/bin/python
+import re, os
+
+def get_password_emacs(machine, login, port):
+ s = "machine %s login %s port %s password ([^ ]*)\n" % (machine, login, port)
+ p = re.compile(s)
+ authinfo = os.popen("gpg2 -q --no-tty -d ~/.authinfo.gpg").read()
+ return p.search(authinfo).group(1)
44 .offlineimaprc
@@ -0,0 +1,44 @@
+[general]
+accounts = Personal, Work
+maxsyncaccounts = 3
+pythonfile = ~/.offlineimap.py
+
+[Account Personal]
+localrepository = Local
+remoterepository = Remote
+
+[Repository Local]
+type = Maildir
+localfolders = ~/Maildir/Personal
+
+[Repository Remote]
+type = IMAP
+remoteuser = personal@domain.com
+remotepasseval = get_password_emacs("imap.domain.com", "personal@domain.com", "993")
+realdelete = yes
+
+folderfilter = lambda foldername: foldername not in ['[Domain]/Spam', '[Domain]/All Mail', '[Domain]/Starred', '[Domain]/Important']
+
+holdconnectionopen = true
+keepalive = 60
+sslcacertfile = /usr/local/opt/curl-ca-bundle/share/ca-bundle.crt
+
+[Account Work]
+localrepository = WorkLocal
+remoterepository = WorkRemote
+
+[Repository WorkLocal]
+type = Maildir
+localfolders = ~/Maildir/Work
+
+[Repository WorkRemote]
+type = IMAP
+remoteuser = work@domain.com
+remotepasseval = get_password_emacs("imap.domain.com", "work@domain.com", "993")
+realdelete = yes
+
+folderfilter = lambda foldername: foldername not in ['[Domain]/Spam', '[Domain]/All Mail', '[Domain]/Starred', '[Domain]/Important']
+
+holdconnectionopen = true
+keepalive = 60
+sslcacertfile = /usr/local/opt/curl-ca-bundle/share/ca-bundle.crt
153 README.md
@@ -0,0 +1,153 @@
+# My Emacs settings
+
+This is only a public template for my Emacs settings.
+The main purpose is to share how I handle all my settings,
+and packages without crying or making a mess.
+
+## Setup
+
+To grab all the dependencies:
+
+ git clone --recursive git://github.com/gnusosa/.emacs.d.git
+
+The first time you start Emacs, it will install some additional packages
+that are best handled by the package manager.
+
+## Install Emacs
+
+### GNU/Linux
+
+I use the default Emacs provided by both distributions package managers I use the most.
+
+#### Gentoo
+
+ emerge -av emacs
+
+I recommend adding `emacs` as a keyword in your system wide `USE` flags.
+
+#### Debian
+
+ apt-get install emacs
+
+### Mac OS X
+
+I use Cocoa Emacs on Mac OS X. It's best installed and handled by homebrew.
+You can installed like these:
+
+ brew install emacs --cocoa
+
+After that you have to copy `Emacs.app` from the brew Cellar into
+`/Applications` instead of the symlink that brew places there.
+
+## Tips for using these emacs settings
+
+This settings are a modification on magnar's Emacs settings,
+so shout out to him. You the man dawg.
+
+Original magnar's repository:
+
+ git clone --recursive git://github.com/magnars/.emacs.d.git
+
+Therefore, most of the original keybindings still remain.
+
+### What differs from magnars repository
+
+* I require the correct lisp list paths for Mac OS X and GNU/Linux (soon BSD).
+
+* I use system mu4e provided from the OS package manager.
+
+* Removed most setup modes for Groovy, Java, and Javascript.
+
+* Added ag, calfw, hackernews, haml-mode, org-jira, twit, and znc. All from MELPA.
+
+* Unicode for everything. Seriously; if you don't Unicode at everything, GTFO RTFM.
+
+* Two extra frames at boot.
+
+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, instead of forking it directly.
+
+ * Start by reading up on all the cool stuff in key-bindings.el.
+
+ * You quit emacs with `C-x r q`, mnemonic *Really Quit*.
+
+ * Find file in project with `C-x o`, in dir with `C-x C-f`, recent with `C-x f`
+
+ * Add your user- and project-specific stuff in .emacs.d/users/[machine name]/*.el
+
+ * `C-h` is rebound to backspace, like in the shell. Get help on `F1` instead.
+
+ * Autocomplete with `C-.` (autocomplete entire lines with `C-:`)
+
+ * expand-region is your friend. Find its bound key by doing `F1 f er/expand-region`
+
+ * Undo with `C-_` and redo with `M-_`. Watch the undo-tree with `C-x u`
+
+ * Indent and clean up white space in the entire buffer with `C-c n`
+
+ * On a mac, the Meta key `M` is bound to Command.
+
+ * I recommend rebinding Caps Lock to Ctrl and use that instead of the often badly placed Ctrl-key.
+
+ * Watch [emacsrocks.com](http://emacsrocks.com)
+
+### Files
+
+* `C-x C-f` Open a file. Starts in the current directory
+* `C-x f ` Open a recently visited file
+* `C-x o ` Open a file in the current project (based on .git ++)
+* `C-x C-s` Save this file
+* `C-x C-w` Save as ...
+* `C-x C-j` Jump to this files' current directory
+* `C-x b ` Switch to another open file (buffer)
+* `C-x C-b` List all open files (buffers)
+
+### Cut copy and paste
+
+* `C-space` Start marking stuff. C-g to cancel.
+* `C-w ` Cut (aka kill)
+* `C-k ` Cut till end of line
+* `M-w ` Copy
+* `C-y ` Paste (aka yank)
+* `M-v ` Paste from OS clipboard (aka yank)
+* `<Print>` Paste from OS clipboard (aka yank) for `Thinkpads`.
+* `M-y ` Cycle last paste through previous kills
+* `C-x C-y` Choose what to paste from previous kills
+* `C-@ ` Mark stuff quickly. Press multiple times
+
+### General
+
+* `C-g ` Quit out of whatever mess you've gotten yourself into
+* `M-x ` Run a command by name
+* `C-. ` Autocomplete
+* `C-_ ` Undo
+* `M-_ ` Redo
+* `C-x u ` Show the undo-tree
+* `C-x m ` Open magit. It's a magical git interface for emacs
+
+### Navigation
+
+* `C-arrow` Move past words/paragraphs
+* `C-a ` Go to start of line
+* `C-e ` Go to end of line
+* `M-g M-g` Go to line number
+* `C-x C-i` Go to symbol
+* `C-s ` Search forward. Press `C-s` again to go further.
+* `C-r ` Search backward. Press `C-r` again to go further.
+
+### Window management
+
+* `C-x 0 ` Close this window
+* `C-x 1 ` Close other windows
+* `C-x 2 ` Split window horizontally
+* `C-x 3 ` Split window vertically
+* `S-arrow` Jump to window to the left/right/up/down
+
+### Help
+
+* `F1 t ` Basic tutorial
+* `F1 k ` Help for a keybinding
+* `F1 r ` Emacs' extensive documentation
85 appearance.el
@@ -0,0 +1,85 @@
+(setq visible-bell t
+ font-lock-maximum-decoration t
+ color-theme-is-global t
+ truncate-partial-width-windows nil)
+
+;; Highlight current line
+(global-hl-line-mode 1)
+
+;; 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)))
+
+(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)
+
+;; Don't defer screen updates when performing operations
+(setq redisplay-dont-pause t)
+
+;; org-mode colors
+(setq org-todo-keyword-faces
+ '(
+ ("INPR" . (:foreground "yellow" :weight bold))
+ ("DONE" . (:foreground "green" :weight bold))
+ ("IMPEDED" . (:foreground "red" :weight bold))
+ ))
+
+;; Highlight matching parentheses when the point is on them.
+(show-paren-mode 1)
+
+(when window-system
+ (setq frame-title-format '(buffer-file-name "%f" ("%b")))
+ (tooltip-mode -1)
+ (blink-cursor-mode -1))
+
+;; Make zooming affect frame instead of buffers
+(require 'zoom-frm)
+
+;; 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))
+(eval-after-load "guide-key" '(diminish 'guide-key-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)
15 custom.el
@@ -0,0 +1,15 @@
+(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.
+ '(custom-safe-themes (quote ("9527feeeec43970b1d725bdc04e97eb2b03b15be982ac50089ad223d3c6f2920" "c03d60937e814932cd707a487676875457e0b564a615c1edfd453f23b06fe879" "f3ec2da81c2b1f66f911fe47843a09055754b40fafaddcce79bbd4d781161329" "30c6aef3025cd6f05ccb611ec8838a448a14a6784987ed98b24f78916d63b388" "84ff07913c6109d12bfda40644daeaaa8f4665afb5f04e13e422bd98b02ee88b" "cf33119622dd833e4d8f904f34c5e3ff95d1d3d45bada72dd44648b3470bdebe" "f5776f3da6117901f29405fe52edb2bcba6a687629b4cbd5923d1a642484f2f9" "d56e289b10204629ac5c35b9621a650a534ef3baf183a1c601b4936482321df1" "50ceca952b37826e860867d939f879921fac3f2032d8767d646dd4139564c68a" "ff73e1b0216feca9e041dcb3196938442cc6aa8319f97eedbc2a3e38c8ca9825" "a18dd0a954ac63a80e62c8cb1b550ffcf5d8461189c7c672555faadf2facfcf3" "cb36f8e44d41595010baa23737984c4ecb2d8cc2e363ec15fbfa0408c2f8ea9f" "ea0c5df0f067d2e3c0f048c1f8795af7b873f5014837feb0a7c8317f34417b04" "9f42bccce1e13fa5017eb8718574db099e85358b9f424db78e7318f86d1be08f" default)))
+ '(ido-use-filename-at-point nil))
+
+(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.
+ '(js2-error-face ((t nil)) t)
+ '(js2-warning-face ((t nil)) t))
171 defuns/buffer-defuns.el
@@ -0,0 +1,171 @@
+;; Buffer-related defuns
+
+(require 'imenu)
+
+(defvar buffer-local-mode nil)
+(make-variable-buffer-local 'buffer-local-mode)
+
+(defun mode-keymap (mode-sym)
+ (symbol-value (intern (concat (symbol-name mode-sym) "-map"))))
+
+(defun* buffer-local-set-key (key action)
+ (when buffer-local-mode
+ (define-key (mode-keymap buffer-local-mode)
+ key action)
+ (return-from set-key-buffer-local))
+ (let* ((mode-name-loc (gensym "-blm")))
+ (eval `(define-minor-mode ,mode-name-loc nil nil nil (make-sparse-keymap)))
+ (setq buffer-local-mode mode-name-loc)
+ (funcall mode-name-loc 1)
+ (define-key (mode-keymap mode-name-loc) key action)))
+
+(defun create-scratch-buffer nil
+ "create a new scratch buffer to work in. (could be *scratch* - *scratchX*)"
+ (interactive)
+ (let ((n 0)
+ bufname)
+ (while (progn
+ (setq bufname (concat "*scratch"
+ (if (= n 0) "" (int-to-string n))
+ "*"))
+ (setq n (1+ n))
+ (get-buffer bufname)))
+ (switch-to-buffer (get-buffer-create bufname))
+ (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)
+ (let* ((this-win-buffer (window-buffer))
+ (next-win-buffer (window-buffer (next-window)))
+ (this-win-edges (window-edges (selected-window)))
+ (next-win-edges (window-edges (next-window)))
+ (this-win-2nd (not (and (<= (car this-win-edges)
+ (car next-win-edges))
+ (<= (cadr this-win-edges)
+ (cadr next-win-edges)))))
+ (splitter
+ (if (= (car this-win-edges)
+ (car (window-edges (next-window))))
+ 'split-window-horizontally
+ 'split-window-vertically)))
+ (delete-other-windows)
+ (let ((first-win (selected-window)))
+ (funcall splitter)
+ (if this-win-2nd (other-window 1))
+ (set-window-buffer (selected-window) this-win-buffer)
+ (set-window-buffer (next-window) next-win-buffer)
+ (select-window first-win)
+ (if this-win-2nd (other-window 1))))))
+
+(defun rotate-windows ()
+ "Rotate your windows"
+ (interactive)
+ (cond ((not (> (count-windows)1))
+ (message "You can't rotate a single window!"))
+ (t
+ (setq i 1)
+ (setq numWindows (count-windows))
+ (while (< i numWindows)
+ (let* (
+ (w1 (elt (window-list) i))
+ (w2 (elt (window-list) (+ (% i numWindows) 1)))
+
+ (b1 (window-buffer w1))
+ (b2 (window-buffer w2))
+
+ (s1 (window-start w1))
+ (s2 (window-start w2))
+ )
+ (set-window-buffer w1 b2)
+ (set-window-buffer w2 b1)
+ (set-window-start w1 s2)
+ (set-window-start w2 s1)
+ (setq i (1+ i)))))))
+
+(defun ido-imenu ()
+ "Update the imenu index and then use ido to select a symbol to navigate to.
+Symbols matching the text at point are put first in the completion list."
+ (interactive)
+ (imenu--make-index-alist)
+ (let ((name-and-pos '())
+ (symbol-names '()))
+ (flet ((addsymbols (symbol-list)
+ (when (listp symbol-list)
+ (dolist (symbol symbol-list)
+ (let ((name nil) (position nil))
+ (cond
+ ((and (listp symbol) (imenu--subalist-p symbol))
+ (addsymbols symbol))
+
+ ((listp symbol)
+ (setq name (car symbol))
+ (setq position (cdr symbol)))
+
+ ((stringp symbol)
+ (setq name symbol)
+ (setq position (get-text-property 1 'org-imenu-marker symbol))))
+
+ (unless (or (null position) (null name))
+ (add-to-list 'symbol-names name)
+ (add-to-list 'name-and-pos (cons name position))))))))
+ (addsymbols imenu--index-alist))
+ ;; If there are matching symbols at point, put them at the beginning of `symbol-names'.
+ (let ((symbol-at-point (thing-at-point 'symbol)))
+ (when symbol-at-point
+ (let* ((regexp (concat (regexp-quote symbol-at-point) "$"))
+ (matching-symbols (delq nil (mapcar (lambda (symbol)
+ (if (string-match regexp symbol) symbol))
+ symbol-names))))
+ (when matching-symbols
+ (sort matching-symbols (lambda (a b) (> (length a) (length b))))
+ (mapc (lambda (symbol) (setq symbol-names (cons symbol (delete symbol symbol-names))))
+ matching-symbols)))))
+ (let* ((selected-symbol (ido-completing-read "Symbol? " symbol-names))
+ (position (cdr (assoc selected-symbol name-and-pos))))
+ (push-mark (point))
+ (goto-char position))))
+
+(defun untabify-buffer ()
+ (interactive)
+ (untabify (point-min) (point-max)))
+
+(defun indent-buffer ()
+ (interactive)
+ (indent-region (point-min) (point-max)))
+
+(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)
+ (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 (shorter-file-name file-name) file-name))
+
+(defun recentf-ido-find-file ()
+ "Find a recent file using ido."
+ (interactive)
+ (let* ((recent-files (mapcar 'recentf--file-cons recentf-list))
+ (files (mapcar 'car recent-files))
+ (file (completing-read "Choose recent file: " files)))
+ (find-file (cdr (assoc file recent-files)))))
15 defuns/calendars.el
@@ -0,0 +1,15 @@
+(require 'calfw-ical)
+
+(defun work-calendar nil
+ (interactive)
+ (cfw:open-ical-calendar "http://www.domain.tld/calendar/ical/user/basic.ics")
+)
+(defun team-calendar nil
+ (interactive)
+ (cfw:open-ical-calendar "http://www.domain.tld/calendar/ical/user/basic.ics")
+)
+
+(defun holiday-calendar nil
+ (interactive)
+ (cfw:open-ical-calendar "http://www.domain.tld/calendar/ical/user/basic.ics")
+)
31 defuns/clj-defuns.el
@@ -0,0 +1,31 @@
+(require 's)
+
+(defun clj--src-file-name-from-test (name)
+ (s-with name
+ (s-replace "/test/" "/src/")
+ (s-replace "_test.clj" ".clj")))
+
+(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 ()
+ (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")
+ (let ((file (clj-other-file-name)))
+ (if (or (file-exists-p file) arg)
+ (find-file file)
+ (error "%s not found." file))))
+
+(defun clj-jump-to-other-file-other-window (arg)
+ (interactive "P")
+ (let ((file (clj-other-file-name)))
+ (if (or (file-exists-p file) arg)
+ (find-file-other-window file)
+ (error "%s not found." file))))
320 defuns/editing-defuns.el
@@ -0,0 +1,320 @@
+;;; editing-defuns.el --- Basic text editing defuns -*- lexical-binding: t; -*-
+
+(defun open-line-below ()
+ (interactive)
+ (end-of-line)
+ (newline)
+ (indent-for-tab-command))
+
+(defun open-line-above ()
+ (interactive)
+ (beginning-of-line)
+ (newline)
+ (forward-line -1)
+ (indent-for-tab-command))
+
+(defun new-line-in-between ()
+ (interactive)
+ (newline)
+ (save-excursion
+ (newline)
+ (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")
+ (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 (&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."
+ (interactive "p")
+ (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")
+ (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)")
+
+(defvar yank-advised-indent-threshold 1000
+ "Threshold (# chars) over which indentation does not automatically occur.")
+
+(defun yank-advised-indent-function (beg end)
+ "Do indentation, as long as the region isn't too large."
+ (if (<= (- end beg) yank-advised-indent-threshold)
+ (indent-region beg end nil)))
+
+(defadvice yank (after yank-indent activate)
+ "If current mode is one of 'yank-indent-modes, indent yanked text (with prefix arg don't indent)."
+ (if (and (not (ad-get-arg 0))
+ (--any? (derived-mode-p it) yank-indent-modes))
+ (let ((transient-mark-mode nil))
+ (yank-advised-indent-function (region-beginning) (region-end)))))
+
+(defadvice yank-pop (after yank-pop-indent activate)
+ "If current mode is one of 'yank-indent-modes, indent yanked text (with prefix arg don't indent)."
+ (if (and (not (ad-get-arg 0))
+ (member major-mode yank-indent-modes))
+ (let ((transient-mark-mode nil))
+ (yank-advised-indent-function (region-beginning) (region-end)))))
+
+(defun yank-unindented ()
+ (interactive)
+ (yank 1))
+
+;; toggle quotes
+
+(defun current-quotes-char ()
+ (nth 3 (syntax-ppss)))
+
+(defalias 'point-is-in-string-p 'current-quotes-char)
+
+(defun move-point-forward-out-of-string ()
+ (while (point-is-in-string-p) (forward-char)))
+
+(defun move-point-backward-out-of-string ()
+ (while (point-is-in-string-p) (backward-char)))
+
+(defun alternate-quotes-char ()
+ (if (eq ?' (current-quotes-char)) ?\" ?'))
+
+(defun toggle-quotes ()
+ (interactive)
+ (if (point-is-in-string-p)
+ (let ((old-quotes (char-to-string (current-quotes-char)))
+ (new-quotes (char-to-string (alternate-quotes-char)))
+ (start (make-marker))
+ (end (make-marker)))
+ (save-excursion
+ (move-point-forward-out-of-string)
+ (backward-delete-char 1)
+ (set-marker end (point))
+ (insert new-quotes)
+ (move-point-backward-out-of-string)
+ (delete-char 1)
+ (insert new-quotes)
+ (set-marker start (point))
+ (replace-string new-quotes (concat "\\" new-quotes) nil start end)
+ (replace-string (concat "\\" old-quotes) old-quotes nil start end)))
+ (error "Point isn't in a string")))
+
+;; kill region if active, otherwise kill backward word
+
+(defun kill-region-or-backward-word ()
+ (interactive)
+ (if (region-active-p)
+ (kill-region (region-beginning) (region-end))
+ (backward-kill-word 1)))
+
+(defun kill-to-beginning-of-line ()
+ (interactive)
+ (kill-region (save-excursion (beginning-of-line) (point))
+ (point)))
+
+;; copy region if active
+;; otherwise copy to end of current line
+;; * with prefix, copy N whole lines
+
+(defun copy-to-end-of-line ()
+ (interactive)
+ (kill-ring-save (point)
+ (line-end-position))
+ (message "Copied to end of line"))
+
+(defun copy-whole-lines (arg)
+ "Copy lines (as many as prefix argument) in the kill ring"
+ (interactive "p")
+ (kill-ring-save (line-beginning-position)
+ (line-beginning-position (+ 1 arg)))
+ (message "%d line%s copied" arg (if (= 1 arg) "" "s")))
+
+(defun copy-line (arg)
+ "Copy to end of line, or as many lines as prefix argument"
+ (interactive "P")
+ (if (null arg)
+ (copy-to-end-of-line)
+ (copy-whole-lines (prefix-numeric-value arg))))
+
+(defun save-region-or-current-line (arg)
+ (interactive "P")
+ (if (region-active-p)
+ (kill-ring-save (region-beginning) (region-end))
+ (copy-line arg)))
+
+(defun kill-and-retry-line ()
+ "Kill the entire current line and reposition point at indentation"
+ (interactive)
+ (back-to-indentation)
+ (kill-line))
+
+(defun camelize-buffer ()
+ (interactive)
+ (goto-char 0)
+ (ignore-errors
+ (replace-next-underscore-with-camel 0))
+ (goto-char 0))
+
+;; kill all comments in buffer
+(defun comment-kill-all ()
+ (interactive)
+ (save-excursion
+ (goto-char (point-min))
+ (comment-kill (save-excursion
+ (goto-char (point-max))
+ (line-number-at-pos)))))
+
+(require 's)
+
+(defun incs (s &optional num)
+ (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"))
+ (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")
+ (if (> arg 0)
+ (setq arg (1+ arg))) ; 1-based index to get eternal loop with 0
+ (let ((case-fold-search nil))
+ (while (not (= arg 1))
+ (search-forward-regexp "\\b_[a-z]")
+ (forward-char -2)
+ (delete-char 1)
+ (capitalize-word 1)
+ (setq arg (1- arg)))))
+
+(defun snakeify-current-word ()
+ (interactive)
+ (er/mark-word)
+ (let* ((beg (region-beginning))
+ (end (region-end))
+ (current-word (buffer-substring-no-properties beg end))
+ (snakified (snake-case current-word)))
+ (replace-string current-word snakified nil beg end)))
+
+(defun transpose-params ()
+ "Presumes that params are in the form (p, p, p) or {p, p, p} or [p, p, p]"
+ (interactive)
+ (let* ((end-of-first (cond
+ ((looking-at ", ") (point))
+ ((and (looking-back ",") (looking-at " ")) (- (point) 1))
+ ((looking-back ", ") (- (point) 2))
+ (t (error "Place point between params to transpose."))))
+ (start-of-first (save-excursion
+ (goto-char end-of-first)
+ (move-backward-out-of-param)
+ (point)))
+ (start-of-last (+ end-of-first 2))
+ (end-of-last (save-excursion
+ (goto-char start-of-last)
+ (move-forward-out-of-param)
+ (point))))
+ (transpose-regions start-of-first end-of-first start-of-last end-of-last)))
+
+(defun move-forward-out-of-param ()
+ (while (not (looking-at ")\\|, \\| ?}\\| ?\\]"))
+ (cond
+ ((point-is-in-string-p) (move-point-forward-out-of-string))
+ ((looking-at "(\\|{\\|\\[") (forward-list))
+ (t (forward-char)))))
+
+(defun move-backward-out-of-param ()
+ (while (not (looking-back "(\\|, \\|{ ?\\|\\[ ?"))
+ (cond
+ ((point-is-in-string-p) (move-point-backward-out-of-string))
+ ((looking-back ")\\|}\\|\\]") (backward-list))
+ (t (backward-char)))))
+
+(autoload 'zap-up-to-char "misc"
+ "Kill up to, but not including ARGth occurrence of CHAR.")
+
+(defun css-expand-statement ()
+ (interactive)
+ (save-excursion
+ (end-of-line)
+ (search-backward "{")
+ (forward-char 1)
+ (let ((beg (point)))
+ (newline)
+ (er/mark-inside-pairs)
+ (replace-regexp ";" ";\n" nil (region-beginning) (region-end))
+ (indent-region beg (point)))))
+
+(defun css-contract-statement ()
+ (interactive)
+ (end-of-line)
+ (search-backward "{")
+ (while (not (looking-at "}"))
+ (join-line -1))
+ (back-to-indentation))
70 defuns/file-defuns.el
@@ -0,0 +1,70 @@
+;; Defuns for working with files
+
+(defun rename-current-buffer-file ()
+ "Renames current buffer and file it is visiting."
+ (interactive)
+ (let ((name (buffer-name))
+ (filename (buffer-file-name)))
+ (if (not (and filename (file-exists-p filename)))
+ (error "Buffer '%s' is not visiting a file!" name)
+ (let ((new-name (read-file-name "New name: " filename)))
+ (if (get-buffer new-name)
+ (error "A buffer named '%s' already exists!" new-name)
+ (rename-file filename new-name 1)
+ (rename-buffer new-name)
+ (set-visited-file-name new-name)
+ (set-buffer-modified-p nil)
+ (message "File '%s' successfully renamed to '%s'"
+ name (file-name-nondirectory new-name)))))))
+
+(defun delete-current-buffer-file ()
+ "Removes file connected to current buffer and kills buffer."
+ (interactive)
+ (let ((filename (buffer-file-name))
+ (buffer (current-buffer))
+ (name (buffer-name)))
+ (if (not (and filename (file-exists-p filename)))
+ (ido-kill-buffer)
+ (when (yes-or-no-p "Are you sure you want to remove this file? ")
+ (delete-file filename)
+ (kill-buffer buffer)
+ (message "File '%s' successfully removed" filename)))))
+
+(defun copy-current-file-path ()
+ "Add current file path to kill ring. Limits the filename to project root if possible."
+ (interactive)
+ (let ((filename (buffer-file-name)))
+ (kill-new (if eproject-mode
+ (s-chop-prefix (eproject-root) filename)
+ filename))))
+
+(defun find-or-create-file-at-point ()
+ "Guesses what parts of the buffer under point is a file name and opens it."
+ (interactive)
+ (find-file (file-name-at-point)))
+
+(defun find-or-create-file-at-point-other-window ()
+ "Guesses what parts of the buffer under point is a file name and opens it."
+ (interactive)
+ (find-file-other-window (file-name-at-point)))
+
+(defun file-name-at-point ()
+ (save-excursion
+ (let* ((file-name-regexp "[./a-zA-Z0-9\-_~]")
+ (start (progn
+ (while (looking-back file-name-regexp)
+ (forward-char -1))
+ (point)))
+ (end (progn
+ (while (looking-at file-name-regexp)
+ (forward-char 1))
+ (point))))
+ (buffer-substring start end))))
+
+(defun touch-buffer-file ()
+ (interactive)
+ (insert " ")
+ (backward-delete-char 1)
+ (save-buffer))
+
+(provide 'file-defuns)
251 defuns/js2r-defuns.el
@@ -0,0 +1,251 @@
+(require 'cl)
+(require 's)
+(require 'dash)
+
+(defvar js2r-path-to-tests "/test/"
+ "Path to tests from a root shared with sources")
+
+(defvar js2r-path-to-sources "/lib/"
+ "Path to sources from a root shared with tests")
+
+(defvar js2r-test-suffix "-test"
+ "The suffix added to test files")
+
+(make-variable-buffer-local 'js2r-path-to-tests)
+(make-variable-buffer-local 'js2r-path-to-sources)
+(make-variable-buffer-local 'js2r-test-suffix)
+
+;; Toggle between source and test
+(defun jump-between-source-and-test-files (arg)
+ (interactive "P")
+ (if (looks-like-test-file-name (buffer-file-name))
+ (jump-to-source-file arg)
+ (jump-to-test-file arg)))
+
+(defun jump-between-source-and-test-files-other-window (arg)
+ (interactive "P")
+ (if (looks-like-test-file-name (buffer-file-name))
+ (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)
+ (let ((modified-p (buffer-modified-p)))
+ (rename-file old-name new-name 1)
+ (rename-buffer new-name)
+ (set-visited-file-name new-name)
+ (set-buffer-modified-p modified-p)))
+
+(defun also-rename-other (old-name new-name)
+ (let (old-other new-other)
+ (condition-case nil
+ (if (and (looks-like-test-file-name old-name)
+ (looks-like-test-file-name new-name))
+ (setq old-other (guess-source-file old-name)
+ new-other (guess-source-file new-name))
+ (setq old-other (guess-test-file old-name)
+ new-other (guess-test-file new-name)))
+ (error nil))
+
+ (when (and old-other new-other
+ (file-exists-p old-other)
+ (not (file-exists-p new-other))
+ (yes-or-no-p (format "Also rename %S to %S?" old-other new-other)))
+
+ (let ((b (find-buffer-visiting old-other)))
+ (if b
+ (with-current-buffer b
+ (js2r--rename-file old-other new-other))
+ (rename-file old-other new-other 1))))))
+
+(defun js2r-rename-current-buffer-file ()
+ "Renames current buffer and file it is visiting."
+ (interactive)
+ (let ((name (buffer-name))
+ (filename (buffer-file-name)))
+ (if (not (and filename (file-exists-p filename)))
+ (error "Buffer '%s' is not visiting a file!" name)
+ (let ((new-name (read-file-name "New name: " filename)))
+ (cond ((get-buffer new-name)
+ (error "A buffer named '%s' already exists!" new-name))
+ (t
+ (js2r--rename-file filename new-name)
+ (also-rename-other filename new-name)
+ (message "File '%s' successfully renamed to '%s'" name (file-name-nondirectory new-name))))))))
+
+;; Delete tests and sources
+
+(defun also-delete-other (file-name)
+ (let (other-name)
+ (condition-case nil
+ (setq other-name
+ (if (looks-like-test-file-name file-name)
+ (guess-source-file file-name)
+ (guess-test-file file-name)))
+ (error nil))
+
+ (when (and other-name
+ (file-exists-p other-name)
+ (yes-or-no-p (format "Also delete %S?" other-name)))
+
+ (let ((b (find-buffer-visiting other-name)))
+ (when b (kill-buffer b)))
+
+ (delete-file other-name))))
+
+(defun js2r-delete-current-buffer-file ()
+ "Removes file connected to current buffer and kills buffer."
+ (interactive)
+ (let ((filename (buffer-file-name))
+ (buffer (current-buffer))
+ (name (buffer-name)))
+ (if (not (and filename (file-exists-p filename)))
+ (ido-kill-buffer)
+ (when (yes-or-no-p "Are you sure you want to remove this file? ")
+ (delete-file filename)
+ (also-delete-other filename)
+ (kill-buffer buffer)
+ (message "File '%s' successfully removed" filename)))))
+
+;; Jump to source-file
+
+(defun jump-to-source-file (arg)
+ (interactive "P")
+ (let ((file (guess-source-file (buffer-file-name))))
+ (if (or (file-exists-p file) arg)
+ (find-file file)
+ (error "%s not found." file))))
+
+(defun possible-test-file-suffixes ()
+ (cons (concat js2r-test-suffix ".js")
+ '("Test.js" "_test.js" "-test.js")))
+
+(defun looks-like-test-file-name (file-name)
+ (--any? (s-ends-with-p it file-name) (possible-test-file-suffixes)))
+
+(defun jump-to-source-file-other-window (arg)
+ (interactive "P")
+ (let ((file (guess-source-file (buffer-file-name))))
+ (if (or (file-exists-p file) arg)
+ (find-file-other-window file)
+ (error "%s not found." file))))
+
+(defun guess-source-file (file-name)
+ (unless (looks-like-test-file-name file-name)
+ (error "This doesn't look like a test file."))
+ (format "%s/%s.js" (s-chop-suffix "/" (guess-source-folder file-name)) (guess-source-file-name file-name)))
+
+(defun guess-source-file-name (file-name)
+ (s-chop-suffixes (possible-test-file-suffixes) (file-name-nondirectory file-name)))
+
+(defun guess-source-folder (file-name)
+ (let ((test-dir (file-name-directory file-name)))
+ (when (not (string-match-p js2r-path-to-tests test-dir))
+ (error "Unable to locate source folder. Set js2r-path-to-tests and -sources."))
+ (let ((source-dir (replace-regexp-in-string
+ js2r-path-to-tests
+ js2r-path-to-sources
+ test-dir)))
+ (if (file-exists-p source-dir)
+ source-dir
+ (error "Unable to locate source folder. Verify js2r-path-to-tests and -sources")))))
+
+
+;; Jump to test-file
+
+(defun jump-to-test-file (arg)
+ (interactive "P")
+ (let ((file (guess-test-file (buffer-file-name))))
+ (if (or (file-exists-p file) arg)
+ (find-file file)
+ (error "%s not found." file))))
+
+(defun jump-to-test-file-other-window (arg)
+ (interactive "P")
+ (let ((file (guess-test-file (buffer-file-name))))
+ (if (or (file-exists-p file) arg)
+ (find-file-other-window file)
+ (error "%s not found." file))))
+
+(defun guess-test-file (file-name)
+ (when (looks-like-test-file-name file-name)
+ (error "Looks like you're already in the test file."))
+ (or (test-file-that-exists file-name "-test")
+ (test-file-that-exists file-name "_test")
+ (test-file-that-exists file-name "Test")
+ (test-file-name file-name js2r-test-suffix)))
+
+(defun test-file-that-exists (file-name suffix)
+ (let ((file (test-file-name file-name suffix)))
+ (if (file-exists-p file) file nil)))
+
+(defun test-file-name (file-name suffix)
+ (format "%s/%s%s.js" (s-chop-suffix "/" (guess-test-folder file-name)) (test-file-name-stub file-name) suffix))
+
+(defun test-file-name-stub (file-name)
+ (s-chop-suffix ".js" (file-name-nondirectory file-name)))
+
+(defun guess-test-folder (file-name)
+ (let ((source-dir (file-name-directory file-name)))
+ (when (not (string-match-p js2r-path-to-sources source-dir))
+ (error "Unable to locate test folder. Set js2r-path-to-tests and -sources."))
+ (let ((test-dir (replace-regexp-in-string
+ js2r-path-to-sources
+ js2r-path-to-tests
+ source-dir)))
+ (if (file-exists-p test-dir)
+ test-dir
+ (error "Unable to locate test folder. Verify js2r-path-to-tests")))))
+
+;; Toggle assert/refute
+
+(defun toggle-assert-refute ()
+ (interactive)
+ (save-excursion
+ (end-of-line)
+ (re-search-backward "\\(assert\\|refute\\)")
+ (if (looking-at "assert")
+ (progn
+ (kill-word 1)
+ (insert "refute"))
+ (kill-word 1)
+ (insert "assert"))))
+
+;; Mark a js2-node in right window
+
+(defun remove-js2-mark-overlay ()
+ (interactive)
+ (mapc #'(lambda (o)
+ (when (eq (overlay-get o 'type) 'mark-js2-in-right-window)
+ (delete-overlay o)))
+ (overlays-in (point-min) (point-max))))
+
+(defmacro mark-js2-in-right-window (func)
+ `(progn
+ (kill-comment nil)
+ (windmove-right)
+ (remove-js2-mark-overlay)
+ (let* ((node ,func)
+ (beg (js2-node-abs-pos node))
+ (end (js2-node-abs-end node))
+ (o (make-overlay beg end nil nil t)))
+ (overlay-put o 'face 'region)
+ (overlay-put o 'type 'mark-js2-in-right-window)
+ (windmove-left)
+ (save-excursion
+ (insert (format " ;; %s" (js2-node-short-name node)))))))
+
+;;(mark-js2-in-right-window
+;; (js2-node-at-point)) ;; js2-name-node
11 defuns/lisp-defuns.el
@@ -0,0 +1,11 @@
+;; Lisp specific defuns
+
+(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)))))
182 defuns/misc-defuns.el
@@ -0,0 +1,182 @@
+;; Misc defuns go here
+;; It wouldn't hurt to look for patterns and extract once in a while
+
+(defmacro create-simple-keybinding-command (name key)
+ `(defmacro ,name (&rest fns)
+ (list 'global-set-key (kbd ,key) `(lambda ()
+ (interactive)
+ ,@fns))))
+
+(create-simple-keybinding-command f2 "<f2>")
+(create-simple-keybinding-command f5 "<f5>")
+(create-simple-keybinding-command f6 "<f6>")
+(create-simple-keybinding-command f7 "<f7>")
+(create-simple-keybinding-command f8 "<f8>")
+(create-simple-keybinding-command f9 "<f9>")
+(create-simple-keybinding-command f10 "<f10>")
+(create-simple-keybinding-command f11 "<f11>")
+(create-simple-keybinding-command f12 "<f12>")
+
+(defun goto-line-with-feedback ()
+ "Show line numbers temporarily, while prompting for the line number input"
+ (interactive)
+ (unwind-protect
+ (progn
+ (linum-mode 1)
+ (call-interactively 'goto-line))
+ (linum-mode -1)))
+
+(defun open-line-and-indent ()
+ (interactive)
+ (newline-and-indent)
+ (end-of-line 0))
+
+;; 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)))
+
+(defun isearch-yank-selection ()
+ "Put selection from buffer into search string."
+ (interactive)
+ (when (region-active-p)
+ (deactivate-mark))
+ (isearch-yank-internal (lambda () (mark))))
+
+(defun region-as-string ()
+ (buffer-substring (region-beginning)
+ (region-end)))
+
+(defun isearch-forward-use-region ()
+ (interactive)
+ (when (region-active-p)
+ (add-to-history 'search-ring (region-as-string))
+ (deactivate-mark))
+ (call-interactively 'isearch-forward))
+
+(defun isearch-backward-use-region ()
+ (interactive)
+ (when (region-active-p)
+ (add-to-history 'search-ring (region-as-string))
+ (deactivate-mark))
+ (call-interactively 'isearch-backward))
+
+(eval-after-load "multiple-cursors"
+ '(progn
+ (unsupported-cmd isearch-forward-use-region ".")
+ (unsupported-cmd isearch-backward-use-region ".")))
+
+(defun view-url ()
+ "Open a new buffer containing the contents of URL."
+ (interactive)
+ (let* ((default (thing-at-point-url-at-point))
+ (url (read-from-minibuffer "URL: " default)))
+ (switch-to-buffer (url-retrieve-synchronously url))
+ (rename-buffer url t)
+ ;; TODO: switch to nxml/nxhtml mode
+ (cond ((search-forward "<?xml" nil t) (xml-mode))
+ ((search-forward "<html" nil t) (html-mode)))))
+
+(defun linkify-region-from-kill-ring (start end)
+ (interactive "r")
+ (let ((text (buffer-substring start end)))
+ (delete-region start end)
+ (insert "<a href=\"")
+ (yank)
+ (insert (concat "\">" text "</a>"))))
+
+(defun buffer-to-html (buffer)
+ (with-current-buffer (htmlize-buffer buffer)
+ (buffer-string)))
+
+(defun sudo-edit (&optional arg)
+ (interactive "p")
+ (if (or arg (not buffer-file-name))
+ (find-file (concat "/sudo:root@localhost:" (ido-read-file-name "File: ")))
+ (find-alternate-file (concat "/sudo:root@localhost:" buffer-file-name))))
+
+(defun add-file-find-hook-with-pattern (pattern fn &optional contents)
+ "Add a find-file-hook that calls FN for files where PATTERN
+matches the file name, and optionally, where CONTENT matches file contents.
+Both PATTERN and CONTENTS are matched as regular expressions."
+ (lexical-let ((re-pattern pattern)
+ (fun fn)
+ (re-content contents))
+ (add-hook 'find-file-hook
+ (lambda ()
+ (if (and
+ (string-match re-pattern (buffer-file-name))
+ (or (null re-content)
+ (string-match re-content
+ (buffer-substring (point-min) (point-max)))))
+ (apply fun ()))))))
+
+;; Fix kmacro-edit-lossage, it's normal implementation
+;; is bound tightly to C-h
+(defun kmacro-edit-lossage ()
+ "Edit most recent 300 keystrokes as a keyboard macro."
+ (interactive)
+ (kmacro-push-ring)
+ (edit-kbd-macro 'view-lossage))
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)))))
52 defuns/snippet-helpers.el
@@ -0,0 +1,52 @@
+;;; javascript
+
+(defun js-method-p ()
+ (save-excursion
+ (word-search-backward "function")
+ (looking-back ": ")))
+
+(defun js-function-declaration-p ()
+ (save-excursion
+ (word-search-backward "function")
+ (looking-back "^\\s *")))
+
+(defun snippet--function-punctuation ()
+ (if (js-method-p)
+ (when (not (looking-at "[ \n\t\r]*[},]"))
+ (insert ","))
+ (unless (js-function-declaration-p)
+ (if (looking-at "$") (insert ";")))))
+
+(defun snippet--function-name ()
+ (if (js-function-declaration-p) "name" ""))
+
+;;; clojure
+
+(defun snippet--clojure-namespace-from-buffer-file-name ()
+ (replace-regexp-in-string "_" "-"
+ (replace-regexp-in-string "/" "."
+ (chop-prefix "test/"
+ (chop-prefix "src/"
+ (chop-suffix ".clj"
+ (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)))
+
+;; snippet-helper-helpers
+
+(defun chop-suffix (suffix s)
+ "Remove string 'suffix' if it is at end of string 's'"
+ (let ((pos (- (length suffix))))
+ (if (and (>= (length s) (length suffix))
+ (string= suffix (substring s pos)))
+ (substring s 0 pos)
+ s)))
+
+(defun chop-prefix (prefix s)
+ "Remove string 'prefix' if it is at start of string 's'"
+ (let ((pos (length prefix)))
+ (if (and (>= (length s) (length prefix))
+ (string= prefix (substring s 0 pos)))
+ (substring s pos)
+ s)))
243 init.el
@@ -0,0 +1,243 @@
+;; Turn off mouse interface early in startup to avoid momentary display
+(if (fboundp 'menu-bar-mode) (menu-bar-mode -1))
+(if (fboundp 'tool-bar-mode) (tool-bar-mode -1))
+(if (fboundp 'scroll-bar-mode) (scroll-bar-mode -1))
+
+(defconst system-site-lisp
+ (cond
+ ((equal system-type 'gnu/linux) "/usr/share/emacs/site-lisp/")
+ ((equal system-type 'darwin) (concat "/usr/local/Cellar/emacs/" (number-to-string emacs-major-version) "." (number-to-string emacs-minor-version) "/share/emacs/site-lisp/"))
+ (t (concat "/usr/local/emacs/site-lisp/"))))
+
+;; No splash screen please ... jeez
+(setq inhibit-startup-message t)
+
+;; Set path to dependencies
+(setq site-lisp-dir
+ (expand-file-name "site-lisp" user-emacs-directory))
+
+;; Set up load path
+(add-to-list 'load-path user-emacs-directory)
+(add-to-list 'load-path site-lisp-dir)
+(add-to-list 'load-path system-site-lisp)
+
+;; Keep emacs Custom-settings in separate file
+(setq custom-file (expand-file-name "custom.el" user-emacs-directory))
+(load custom-file)
+
+;; Set up appearance early
+(require 'appearance)
+
+;; Settings for currently logged in user
+(setq user-settings-dir
+ (concat user-emacs-directory "users/" user-login-name))
+(add-to-list 'load-path user-settings-dir)
+
+;; Add external projects to load path
+(dolist (project (directory-files site-lisp-dir t "\\w+"))
+ (when (file-directory-p project)
+ (add-to-list 'load-path project)))
+
+;; Write backup files to own directory
+(setq backup-directory-alist
+ `(("." . ,(expand-file-name
+ (concat user-emacs-directory "backups")))))
+
+;; Make backups of files, even when they're in version control
+(setq vc-make-backup-files t)
+
+;; Save point position between sessions
+(require 'saveplace)
+(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 packages
+(require 'setup-package)
+
+;; Install extensions if they're missing
+(defun init--install-packages ()
+ (packages-install
+ '(ag
+ magit
+ paredit
+ move-text
+ god-mode
+ gist
+ htmlize
+ visual-regexp
+ flycheck
+ flx
+ flx-ido
+ css-eldoc
+ calfw
+ calfw-gcal
+ yasnippet
+ smartparens
+ ido-vertical-mode
+ ido-at-point
+ simple-httpd
+ guide-key
+ nodejs-repl
+ restclient
+ highlight-escape-sequences
+ haml-mode
+ whitespace-cleanup-mode
+ elisp-slime-nav
+ git-commit-mode
+ gitconfig-mode
+ gitignore-mode
+ clojure-mode
+ org-jira
+ znc
+ twittering-mode
+ hackernews
+ nrepl)))
+
+(condition-case nil
+ (init--install-packages)
+ (error
+ (package-refresh-contents)
+ (init--install-packages)))
+
+;; Lets start with a smattering of sanity
+(require 'sane-defaults)
+
+;; Setup environment variables from the user's shell.
+(when is-mac
+ (require-package 'exec-path-from-shell)
+ (exec-path-from-shell-initialize))
+
+;; guide-key
+(require 'guide-key)
+(setq guide-key/guide-key-sequence '("C-x r" "C-x 4" "C-x v" "C-x 8"))
+(guide-key-mode 1)
+(setq guide-key/recursive-key-sequence-flag t)
+(setq guide-key/popup-window-position 'bottom)
+
+;; god-mode
+(require 'god-mode)
+(global-set-key (kbd "<escape>") 'god-local-mode)
+
+;; Setup extensions
+(eval-after-load 'ido '(require 'setup-ido))
+(eval-after-load 'org '(require 'setup-org))
+(eval-after-load 'dired '(require 'setup-dired))
+(eval-after-load 'magit '(require 'setup-magit))
+(eval-after-load 'grep '(require 'setup-rgrep))
+(eval-after-load 'shell '(require 'setup-shell))
+(require 'setup-hippie)
+(require 'setup-yasnippet)
+(require 'setup-perspective)
+(require 'setup-ffip)
+(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
+ ruby-mode
+ markdown-mode)
+ (add-hook it 'turn-on-smartparens-mode))
+(smartparens-global-mode 1)
+
+;; 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 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)
+
+;; 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+"))
+ (when (file-regular-p file)
+ (load file)))
+
+(require 'expand-region)
+(require 'multiple-cursors)
+(require 'delsel)
+(require 'jump-char)
+(require 'eproject)
+(require 'wgrep)
+(require 'smart-forward)
+(require 'change-inner)
+(require 'multifiles)
+
+;; Fill column indicator
+(require 'fill-column-indicator)
+(setq fci-rule-color "#111122")
+
+;; Browse kill ring
+(require 'browse-kill-ring)
+(setq browse-kill-ring-quit-action 'save-and-restore)
+
+;; Smart M-x is smart
+(require 'smex)
+(smex-initialize)
+
+;; Setup key bindings
+(require 'key-bindings)
+
+;; Misc
+(require 'project-archetypes)
+(require 'my-misc)
+(when is-mac (require 'mac))
+(require 'ag)
+(require 'jira-org)
+(require 'znc)
+(require 'calfw)
+(require 'calfw-gcal)
+(require 'twittering-mode)
+(setq twittering-use-master-password t)
+(setq twittering-icon-mode t)
+(setq twittering-use-icon-storage t)
+
+;; 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) (eldoc-mode 1)))
+
+;; Email, baby
+(require 'setup-mu4e)
+
+;; Emacs server
+(require 'server)
+(unless (server-running-p)
+ (server-start))
+
+;; Run at full power please
+(put 'downcase-region 'disabled nil)
+(put 'upcase-region 'disabled nil)
+(put 'narrow-to-region 'disabled nil)
+
+;; Conclude init by setting up specifics for the current user
+(when (file-exists-p user-settings-dir)
+ (mapc 'load (directory-files user-settings-dir nil "^[^#].*el$")))
+(put 'ido-exit-minibuffer 'disabled nil)
+
+;; Two frames at boot never hurt anybody.
+(new-frame)
+(new-frame)
4 jira-org.el
@@ -0,0 +1,4 @@
+(require 'org-jira)
+(setq jiralib-url "https://domain.atlassian.net")
+
+(provide 'jira-org)
335 key-bindings.el
<
@@ -0,0 +1,335 @@
+;; I don't need to kill emacs that easily
+;; the mnemonic is C-x REALLY QUIT
+(global-set-key (kbd "C-x r q") 'save-buffers-kill-terminal)
+(global-set-key (kbd "C-x C-c") 'delete-frame)
+
+;; 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)
+(global-set-key (kbd "M-X") 'smex-major-mode-commands)
+(global-set-key (kbd "C-c C-c M-x") 'execute-extended-command)
+
+;; Use C-x C-m to do M-x per Steve Yegge's advice
+(global-set-key (kbd "C-x C-m") 'smex)
+
+;; Expand region (increases selected region by semantic units)
+(global-set-key (if is-mac (kbd "C-@") (kbd "C-'")) 'er/expand-region)
+
+;; Experimental multiple-cursors
+(global-set-key (kbd "C-S-c C-S-c") 'mc/edit-lines)
+(global-set-key (kbd "C-S-c C-e") 'mc/edit-ends-of-lines)
+(global-set-key (kbd "C-S-c C-a") 'mc/edit-beginnings-of-lines)
+
+;; Mark additional regions matching current region
+(global-set-key (kbd "M-G") 'mc/mark-all-dwim)
+(global-set-key (kbd "M-s-@") 'mc/mark-previous-like-this)
+(global-set-key (kbd "M-@") 'mc/mark-next-like-this)
+(global-set-key (kbd "C-s-@") 'mc/mark-more-like-this-extended)
+(global-set-key (kbd "M-$") 'mc/mark-all-in-region)
+
+;; Symbol and word specific mark-more
+(global-set-key (kbd "s-@") 'mc/mark-next-word-like-this)
+(global-set-key (kbd "C-s-#") 'mc/mark-previous-word-like-this)
+(global-set-key (kbd "M-s-$") 'mc/mark-all-words-like-this)
+(global-set-key (kbd "s-%") 'mc/mark-next-symbol-like-this)
+(global-set-key (kbd "M-s-%") 'mc/mark-previous-symbol-like-this)
+(global-set-key (kbd "M-s-w") '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 "M-SPC") 'set-rectangular-region-anchor)
+
+;; Replace rectangle-text with inline-string-rectangle
+(global-set-key (kbd "C-x r t") 'inline-string-rectangle)
+
+;; Quickly jump in document with ace-jump-mode
+(define-key global-map (kbd "C-*") 'ace-jump-mode)
+
+;; Perform general cleanup.
+(global-set-key (kbd "C-c n") 'cleanup-buffer)
+(global-set-key (kbd "C-c C-n") 'cleanup-buffer)
+(global-set-key (kbd "C-c C-<return>") 'delete-blank-lines)
+
+;; M-i for back-to-indentation
+(global-set-key (kbd "M-i") 'back-to-indentation)
+
+;; Turn on the menu bar for exploring new modes
+(global-set-key (kbd "C-<f10>") 'menu-bar-mode)
+
+;; Use shell-like backspace C-h, rebind help to F1
+(define-key key-translation-map [?\C-h] [?\C-?])
+(global-set-key (kbd "<f1>") 'help-command)
+(define-key god-local-mode-map (kbd "h") 'backward-delete-char)
+
+(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)
+
+;; Killing text
+(global-set-key (kbd "C-S-k") 'kill-and-retry-line)
+(global-set-key (kbd "C-w") 'kill-region-or-backward-word)
+(global-set-key (kbd "C-c C-w") 'kill-to-beginning-of-line)
+
+;; 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") '(λ (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") (lambda (char) (interactive "cZap to char: ") (zap-to-char 1 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)
+(global-set-key (kbd "M-O") 'change-outer)
+
+(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)
+
+;; Jump to a definition in the current file. (This is awesome)
+(global-set-key (kbd "C-x C-i") 'ido-imenu)
+
+;; File finding
+(global-set-key (kbd "C-x M-f") 'ido-find-file-other-window)
+(global-set-key (kbd "C-x f") 'recentf-ido-find-file)
+(global-set-key (kbd "C-x C-p") 'find-or-create-file-at-point)
+(global-set-key (kbd "C-x M-p") 'find-or-create-file-at-point-other-window)
+(global-set-key (kbd "C-c y") 'bury-buffer)
+(global-set-key (kbd "C-c r") 'revert-buffer)
+(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)
+
+;; Copy file path to kill ring
+(global-set-key (kbd "C-x M-w") 'copy-current-file-path)
+
+;; Window switching
+(windmove-default-keybindings) ;; Shift+direction
+(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
+