summary refs log tree commit diff
path: root/emacs.d/lib/twitter.el
blob: 1d67008e2a88ceab1380ddc22eac66bf2a36cd85 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
;; packages that are needed only for twitter

(use-package pants
  ;; interface to pants
  :load-path (lambda () (expand-file-name  "~/src/pants.el/"))

  :config
  (setq pants-completion-system 'ivy
        pants-source-tree-root "/Users/fcuny/src/source"
        pants-bury-compilation-buffer t
        pants-extra-args "-q")

  :bind (("C-c b" . pants-find-build-file)
         ("C-c r" . pants-run-binary)
         ("C-c t" . pants-run-test)))

(use-package puppet-mode
  ;; mode to support puppet and work with puppet
  :ensure t

  :mode ("\\.pp\\'" . puppet-mode)

  :init (add-hook 'puppet-mode-hook 'flycheck-mode)

  :config
  (when (memq window-system '(mac ns x))
    (dolist (var '("GEM_HOME" "GEM_PATH" "MY_RUBY_HOME"))
      (unless (getenv var)
        (exec-path-from-shell-copy-env var))))
  (setq flycheck-puppet-lint-rc "/Users/fcuny/src/twitter-ops/utilities/puppet/.puppet-lint.rc"))

(use-package scala-mode
  ;; mode to work with scala files
  :ensure t)

(use-package thrift
  ;; mode to work with thrift files
  :ensure t

  :mode ("\\.thrift\\'" . thrift-mode)

  :config
  (setq thrift-indent-level 2))

;; custom functions

(defun fc/check-source-p ()
  ;; predicate for checking style only on python files
  (and (executable-find "check.pex")
       (buffer-file-name)
       (string-match "src/source/.*\.py$" (buffer-file-name))))

;;; errors are reported like this:
;;; E241:ERROR   <file name>:<line> <message>
(flycheck-define-checker source-check
  "A syntax checker for python source code in Source, using `check.pex'"
  :command ("check.pex" source)
  :error-patterns ((error line-start (id (1+ nonl)) ":ERROR" (1+ nonl) ":" line (message) line-end)
                   (warning line-start (id (1+ nonl)) ":WARNING" (1+ nonl) ":" line (message) line-end))
  :predicate fc/check-source-p
  :modes (python-mode))

(add-to-list 'flycheck-checkers 'source-check)

(defun fc/start-nest-tmp-file (file-name)
  "Create a file in ~/tmp on nest for the give file name."
  (interactive "sName of the temporary file: ")
  (fc/start--file (expand-file-name (format "/nest.smfc.twitter.com:~/tmp/%s" file-name))))

(defun fc/remote-nest-dired ()
  "Open dired on nest."
  (interactive)
  (fc/remote--dired "nest.smfc.twitter.com"))

(provide 'twitter)