summary refs log tree commit diff
path: root/emacs.d/config
diff options
context:
space:
mode:
Diffstat (limited to 'emacs.d/config')
-rw-r--r--emacs.d/config/config-env.el19
-rw-r--r--emacs.d/config/config-lib.el34
-rw-r--r--emacs.d/config/config-package.el23
-rw-r--r--emacs.d/config/config-set-path.el9
4 files changed, 85 insertions, 0 deletions
diff --git a/emacs.d/config/config-env.el b/emacs.d/config/config-env.el
new file mode 100644
index 0000000..3f7bf0a
--- /dev/null
+++ b/emacs.d/config/config-env.el
@@ -0,0 +1,19 @@
+(defvar fcuny/workspace (expand-file-name "workspace" (getenv "HOME"))
+  "Path to the workspace.")
+
+(defvar fcuny/path-twitter-git (expand-file-name "git.twitter.biz" fcuny/workspace)
+  "Path to twitter's git repositories.")
+
+(defvar fcuny/path-github (expand-file-name "github.com" fcuny/workspace)
+  "Path to github's git repositories.")
+
+(defvar fcuny/path-twitter-svn (expand-file-name "svn.twitter.biz" fcuny/workspace)
+  "Path to twitter's SVN repositories.")
+
+(defvar fcuny/twitter-ops-linter (expand-file-name "twitter-ops/utilities/puppet/.puppet-lint.rc" fcuny/path-twitter-svn)
+  "Path to the linter's configuration for twitter-ops.")
+
+(defvar fcuny/twitter-gcp-linter (expand-file-name "gcp-puppet-manifests/.puppet-lint-rc" fcuny/path-twitter-git)
+  "Path to the linkter's configucation for gcp-puppet-manifests")
+
+(provide 'config-env)
diff --git a/emacs.d/config/config-lib.el b/emacs.d/config/config-lib.el
new file mode 100644
index 0000000..5148ff7
--- /dev/null
+++ b/emacs.d/config/config-lib.el
@@ -0,0 +1,34 @@
+(require 'config-package)
+
+;; rename a buffer
+(defun fc/rename-this-buffer-and-file ()
+  "Renames current buffer and file it is visiting."
+  (interactive)
+  (let ((name (buffer-name))
+        (filename (buffer-file-name))
+        (read-file-name-function 'read-file-name-default))
+    (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
+               (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))))))))
+
+
+;; predicate for checking style only on python files
+(defun fc/check-source-p ()
+  "Finds if the current python file is in the `source' repository."
+  (and (executable-find "check.pex")
+       (buffer-file-name)
+       (string-match "src/source/.*\.py$" (buffer-file-name))))
+
+(defun fc/check-gcp-puppet-p ()
+  "Finds if the current file is in GCP's puppet repository."
+  (string-match "gcp-puppet-manifest/.*$" (buffer-file-name)))
+
+(provide 'config-lib)
diff --git a/emacs.d/config/config-package.el b/emacs.d/config/config-package.el
new file mode 100644
index 0000000..1b262c3
--- /dev/null
+++ b/emacs.d/config/config-package.el
@@ -0,0 +1,23 @@
+;; where to store the packages
+(setq package-user-dir (expand-file-name "var/elpa" user-emacs-directory))
+
+(require 'package)
+(add-to-list 'package-archives '("melpa" . "http://melpa.org/packages/") t)
+
+;; enable package
+;; (setq package-enable-at-startup nil)
+
+;; initialize it
+(package-initialize)
+
+;; paradox is a better interface
+(when (not (package-installed-p 'paradox))
+  (package-install 'paradox))
+
+(paradox-require 'use-package)
+
+(require 'use-package)
+
+(setq use-package-always-ensure t)
+
+(provide 'config-package)
diff --git a/emacs.d/config/config-set-path.el b/emacs.d/config/config-set-path.el
new file mode 100644
index 0000000..a22416d
--- /dev/null
+++ b/emacs.d/config/config-set-path.el
@@ -0,0 +1,9 @@
+(paradox-require 'exec-path-from-shell)
+
+(when (memq window-system '(x mac ns))
+  (exec-path-from-shell-initialize)
+  (dolist (var '("GEM_HOME" "GEM_PATH" "MY_RUBY_HOME"))
+    (unless (getenv var)
+      (exec-path-from-shell-copy-env var))))
+
+(provide 'config-set-path)