diff --git a/init.el b/init.el index fa5f8909a..056deb0aa 100644 --- a/init.el +++ b/init.el @@ -16,22 +16,22 @@ (when window-system (desktop-save-mode 1)) ;; Global vars -(defconst my/dir (file-name-directory load-file-name)) -(defconst my/init-dir (expand-file-name "init" my/dir)) -(defconst my/themes-dir (expand-file-name "themes" my/dir)) -(defconst my/elisp-dir (expand-file-name "elisp" my/dir)) -(defconst my/tmp-dir (expand-file-name "tmp" my/dir)) -(defconst my/snippets-dir (expand-file-name "snippets" my/dir)) +(defconst my/dir (file-name-directory load-file-name)) +(defconst my/init-dir (expand-file-name "init" my/dir)) +(defconst my/themes-dir (expand-file-name "themes" my/dir)) +(defconst my/elisp-dir (expand-file-name "elisp" my/dir)) +(defconst my/tmp-dir (expand-file-name "tmp" my/dir)) +(defconst my/snippets-dir (expand-file-name "snippets" my/dir)) -(defconst my/theme 'brin) -(defconst my/font "Inconsolata-14") +(defconst my/theme 'brin) +(defconst my/font "Inconsolata-14") (add-to-list 'load-path my/init-dir) (mapc 'require '(core ; Just the... bear necessities... - my-defuns + my-defuns ; Personal functions ;; Modules to improve on emacs' heresy init-project ; Project navigation tools & settings diff --git a/init/my-defuns.el b/init/my-defuns.el index 6b085eb06..92756c07c 100644 --- a/init/my-defuns.el +++ b/init/my-defuns.el @@ -19,28 +19,34 @@ ;;;; Commands ;;;;;;;;;;;;;;;;;;;;;; ;; File navigation defuns (defun my/initfiles () + "Do an ido-find in ~/.emacs.d" (interactive) (ido-find-file-in-dir my/dir)) (defun my/open-scratch () + "Open a blank scratch buffer" (interactive) (switch-to-buffer (get-buffer-create "*scratch*")) (text-mode)) (defun my/expand-space () + "Insert a space ahead of the cursor" (interactive) (save-excursion (insert " "))) (defun my/expand-backspace () + "Add a space before and ahead of the cursor" (interactive) (save-excursion (delete-char 1)) (delete-backward-char 1)) (defun my/enable-hard-wrap() + "Enable hard line wrapping" (interactive) (auto-fill-mode 1)) (defun my/byte-recompile () + "Byte compile init.el, ~/.emacs.d/init/* and ~/.emacs.d/elisp/*" (interactive) (byte-recompile-file (expand-file-name "init.el" my/dir)) (byte-recompile-directory my/init-dir 0) @@ -52,11 +58,13 @@ (ido-find-file-in-dir "~/Dropbox/notes")) (defun my/kill-all-buffers () + "Kill all buffers, even the one you're in" (interactive) (mapc 'kill-buffer (buffer-list)) (message "All buffers killed")) (defun my/kill-other-buffers () + "Kill all buffers but the one you're in" (interactive) (mapc 'kill-buffer (cdr (buffer-list (current-buffer)))) (message "All other buffers killed")) @@ -73,6 +81,8 @@ (setq ac-sources (append '(ac-source-filename ac-source-files-in-current-dir) ac-sources))) (defun my/setup-run-code(mode interpreter) + "Set up s-r to run code using a specified interpreter and print the +output in the echo area" (interactive) (nmap mode (kbd "s-r") (λ (shell-command-on-region (point-min) (point-max) interpreter)))