Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions general-config.el
Original file line number Diff line number Diff line change
Expand Up @@ -19,3 +19,9 @@ This is particularly useful under Mac OSX, where GUI apps are not started from a
(aw/set-env-from-shell "GOPATH")
(aw/set-env-from-shell "GOOS")
(aw/set-env-from-shell "GOARCH")

;; deal with certain tramp errors with an overly-long temp directory
(let ((tmpdir "/tmp/emacs"))
(unless (file-directory-p "/tmp/emacs")
(mkdir tmpdir))
(setenv "TMPDIR" tmpdir))
3 changes: 3 additions & 0 deletions init-keys.el
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,9 @@
(when (boundp 'mac-command-modifier)
(setq mac-command-modifier 'meta))

(when (boundp 'mac-option-modifier)
(setq mac-option-modifier 'super))

;; Window splitting
;; Rebind these since rarely used
(global-set-key (kbd "M-0") 'delete-window)
Expand Down
155 changes: 136 additions & 19 deletions init-mode.el
Original file line number Diff line number Diff line change
Expand Up @@ -23,8 +23,11 @@
(require 'web-mode)
(add-to-list 'auto-mode-alist '("\\.html$" . web-mode))
(add-to-list 'auto-mode-alist '("\\.erb$" . web-mode))
(add-to-list 'auto-mode-alist '("\\.ejs$" . web-mode))
(add-to-list 'auto-mode-alist '("\\.mako$" . web-mode))
(add-to-list 'auto-mode-alist '("\\.handlebars$" . web-mode))
(add-to-list 'auto-mode-alist '("\\.jsx$" . web-mode))
;; (add-to-list 'auto-mode-alist '("\\.tsx$" . web-mode))
;; default to django templating for all HTML files
(add-to-list 'web-mode-engine-file-regexps
'("django" . "\\.html$"))
Expand All @@ -38,8 +41,16 @@
ad-do-it)
ad-do-it))

;; Certain weirdo Dropbox things get python-mode
;; e.g., pystachio
(add-to-list 'auto-mode-alist '("\\.pyst$" . python-mode))
(add-to-list 'auto-mode-alist '("\\.pyst-include$" . python-mode))
;; and bazel stuff
(add-to-list 'auto-mode-alist '("\\(^\\|/\\)BUILD" . python-mode))
(add-to-list 'auto-mode-alist '("\\(^\\|/\\)WORKSPACE" . python-mode))
(add-to-list 'auto-mode-alist '("\\.bzl$" . python-mode))

;; pyxl-mode
(load "pyxl-mode.el")
(require 'pyxl-mode)
(add-to-list 'auto-mode-alist '("\\.py$" . pyxl-mode))

Expand All @@ -49,13 +60,31 @@
(add-to-list 'auto-mode-alist '("\\.js$" . js2-mode))
(setq js2-cleanup-whitespace t ;; clear whitespace on save
js2-mirror-mode nil) ;; but do NOT match parens.
(add-hook
'js2-mode-hook
'(lambda ()
;; Don't redefine M-j - we use it to navigate
(define-key js2-mode-map (kbd "M-j") nil)))
(add-hook 'js2-mode-hook
'(lambda ()
;; Don't redefine M-j - we use it to navigate
(define-key js2-mode-map (kbd "M-j") nil)))
;; Extra autocompletion fun
;; (add-hook 'js2-mode-hook 'ac-js2-mode)

(require 'typescript-mode)
(setq typescript-indent-level 2)
(add-hook 'typescript-mode-hook
'(lambda ()
(define-key typescript-mode-map (kbd "M-.") nil)
(eldoc-mode +1)
(company-mode +1)))
(add-to-list 'auto-mode-alist '("\\.tsx$" . typescript-mode))

;; ;; tide
(require 'tide)
(add-hook 'typescript-mode-hook #'tide-setup)

;; tsx
;; (add-to-list 'auto-mode-alist '("\\.tsx\\'" . web-mode))
;; (add-hook 'web-mode-hook
;; (lambda ()
;; (when (string-equal "tsx" (file-name-extension buffer-file-name))
;; (setup-tide-mode))))

;; ruby
(require 'ruby-mode)
Expand All @@ -64,6 +93,10 @@
(add-to-list 'auto-mode-alist '("Rakefile$" . ruby-mode))
(add-to-list 'auto-mode-alist '("Vagrantfile$" . ruby-mode))

;; php
(require 'php-mode)
(add-to-list 'auto-mode-alist '("\\.php$" . php-mode))

;; cython
(require 'cython-mode)

Expand All @@ -79,12 +112,21 @@
(require 'markdown-mode)
(add-to-list 'auto-mode-alist '("\\.markdown$" . markdown-mode))
(add-to-list 'auto-mode-alist '("\\.md$" . markdown-mode))
(defun aw/markdown-mode-setup ()
(visual-line-mode))
(add-hook 'markdown-mode-hook 'aw/markdown-mode-setup)

;; lua
(require 'lua-mode)
(setq lua-indent-level 2)
(add-to-list 'auto-mode-alist '("\\.lua$" . lua-mode))

;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;; UTILITY CONFIG

;; projectile
(require 'projectile)
(setq projectile-enable-caching t)
(projectile-global-mode)
(setq projectile-completion-system 'ido)

Expand Down Expand Up @@ -117,6 +159,19 @@
;; Show menu more quickly after autocomplete starts
(setq ac-auto-show-menu (* ac-delay 2))

;; Company
(require 'company)
(add-to-list 'company-backends 'typescript-mode)
(setq company-idle-delay 0.2)

;; Flymake - show in minibuffer when over
(defun aw/flymake-show-help ()
(when (get-char-property (point) 'flymake-overlay)
(let ((help (get-char-property (point) 'help-echo)))
(when help (popup-tip help)))))

(add-hook 'post-command-hook 'aw/flymake-show-help)

;; Python mode
;; Don't accidentally make python buffer
(add-hook 'python-mode-hook
Expand Down Expand Up @@ -152,25 +207,16 @@
(local-set-key (kbd "M-,") 'jedi:goto-definition-pop-marker)
(local-set-key (kbd "M-/") 'jedi:get-in-function-call)))


;; Go
(require 'go-autocomplete)
(require 'go-eldoc)

;; this is annoying, but shrug.
(load "oracle.el")
(require 'go-oracle)
(setq go-oracle-command (executable-find "oracle"))

(add-hook 'go-mode-hook
'(lambda ()
;; eldoc stuff
(go-eldoc-setup)

;; oracle, which is fussy
(go-oracle-mode)
(make-local-variable 'go-oracle-scope)
(setq go-oracle-scope (aw/go-scope-from-buffer (current-buffer)))

;; gofmt
(add-hook 'before-save-hook 'gofmt-before-save)

Expand All @@ -179,20 +225,91 @@
(local-set-key (kbd "M-,") 'pop-tag-mark)
(local-set-key (kbd "M-?") 'godoc-at-point)))

;; Java / Scala

;; Someday...someday...

;; (require 'eclim)
;; (require 'ac-emacs-eclim-source)
;; (ac-emacs-eclim-config)
;; (require 'eclimd)
;; ;; don't wait for startup
;; (setq eclimd-wait-for-process nil)
;; (add-hook 'java-mode-hook
;; (lambda ()
;; (unless eclimd-process
;; (let* ((root-dir (expand-file-name
;; (vc-find-root (buffer-file-name (current-buffer))
;; ".git")))
;; (project-dir (read-directory-name "Enter project directory: "
;; root-dir nil t)))
;; (start-eclimd project-dir)))))



;; Shell
(require 'tramp)
(ansi-color-for-comint-mode-on)

(require 'multi-term)
(add-hook 'multi-term-hook
(lambda ()
(setq show-trailing-whitespace nil)))

;; Org-mode
(require 'org)
(global-set-key (kbd "C-c l") 'org-store-link)
(global-set-key (kbd "C-c a") 'org-agenda)
;; little hack to avoid lockfiles
(global-set-key (kbd "C-c c") 'org-capture)

(defun my-org-path (f) (concat "~/Dropbox Dropbox/Drew Werner/org/" f))

;; capture / refile flow
(let ((dbx-task-categories '("Analytics" "Reliability" "Data Layer"
"Performance" "Streaming" "Management"
"Uncategorized")))
(setq org-capture-templates
(mapcar (lambda (cat)
(list (substring cat 0 1) (concat "Backlog: " cat) 'entry
(list 'file+olp (my-org-path "backlog.org") cat)
"** TODO %?\n"))
dbx-task-categories)))

(setq org-agenda-files
(mapcar 'expand-file-name
(file-expand-wildcards "~/Dropbox/org/[A-Za-z]*.org")))
(file-expand-wildcards (my-org-path "[A-Za-z]*.org"))))

(setq org-agenda-custom-commands
`(("d" todo "DELEGATED")
("T" todo "TODO" ((org-agenda-files '(,(my-org-path "current.org")))))
("b" todo "*" ((org-agenda-files '(,(my-org-path "backlog.org")))))
("r" todo "SOURCED")
("S" todo "SEARCHED")
("M" todo "TO_EMAIL")
("E" todo "EMAILED")
("R" todo "TODO" ((org-agenda-files '(,(my-org-path "recruiting.org")))))
("A" todo "MET|FIT|IIP|ONSITE"
((org-agenda-files '(,(my-org-path "recruiting.org")))))))

;; little hack to avoid lockfiles
(setq org-log-done t)

;; right now we refile only to the "current" tasklist
;; maaaybe we add recruiting at some point
(setq org-refile-targets
'(("~/Dropbox Dropbox/Drew Werner/org/current.org" :level . 1)))

(setq org-refile-use-outline-path t)
(setq org-outline-path-complete-in-steps t)

(defun my-org-archive-done-in-buffer ()
(interactive)
(org-map-entries
'org-archive-subtree
"/DONE|CANCELLED|ACCEPTED|REJECTED|NOT_INTERESTED|OTHER"))

(global-set-key (kbd "C-c C-$") 'my-org-archive-done-in-buffer)

;; EWW
(add-hook 'eww-mode-hook
'(lambda ()
Expand Down
25 changes: 22 additions & 3 deletions init-packages.el
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
(defun my-init-packages (packages)
(when packages
(let ((this-package (car packages))
(rest (cdr packages)))
(rest (cdr packages)))
(add-to-list 'package-load-list (cons this-package t))
(my-init-packages rest))))

Expand All @@ -22,27 +22,39 @@
less-css-mode ;; programming modes
web-mode
js2-mode
coffee-mode
tss
typescript-mode
tide
cython-mode
enh-ruby-mode
haskell-mode
markdown-mode
go-mode
puppet-mode
yaml-mode
lua-mode
auto-complete ;; misc productivity
company
projectile
multi-term
epc
jedi
ac-js2
go-autocomplete
go-eldoc
emacs-eclim
ag
magit
multiple-cursors
expand-region
helm
twittering-mode
hackernews))

;; suppress magit startup warning
(setq magit-last-seen-setup-instructions "1.4.0")

(defun uninstalled-packages (packages)
(delq nil
(mapcar (lambda (p) (if (package-installed-p p) nil p)) packages)))
Expand All @@ -67,10 +79,13 @@
(setq solarized-use-variable-pitch nil)
(setq x-underline-at-descent-line t)
(load-theme 'solarized-dark t)
;; (require 'color-theme)
;; (color-theme-initialize)
;; (color-theme-hober)

(require 'magit)
(global-set-key (kbd "C-c g s") 'magit-status)
(global-set-key (kbd "C-c g b") 'magit-blame-mode)
(global-set-key (kbd "C-c g b") 'magit-blame)
;; my little github helper, here for thematic consistency
(global-set-key (kbd "C-c g h") 'aw/get-github-link)

Expand All @@ -93,5 +108,9 @@
(require 'multiple-cursors)
(global-set-key (kbd "C-.") 'mc/mark-next-like-this)
(global-set-key (kbd "C-,") 'mc/mark-previous-like-this)
(global-set-key (kbd "C-c C-,") 'mc/mark-all-like-this)))
(global-set-key (kbd "C-c C-,") 'mc/mark-all-like-this)

;; the little expand region code
(require 'expand-region)
(global-set-key (kbd "C-=") 'er/expand-region)))

3 changes: 3 additions & 0 deletions init-ui.el
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,9 @@
(defun track-mouse (e))
(setq mouse-sel-mode t)

;; No menu bar
(menu-bar-mode -1)

;; No Toolbar
(if window-system (tool-bar-mode -1))

Expand Down
2 changes: 1 addition & 1 deletion init.el
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
(when (member "Menlo" (font-family-list))
(set-face-attribute 'default nil
:family "Menlo"
:height 120))
:height 140))

;; Helper to load files based on relative paths
(defun relative-to-full-path (filename)
Expand Down
Loading