summary refs log tree commit diff
path: root/emacs.d/lib
diff options
context:
space:
mode:
Diffstat (limited to '')
-rw-r--r--emacs.d/lib/my-functions.el38
-rw-r--r--emacs.d/lib/my-settings.el53
-rw-r--r--emacs.d/lib/org-settings.el43
3 files changed, 134 insertions, 0 deletions
diff --git a/emacs.d/lib/my-functions.el b/emacs.d/lib/my-functions.el
new file mode 100644
index 0000000..e661a01
--- /dev/null
+++ b/emacs.d/lib/my-functions.el
@@ -0,0 +1,38 @@
+;; jump to the scratch buffer
+(defun fc/switch-to-scratch ()
+  "Switch to scratch, grab the region if it's active."
+  (interactive)
+  (let ((contents
+         (and (region-active-p)
+              (buffer-substring (region-beginning)
+                                (region-end)))))
+    (switch-to-buffer "*scratch*")
+    (if contents
+        (progn
+          (goto-char (buffer-end 1))
+          (insert contents)))))
+
+(global-set-key (kbd "s-N") 'fc/switch-to-scratch)
+
+;; 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))))))))
+
+
+
+(provide 'my-functions)
diff --git a/emacs.d/lib/my-settings.el b/emacs.d/lib/my-settings.el
new file mode 100644
index 0000000..2e7e331
--- /dev/null
+++ b/emacs.d/lib/my-settings.el
@@ -0,0 +1,53 @@
+;; auto close bracket insertion
+(electric-pair-mode 1)
+
+;; ?
+(add-hook 'prog-mode-hook
+          (lambda () (setq show-trailing-whitespace t)))
+
+;; this makes emacs slow to work with source
+(delete 'Git vc-handled-backends)
+
+;; alias yes-or-no to y-or-n
+(fset 'yes-or-no-p 'y-or-n-p)
+
+;; set utf-8 as the default encoding
+(prefer-coding-system 'utf-8-unix)
+
+;; reload the buffer when a file changes
+(global-auto-revert-mode 1)
+
+;; global settings for built-in emacs parameters
+(setq auto-save-default nil
+      auto-save-list-file-prefix nil
+      inhibit-startup-screen t
+      initial-scratch-message nil
+      make-backup-files nil
+      require-final-newline t
+      vc-follow-symlinks t
+      next-screen-context-lines 5
+      column-number-mode t
+      ring-bell-function 'ignore
+      tab-always-indent 'complete)
+
+(setq-default indent-tabs-mode nil
+              create-lockfiles nil)
+
+;; show parenthesis
+(show-paren-mode +1)
+
+;; no blink cursor
+(blink-cursor-mode -1)
+
+(when window-system
+  (tool-bar-mode 0)
+  (scroll-bar-mode 0)
+  (menu-bar-mode -1))
+
+;; I don't want a frindge on the right
+(fringe-mode '(4 . 0))
+
+;; Set default font
+(set-face-attribute 'default nil :family "Droid Sans Mono" :height 130 :weight 'normal :width 'normal)
+
+(provide 'my-settings)
diff --git a/emacs.d/lib/org-settings.el b/emacs.d/lib/org-settings.el
new file mode 100644
index 0000000..ba67503
--- /dev/null
+++ b/emacs.d/lib/org-settings.el
@@ -0,0 +1,43 @@
+(use-package org-mode
+  :bind (("C-c a" . org-agenda)
+         ("C-c c" . org-capture)
+         ("C-c o" . org-iswitchb))
+
+  :config
+  (progn
+    (setq org-startup-indented t
+          org-indent-mode t
+          org-return-follows-link t
+          org-blank-before-new-entry nil)))
+
+(setq org-todo-keywords
+      '((sequence "TODO" "IN-PROGRESS" "WAITING" "DONE")))
+
+(setq org-link-abbrev-alist
+      '(("src" . "~/src/%s")
+        ("jira" . "https://jira.twitter.biz/browse/%s")
+        ("rb" . "https://reviewboard.twitter.biz/r/%s")
+        ("go" . "http://go/%s")))
+
+(setq org-default-notes-file "~/src/notes/org/inbox.org")
+
+(setq org-agenda-files (list "~/src/notes/org/personal.org"
+                             "~/src/notes/org/work.org"
+                             "~/src/notes/org/inbox.org"))
+
+;; org-startup-indented
+(add-hook 'org-mode-hook (lambda () (setq truncate-lines nil)))
+
+(setq org-capture-templates
+      '(("t" "Todo" entry (file+headline "~/src/notes/org/inbox.org" "Tasks")
+         "* TODO %?\n%a")
+        ("j" "Journal" entry (file+datetree "~/src/notes/org/journal.org")
+         "* %T\n%?")
+        ("m" "Meeting" entry (file+headline "~/src/notes/org/inbox.org" "Meetings")
+         "* %^{prompt} %U\n%?")))
+
+(setq org-refile-targets
+      '(("~/src/notes/org/work.org" :maxlevel . 2)
+        ("~/src/notes/org/personal.org" :maxlevel . 2)))
+
+(provide 'org-settings)