Refactor core initfiles

This commit is contained in:
Henrik Lissner 2015-01-09 21:47:51 -05:00
parent 2a7dac1a4e
commit 8e7cd74e07
8 changed files with 157 additions and 176 deletions

View file

@ -1,4 +1,4 @@
;; Global editor behavior (+ evil) ;; Global editor behavior
(use-package expand-region (use-package expand-region
:commands (er/expand-region er/contract-region)) :commands (er/expand-region er/contract-region))

View file

@ -6,7 +6,7 @@
(setq evil-want-visual-char-semi-exclusive t (setq evil-want-visual-char-semi-exclusive t
evil-search-module 'evil-search evil-search-module 'evil-search
evil-search-wrap nil evil-search-wrap nil
evil-magic 'very-magic evil-magic 'magic
evil-want-C-u-scroll t ; enable C-u for scrolling evil-want-C-u-scroll t ; enable C-u for scrolling
evil-ex-visual-char-range t ; column range for ex commands evil-ex-visual-char-range t ; column range for ex commands
evil-ex-search-vim-style-regexp t evil-ex-search-vim-style-regexp t
@ -15,7 +15,6 @@
evil-normal-state-cursor '("white" box) evil-normal-state-cursor '("white" box)
evil-emacs-state-cursor '("cyan" bar) evil-emacs-state-cursor '("cyan" bar)
evil-insert-state-cursor '("white" bar) evil-insert-state-cursor '("white" bar)
evil-god-state-cursor '("orange" box)
evil-visual-state-cursor 'hollow evil-visual-state-cursor 'hollow
ace-jump-mode-scope 'window ace-jump-mode-scope 'window
@ -50,12 +49,11 @@
(evil-set-initial-state `,(car mode-map) `,(cdr mode-map))) (evil-set-initial-state `,(car mode-map) `,(cdr mode-map)))
(progn ; evil plugins (progn ; evil plugins
(use-package evil-space :init (evil-space-default-setup))
(use-package evil-exchange (use-package evil-exchange
:config :config
(defadvice evil-force-normal-state (before evil-esc-quit-exchange activate) (defadvice evil-force-normal-state (before evil-esc-quit-exchange activate)
(shut-up (evil-exchange-cancel)))) (when evil-exchange--overlays
(evil-exchange-cancel))))
(use-package evil-ex-registers) (use-package evil-ex-registers)
@ -63,19 +61,8 @@
(use-package evil-numbers) (use-package evil-numbers)
(use-package evil-god-state)
(use-package evil-matchit :init (global-evil-matchit-mode 1)) (use-package evil-matchit :init (global-evil-matchit-mode 1))
(use-package evil-snipe
:disabled t
:init (global-evil-snipe-mode 1)
:config
(progn
(evil-snipe-override-surround)
(setq evil-snipe-search-highlight t)
(setq evil-snipe-search-incremental-highlight t)))
(use-package evil-surround (use-package evil-surround
:init (global-evil-surround-mode 1)) :init (global-evil-surround-mode 1))
@ -94,10 +81,10 @@
:init (global-evil-snipe-mode) :init (global-evil-snipe-mode)
:config :config
(progn (progn
(bind 'visual "z" 'evil-snipe-f) (evil-snipe-replace-evil)
(bind 'visual "Z" 'evil-snipe-F) ;; (evil-snipe-enable-sS)
(setq evil-snipe-enable-highlight t (bind 'visual "z" 'evil-snipe-s)
evil-snipe-enable-incremental-highlight t))) (bind 'visual "Z" 'evil-snipe-S)))
(use-package ace-window (use-package ace-window
:config (setq aw-keys '(?a ?s ?d ?f ?g ?h ?j ?k ?l))) :config (setq aw-keys '(?a ?s ?d ?f ?g ?h ?j ?k ?l)))
@ -220,20 +207,31 @@
file-name)) file-name))
(progn ; ex-commands (progn ; ex-commands
(evil-ex-define-cmd "echo" 'my:echo)
(evil-ex-define-cmd "pres[ent]" 'toggle-presentation-mode) (evil-ex-define-cmd "pres[ent]" 'toggle-presentation-mode)
(evil-ex-define-cmd "togglet[heme]" 'toggle-theme) (evil-ex-define-cmd "togglet[heme]" 'toggle-theme)
(evil-ex-define-cmd "full[scr]" 'toggle-frame-fullscreen) (evil-ex-define-cmd "full[scr]" 'toggle-frame-fullscreen)
(evil-ex-define-cmd "k[ill]" 'kill-this-buffer) ; Kill current buffer (evil-ex-define-cmd "k[ill]" 'kill-this-buffer) ; Kill current buffer
(evil-ex-define-cmd "k[ill]o" 'my-cleanup-buffers) ; Kill current project buffers (evil-ex-define-cmd "k[ill]o" 'my-cleanup-buffers) ; Kill current project buffers
(evil-ex-define-cmd "k[ill]all" 'my:kill-buffers) ; Kill all buffers (bang = project buffers only)
(evil-ex-define-cmd "k[ill]buried" 'my:kill-buried-buffers) ; Kill all buffers (bang = project buffers only)
(evil-ex-define-cmd "ini" 'my:init-files)
(evil-ex-define-cmd "n[otes]" 'my:notes)
(evil-ex-define-cmd "recompile" 'my:byte-compile)
(evil-ex-define-cmd "cd" 'my:cd)
(evil-ex-define-cmd "en[ew]" 'my:create-file)
(evil-ex-define-cmd "ren[ame]" 'my:rename-this-file) ; Rename file . Bang: Delete old one
(evil-ex-define-cmd "al[ign]" 'my:align)
(evil-ex-define-cmd "retab" 'my:retab)
(evil-ex-define-cmd "sq[uint]" 'my:narrow-indirect) ; Narrow buffer to selection
(evil-ex-define-cmd "x" 'my:scratch-buffer)
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
(evil-ex-define-cmd "echo" 'my:echo)
(evil-define-command my:echo (&optional output) (evil-define-command my:echo (&optional output)
(interactive "<a>") (interactive "<a>")
(message "%s" output)) (message "%s" output))
(evil-ex-define-cmd "k[ill]all" 'my:kill-buffers) ; Kill all buffers (bang = project buffers only)
(evil-define-command my:kill-buffers (&optional bang) (evil-define-command my:kill-buffers (&optional bang)
:repeat nil :repeat nil
(interactive "<!>") (interactive "<!>")
@ -242,14 +240,12 @@
(mapc 'kill-buffer (buffer-list))) (mapc 'kill-buffer (buffer-list)))
(delete-other-windows)) (delete-other-windows))
(evil-ex-define-cmd "k[ill]buried" 'my:kill-buried-buffers) ; Kill all buffers (bang = project buffers only)
(evil-define-command my:kill-buried-buffers (&optional bang) (evil-define-command my:kill-buried-buffers (&optional bang)
:repeat nil :repeat nil
(interactive "<!>") (interactive "<!>")
(mapc 'kill-buffer (mapc 'kill-buffer
(my-living-buffer-list (if bang (projectile-project-buffers) (buffer-list))))) (my-living-buffer-list (if bang (projectile-project-buffers) (buffer-list)))))
(evil-ex-define-cmd "ini" 'my:init-files)
(evil-define-command my:init-files (&optional bang) (evil-define-command my:init-files (&optional bang)
:repeat nil :repeat nil
(interactive "<!>") (interactive "<!>")
@ -257,13 +253,11 @@
(ido-find-file-in-dir my-modules-dir) (ido-find-file-in-dir my-modules-dir)
(ido-find-file-in-dir my-dir))) (ido-find-file-in-dir my-dir)))
(evil-ex-define-cmd "n[otes]" 'my:notes)
(evil-define-command my:notes () (evil-define-command my:notes ()
:repeat nil :repeat nil
(interactive) (interactive)
(ido-find-file-in-dir org-directory)) (ido-find-file-in-dir org-directory))
(evil-ex-define-cmd "recompile" 'my:byte-compile)
(evil-define-command my:byte-compile (&optional bang) (evil-define-command my:byte-compile (&optional bang)
:repeat nil :repeat nil
(interactive "<!>") (interactive "<!>")
@ -271,14 +265,12 @@
(byte-recompile-directory (concat my-dir ".cask") 0 t) (byte-recompile-directory (concat my-dir ".cask") 0 t)
(byte-recompile-directory my-dir 0 t))) (byte-recompile-directory my-dir 0 t)))
(evil-ex-define-cmd "cd" 'my:cd)
(evil-define-command my:cd (dir) (evil-define-command my:cd (dir)
:repeat nil :repeat nil
(interactive "<f>") (interactive "<f>")
(cd (if (zerop (length dir)) "~" dir))) (cd (if (zerop (length dir)) "~" dir)))
(defun --save-exit() (save-buffer) (kill-buffer) (remove-hook 'yas-after-exit-snippet-hook '--save-exit)) (defun --save-exit() (save-buffer) (kill-buffer) (remove-hook 'yas-after-exit-snippet-hook '--save-exit))
(evil-ex-define-cmd "en[ew]" 'my:create-file)
(evil-define-command my:create-file (path &optional bang) (evil-define-command my:create-file (path &optional bang)
"Deploy files (and their associated templates) quickly. Will prompt "Deploy files (and their associated templates) quickly. Will prompt
you to fill in each snippet field before buffer closes unless BANG is you to fill in each snippet field before buffer closes unless BANG is
@ -297,7 +289,6 @@ provided."
(if bang (--save-exit))) (if bang (--save-exit)))
(error "Directory doesn't exist: %s" dir)))) (error "Directory doesn't exist: %s" dir))))
(evil-ex-define-cmd "ren[ame]" 'my:rename-this-file) ; Rename file . Bang: Delete old one
(evil-define-command my:rename-this-file (new-name &optional bang) (evil-define-command my:rename-this-file (new-name &optional bang)
"Renames current buffer and file it is visiting. Replaces %, # and other "Renames current buffer and file it is visiting. Replaces %, # and other
variables (see `evil-ex-replace-special-filenames')" variables (see `evil-ex-replace-special-filenames')"
@ -323,7 +314,6 @@ provided."
(message "File '%s' successfully renamed to '%s'" (message "File '%s' successfully renamed to '%s'"
name (file-name-nondirectory new-name))))))) name (file-name-nondirectory new-name)))))))
(evil-ex-define-cmd "x" 'my:scratch-buffer)
(evil-define-operator my:scratch-buffer (beg end &optional bang) (evil-define-operator my:scratch-buffer (beg end &optional bang)
"Send a selection to the scratch buffer. If BANG, then send it to org-capture "Send a selection to the scratch buffer. If BANG, then send it to org-capture
instead." instead."
@ -349,7 +339,6 @@ provided."
(if text (insert text)) (if text (insert text))
(funcall mode)))))) (funcall mode))))))
(evil-ex-define-cmd "al[ign]" 'my:align)
(evil-define-command my:align (beg end &optional regexp bang) (evil-define-command my:align (beg end &optional regexp bang)
:repeat nil :repeat nil
(interactive "<r><a><!>") (interactive "<r><a><!>")
@ -357,7 +346,6 @@ provided."
(align-regexp beg end (align-regexp beg end
(concat "\\(\\s-*\\)" (rxt-pcre-to-elisp regexp)) 1 1))) (concat "\\(\\s-*\\)" (rxt-pcre-to-elisp regexp)) 1 1)))
(evil-ex-define-cmd "retab" 'my:retab)
(evil-define-operator my:retab (beg end) (evil-define-operator my:retab (beg end)
"Akin to vim's :retab, this changes all tabs-to-spaces or spaces-to-tabs, "Akin to vim's :retab, this changes all tabs-to-spaces or spaces-to-tabs,
depending on `indent-tab-mode'. Untested." depending on `indent-tab-mode'. Untested."
@ -372,7 +360,6 @@ provided."
(tabify beg end) (tabify beg end)
(untabify beg end))) (untabify beg end)))
(evil-ex-define-cmd "sq[uint]" 'my:narrow-indirect) ; Narrow buffer to selection
(evil-define-operator my:narrow-indirect (beg end) (evil-define-operator my:narrow-indirect (beg end)
"Indirectly narrow the region from BEG to END." "Indirectly narrow the region from BEG to END."
:move-point nil :move-point nil

View file

@ -1,5 +1,4 @@
;; Mac-specific settings ;; Mac-specific settings
(provide 'core-osx)
;; Use a shared clipboard ;; Use a shared clipboard
(setq x-select-enable-clipboard t) (setq x-select-enable-clipboard t)
@ -8,8 +7,6 @@
;; Don't open files from the workspace in a new frame ;; Don't open files from the workspace in a new frame
(setq ns-pop-up-frames nil) (setq ns-pop-up-frames nil)
;; (setq ns-auto-hide-menu-bar t)
;; fix emacs PATH on OSX (GUI only) ;; fix emacs PATH on OSX (GUI only)
(use-package exec-path-from-shell (use-package exec-path-from-shell
:if (memq window-system '(mac ns)) :if (memq window-system '(mac ns))
@ -47,7 +44,5 @@
(defun my-send-dir-to-finder () (defun my-send-dir-to-finder ()
(interactive) (my--open-file-with default-directory "Finder")) (interactive) (my--open-file-with default-directory "Finder"))
(defun my-osx-psuedo-fullscreen ()
(interactive) (provide 'core-osx)
(set-frame-position nil 0 0)
(set-frame-size nil 362 112))

View file

@ -1,10 +1,14 @@
(cd "~") ; instead of / (defconst is-mac (eq system-type 'darwin))
(defconst is-linux (eq system-type 'gnu/linux))
(when is-linux (add-to-list 'load-path "~/.cask"))
(require 'cask) (require 'cask)
(cask-initialize) (cask-initialize)
(defconst is-mac (eq system-type 'darwin)) (cd "~") ; instead of /
(defconst is-linux (eq system-type 'gnu/linux))
(require 'use-package) ; Package management bootstrap
(setq use-package-verbose DEBUG-MODE)
;; Make sure undo/backup folders exist ;; Make sure undo/backup folders exist
(defconst my-tmp-dir-undo (expand-file-name "undo" my-tmp-dir)) (defconst my-tmp-dir-undo (expand-file-name "undo" my-tmp-dir))
@ -42,7 +46,7 @@
(set-selection-coding-system 'utf-8) ; please (set-selection-coding-system 'utf-8) ; please
(prefer-coding-system 'utf-8) ; with sugar on top (prefer-coding-system 'utf-8) ; with sugar on top
(fset 'yes-or-no-p 'y-or-n-p) ; y/n instead of yes/no (fset 'yes-or-no-p 'y-or-n-p) ; y/n instead of yes/no
;;; Show tab characters ;;; Show tab characters
;; (global-whitespace-mode 1) ;; (global-whitespace-mode 1)
@ -114,24 +118,28 @@
(setq-default undo-tree-history-directory-alist `(("." . ,my-tmp-dir-undo))) (setq-default undo-tree-history-directory-alist `(("." . ,my-tmp-dir-undo)))
;;;; Save history across sessions ;;;; Save history across sessions
(setq savehist-additional-variables '(search ring regexp-search-ring)) (setq savehist-additional-variables '(search ring regexp-search-ring))
(setq savehist-file (f-expand "savehist" my-tmp-dir)) ; keep the home clean (setq savehist-file (concat my-tmp-dir "savehist")) ; keep the home clean
(savehist-mode 1) (savehist-mode 1)
;; Save cursor location across sessions ;; Save cursor location across sessions
(require 'saveplace) (use-package saveplace
(setq save-place-file (f-expand "saveplace" my-tmp-dir)) :init
(add-hook 'find-file-hook ; activate save-place for files that exist (add-hook 'find-file-hook ; activate save-place for files that exist
(lambda() (lambda()
(if (file-exists-p buffer-file-name) (if (file-exists-p buffer-file-name)
(setq save-place t)))) (setq save-place t))))
:config
(setq save-place-file (concat my-tmp-dir "saveplace")))
(require 'recentf) (use-package recentf
(setq recentf-max-menu-items 0) :config
(setq recentf-max-saved-items 1000) (progn
(setq recentf-auto-cleanup 'never) (setq recentf-max-menu-items 0)
(setq recentf-save-file (concat my-tmp-dir "recentf")) (setq recentf-max-saved-items 1000)
(setq recentf-exclude '("/tmp/" "/ssh:" "\\.?ido\\.last\\'" "\\.revive\\'", "/TAGS\\'")) (setq recentf-auto-cleanup 'never)
(recentf-mode 1) (setq recentf-save-file (concat my-tmp-dir "recentf"))
(setq recentf-exclude '("/tmp/" "/ssh:" "\\.?ido\\.last\\'" "\\.revive\\'", "/TAGS\\'"))
(recentf-mode 1)))
;; What we do every night, Pinkie... ;; What we do every night, Pinkie...
(defun display-startup-echo-area-message () (defun display-startup-echo-area-message ()
@ -144,19 +152,21 @@
(setq-default tab-always-indent nil) (setq-default tab-always-indent nil)
(setq-default tab-width 4) (setq-default tab-width 4)
(setq require-final-newline t)
(setq delete-trailing-lines nil) (setq delete-trailing-lines nil)
(add-hook 'makefile-mode-hook 'indent-tabs-mode) ; Use normal tabs in makefiles (add-hook 'makefile-mode-hook 'indent-tabs-mode) ; Use normal tabs in makefiles
;; Make sure scratch buffer is always "in a project" ;; Make sure scratch buffer is always "in a project"
(add-hook 'find-file-hook (add-hook 'find-file-hook
(lambda() (lambda()
(let ((buffer (get-buffer "*scratch*")) (let ((buffer (get-buffer "*scratch*"))
(pwd (my--project-root))) (pwd (my--project-root)))
(when (buffer-live-p buffer) (when (buffer-live-p buffer)
(save-window-excursion (save-window-excursion
(switch-to-buffer buffer) (switch-to-buffer buffer)
(unless (eq (my--project-root) pwd) (unless (eq (my--project-root) pwd)
(cd pwd) (cd pwd)
(rename-buffer (format "*scratch* (%s)" (file-name-base (directory-file-name pwd)))))))))) (rename-buffer (format "*scratch* (%s)" (file-name-base (directory-file-name pwd))))))))))
;; My own minor mode! ;; My own minor mode!
(define-minor-mode my-mode :global t :keymap (make-sparse-keymap)) (define-minor-mode my-mode :global t :keymap (make-sparse-keymap))
@ -186,52 +196,9 @@
ad-do-it)) ad-do-it))
;;;; Automatic minor modes ;;;;;;;;;;;;;;;
(defvar auto-minor-mode-alist ()
"Alist of filename patterns vs correpsonding minor mode functions,
see `auto-mode-alist' All elements of this alist are checked, meaning
you can enable multiple minor modes for the same regexp.")
(defun enable-minor-mode-based-on-extension ()
"check file name against auto-minor-mode-alist to enable minor modes
the checking happens for all pairs in auto-minor-mode-alist"
(when buffer-file-name
(let ((name buffer-file-name)
(remote-id (file-remote-p buffer-file-name))
(alist auto-minor-mode-alist))
;; Remove backup-suffixes from file name.
(setq name (file-name-sans-versions name))
;; Remove remote file name identification.
(when (and (stringp remote-id)
(string-match-p (regexp-quote remote-id) name))
(setq name (substring name (match-end 0))))
(while (and alist (caar alist) (cdar alist))
(if (string-match (caar alist) name)
(funcall (cdar alist) 1))
(setq alist (cdr alist))))))
(add-hook 'find-file-hook 'enable-minor-mode-based-on-extension)
;;;; Utility plugins ;;;;;;;;;;;;;;;;;; ;;;; Utility plugins ;;;;;;;;;;;;;;;;;;
(require 'defuns) ; all the defuns (require 'defuns)
(require 'use-package) ; Package management bootstrap (require 'autoloads) ; use make autoloads to generate autoloads file
(setq use-package-verbose DEBUG-MODE)
;;(require 'hide-mode-line)
;; Generate autoloads if necessary
(defun my-update-autoloads (&optional forcep)
(interactive)
(setq generated-autoload-file (concat my-core-dir "autoloads.el"))
(when (or forcep (not (file-exists-p generated-autoload-file)))
(if forcep (delete-file generated-autoload-file))
(update-directory-autoloads my-core-dir my-modules-dir my-elisp-dir))
(require 'autoloads))
(my-update-autoloads)
;; Add elisp dirs to load-path
(let ((default-directory my-elisp-dir))
(normal-top-level-add-to-load-path '("."))
(normal-top-level-add-subdirs-to-load-path))
(use-package smex (use-package smex
:commands (smex smex-major-mode-commands) :commands (smex smex-major-mode-commands)
@ -271,13 +238,16 @@ the checking happens for all pairs in auto-minor-mode-alist"
;;;; Start the party ;;;;;;;;;;;;;;;;;;; ;;;; Start the party ;;;;;;;;;;;;;;;;;;;
(if is-mac (require 'core-osx)) (if is-mac (require 'core-osx))
;; (if is-linux (require 'core-linux))
(require 'core-ui) (require 'core-ui)
(require 'core-evil) (require 'core-evil)
(require 'core-editor) (require 'core-editor)
(require 'server) (use-package server
(unless (server-running-p) :config
(server-start))) (unless (server-running-p)
(server-start))))
(provide 'core) (provide 'core)

View file

@ -12,14 +12,6 @@
(defmacro f--exists? (file dir) (defmacro f--exists? (file dir)
`(f-exists? (expand-file-name ,file ,dir)))) `(f-exists? (expand-file-name ,file ,dir))))
;;;###autoload
(after "projectile"
(defun my--project-root (&optional force-pwd)
(if (and (not force-pwd)
(projectile-project-p))
(projectile-project-root)
default-directory)))
;; Misc Defuns ;;;;;;;;;;;;;;;;;;;;;;;;; ;; Misc Defuns ;;;;;;;;;;;;;;;;;;;;;;;;;
;;;###autoload ;;;###autoload
(defun what-face (pos) (defun what-face (pos)

View file

@ -1,5 +1,3 @@
(provide 'defuns)
;; Convenience ;;;;;;;;;;;;;;;;;;;;; ;; Convenience ;;;;;;;;;;;;;;;;;;;;;
(defun associate-mode (match mode) (defun associate-mode (match mode)
(add-to-list 'auto-mode-alist (cons match mode))) (add-to-list 'auto-mode-alist (cons match mode)))
@ -7,6 +5,30 @@
(defun associate-minor-mode (match mode) (defun associate-minor-mode (match mode)
(add-to-list 'auto-minor-mode-alist (cons match mode))) (add-to-list 'auto-minor-mode-alist (cons match mode)))
;; Automatic minor modes ;;;;;;;;;;;
(defvar auto-minor-mode-alist ()
"Alist of filename patterns vs correpsonding minor mode functions,
see `auto-mode-alist' All elements of this alist are checked, meaning
you can enable multiple minor modes for the same regexp.")
(defun enable-minor-mode-based-on-extension ()
"check file name against auto-minor-mode-alist to enable minor modes
the checking happens for all pairs in auto-minor-mode-alist"
(when buffer-file-name
(let ((name buffer-file-name)
(remote-id (file-remote-p buffer-file-name))
(alist auto-minor-mode-alist))
;; Remove backup-suffixes from file name.
(setq name (file-name-sans-versions name))
;; Remove remote file name identification.
(when (and (stringp remote-id)
(string-match-p (regexp-quote remote-id) name))
(setq name (substring name (match-end 0))))
(while (and alist (caar alist) (cdar alist))
(if (string-match (caar alist) name)
(funcall (cdar alist) 1))
(setq alist (cdr alist))))))
(add-hook 'find-file-hook 'enable-minor-mode-based-on-extension)
(defmacro λ (&rest body) (defmacro λ (&rest body)
`(lambda () (interactive) ,@body)) `(lambda () (interactive) ,@body))
@ -30,6 +52,13 @@
'with-no-warnings) 'with-no-warnings)
(with-eval-after-load ',feature ,@forms))) (with-eval-after-load ',feature ,@forms)))
(after "projectile"
(defun my--project-root (&optional force-pwd)
(if (and (not force-pwd)
(projectile-project-p))
(projectile-project-root)
default-directory)))
;; Keybindings ;;;;;;;;;;;;;;;;;;;;;;;;; ;; Keybindings ;;;;;;;;;;;;;;;;;;;;;;;;;
(defun bind (state &rest keys) (defun bind (state &rest keys)
@ -108,3 +137,6 @@ to abort the minibuffer."
(when (get-buffer "*Completions*") (when (get-buffer "*Completions*")
(delete-windows-on "*Completions*")) (delete-windows-on "*Completions*"))
(abort-recursive-edit))) (abort-recursive-edit)))
(provide 'defuns)

90
init.el
View file

@ -38,54 +38,56 @@
(add-to-list 'load-path my-core-dir) (add-to-list 'load-path my-core-dir)
(add-to-list 'load-path my-modules-dir) (add-to-list 'load-path my-modules-dir)
(add-to-list 'load-path my-elisp-dir)
;; Add elisp dirs to load-path
(let ((default-directory my-elisp-dir))
(normal-top-level-add-subdirs-to-load-path))
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;; Just the... bear necessities... ;; Just the... bear necessities...
(defconst my-modules (mapc 'require
;; ls -1 init/{init,my}* | xargs basename | sed -e 's/\..*$//' ;; ls init/{init,my}* | xargs basename | sed -e 's/\..*$//'
'(core '(core
;; init-auto-complete ;; init-auto-complete
init-auto-insert ; for the lazy typis init-auto-insert ; for the lazy typis
init-company ; see above init-company ; see above
init-cc ; C/C++/Obj-C madness init-cc ; C/C++/Obj-C madness
;; init-d ; D - It's C, but better! ;; init-d ; D - It's C, but better!
;; init-cscope ;; init-cscope
;; init-csharp init-csharp
init-dev ; general dev tools/settings init-dev ; general dev tools/settings
init-elisp ; emacs lisp init-lisp ; all things lisp; elisp, clojure
;; init-eshell ;; init-erlang
init-floobits ; when I'm feeling lonely ;; init-eshell
init-fly ; fly(check|spell) ;; init-floobits ; when I'm feeling lonely
init-git ; git-gutter + modes init-fly ; fly(check|spell)
;; init-go init-git ; git-gutter + modes
init-helm ; when you forget where you put your constellation ;; init-go
init-ido ; when you forget where you put your keys init-helm ; when you forget where you put your constellation
init-java ; the mascot language of carpal tunnel syndome init-ido ; when you forget where you put your keys
init-js ; alert("Oh, sure dude, I know java") init-java ; the poster child for carpal tunnel syndome
init-lua ; zero-based indices? Zero-based indices. init-js ; alert("not java, javascript!")
init-org ; for fearless leader (who is organized) init-lua ; zero-based indices? Zero-based indices.
init-php ; making php less painful to work with ;; init-org ; for fearless leader (who is organized)
init-project ; project tools - dired, perspective, neotree init-php ; making php less painful to work with
init-projectile ; when you forget where you put your house init-project ; project tools - dired, perspective, neotree
init-python ; beautiful is better than ugly init-projectile ; when you forget where you put your house
init-regex ; /^[^\s](meaning)[^\n]*life/ init-python ; beautiful is better than ugly
init-ruby ; I frakking love ruby init-regex ; /^[^\s](meaning)[^\n]*/
init-scss ; @include magic; init-ruby ; <3
init-sh ; #!/bin/bash_your_head_in init-scss ; @include magic;
init-swift ; ever wanted to name a variable an emoticon? init-sh ; #!/bin/bash_your_head_in
init-text ; I got nothing... init-swift ; yay, emoji variables!
init-tmux init-text ; I got nothing...
;; init-rust init-tmux
init-web ;; init-rust
init-yasnippet ; type for me init-web
init-yasnippet ; type for me
my-bindings my-bindings
my-settings my-settings
)) ))
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;; Load them in
(setq after-init-hook '((lambda() (mapc 'require my-modules))))
;; I've created a monster! ;; I've created a monster!

View file

@ -1,12 +1,12 @@
;; Elisp ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
(defun remove-elc-on-save () (defun remove-elc-on-save ()
"If you're saving an elisp file, likely the .elc is no longer valid." "If you're saving an elisp file, likely the .elc is no longer valid."
(make-local-variable 'after-save-hook) (make-local-variable 'after-save-hook)
(add-hook 'after-save-hook (add-hook! 'after-save-hook
(lambda () (if (file-exists-p (concat buffer-file-name "c"))
(if (file-exists-p (concat buffer-file-name "c")) (delete-file (concat buffer-file-name "c")))))
(delete-file (concat buffer-file-name "c"))))))
(add-hook 'after-save-hook 'remove-elc-on-save) (add-hook 'emacs-lisp-mode-hook 'remove-elc-on-save)
(add-hook 'emacs-lisp-mode-hook 'turn-on-eldoc-mode) (add-hook 'emacs-lisp-mode-hook 'turn-on-eldoc-mode)
(evil-define-operator my:elisp-eval (beg end) (evil-define-operator my:elisp-eval (beg end)
@ -28,6 +28,9 @@
(bind 'motion emacs-lisp-mode-map "g r" 'my:elisp-eval) (bind 'motion emacs-lisp-mode-map "g r" 'my:elisp-eval)
;; TODO Add clojure support
;; TODO Add scheme support
(provide 'init-elisp)
(provide 'init-lisp)
;;; init-elisp.el ends here ;;; init-elisp.el ends here