Reorganize loading code

This commit is contained in:
Tom Willemse 2018-07-20 00:24:41 -07:00
parent 841801059f
commit ee0acc36ff
2 changed files with 25 additions and 37 deletions

View file

@ -3,7 +3,7 @@ EMACS := emacs
.SECONDARY: .SECONDARY:
AUTOLOADS_FILE := site-lisp/site-autoloads.el AUTOLOADS_FILE := site-lisp/oni-site-autoloads.el
UNWANTED := $(AUTOLOADS_FILE) site-lisp/flycheck_% site-lisp/flycheck-% UNWANTED := $(AUTOLOADS_FILE) site-lisp/flycheck_% site-lisp/flycheck-%
SITE_LISPS := $(filter-out $(UNWANTED),$(wildcard site-lisp/*.el)) SITE_LISPS := $(filter-out $(UNWANTED),$(wildcard site-lisp/*.el))
COMPILED_SITE_LISPS := $(addsuffix c,$(SITE_LISPS)) COMPILED_SITE_LISPS := $(addsuffix c,$(SITE_LISPS))

View file

@ -25,27 +25,23 @@
;;; Code: ;;; Code:
;;;; Load path and autoloads
(eval-and-compile (eval-and-compile
(let ((load-directory (let ((load-directory
(file-name-directory (file-name-directory
(or load-file-name byte-compile-current-file)))) (or load-file-name byte-compile-current-file))))
(add-to-list 'load-path (format "%sinit/" load-directory)) (add-to-list 'load-path (format "%sinit/" load-directory))
(mapc (lambda (d) (add-to-list 'load-path d))
(directory-files
(format "%svendor-lisp/" load-directory) t "^[^.]"))
(add-to-list 'load-path (format "%ssite-lisp/" load-directory)) (add-to-list 'load-path (format "%ssite-lisp/" load-directory))
(add-to-list 'load-path (format "%sos-lisp/" load-directory)) (add-to-list 'load-path (format "%sos-lisp/" load-directory))
(let ((loaddefs (format "%ssite-lisp/site-autoloads.el" load-directory))) (mapc (lambda (d) (add-to-list 'load-path d))
(when (file-exists-p loaddefs) (directory-files
(load loaddefs))) (format "%svendor-lisp/" load-directory) t "^[^.]"))))
(if (eq system-type 'windows-nt) (load "oni-site-autoloads" :noerror :nomessage)
(require 'oni-windows-nt))))
(require 'oni-helpers) ;;;; Package
(require 'package) (require 'package)
@ -57,21 +53,22 @@
(eval-and-compile (package-initialize)) (eval-and-compile (package-initialize))
(eval-when-compile
(let* ((not-installed (seq-remove 'package-installed-p
package-selected-packages))
(available (seq-filter (lambda (p)
(assq p package-archive-contents))
not-installed))
(difference (- (length not-installed) (length available))))
(when (> difference 0)
(silently "Refresh packages"
(package-refresh-contents)))
(when available
(mapc (lambda (p) (package-install p t)) available))))
(add-hook 'package-menu-mode-hook 'hl-line-mode) (add-hook 'package-menu-mode-hook 'hl-line-mode)
;;;; Dependencies
(require 'counsel)
(require 'destroy-trailing-whitespace)
(require 'diff-hl)
(require 'diminish)
(require 'ivy)
(require 'ivy-hydra)
(require 'oni-helpers)
(require 'projectile)
(require 'shackle)
;;;; Settings
(setq backup-directory-alist (setq backup-directory-alist
`((".*" . ,(oni:data-location "backup-files/")))) `((".*" . ,(oni:data-location "backup-files/"))))
@ -95,7 +92,6 @@
(global-set-key (kbd "C-x f") 'ffap) (global-set-key (kbd "C-x f") 'ffap)
(global-set-key (kbd "C-x C-b") 'ibuffer) (global-set-key (kbd "C-x C-b") 'ibuffer)
(require 'destroy-trailing-whitespace)
(global-destroy-trailing-whitespace-mode) (global-destroy-trailing-whitespace-mode)
(setq require-final-newline t) (setq require-final-newline t)
@ -133,17 +129,10 @@
(concat user-emacs-directory "vendor-lisp/yoshi-theme")) (concat user-emacs-directory "vendor-lisp/yoshi-theme"))
(load-theme 'yoshi :no-confirm) (load-theme 'yoshi :no-confirm)
(require 'diminish)
(require 'ivy)
(require 'ivy-hydra)
(diminish 'ivy-mode) (diminish 'ivy-mode)
(ivy-mode) (ivy-mode)
(require 'counsel)
(setq counsel-find-file-ignore-regexp (setq counsel-find-file-ignore-regexp
(rx (or (and bos ".") (rx (or (and bos ".")
(and ".zwc" eos)))) (and ".zwc" eos))))
@ -165,7 +154,6 @@
(add-hook 'minibuffer-setup-hook 'electric-pair-local-mode) (add-hook 'minibuffer-setup-hook 'electric-pair-local-mode)
(require 'shackle)
(shackle-mode) (shackle-mode)
(with-eval-after-load 'shr (load "oni-shr-init")) (with-eval-after-load 'shr (load "oni-shr-init"))
@ -197,7 +185,6 @@
;; (propertize (concat " " (char-to-string #xf149)) ;; (propertize (concat " " (char-to-string #xf149))
;; 'face '(:family "Font Awesome" :height 0.75))) ;; 'face '(:family "Font Awesome" :height 0.75)))
(require 'diff-hl)
(global-diff-hl-mode) (global-diff-hl-mode)
(blink-cursor-mode -1) (blink-cursor-mode -1)
@ -219,8 +206,6 @@ ORIG-FUN is the function being wrapped, ARGS are the arguments specified"
(setq projectile-known-projects-file (setq projectile-known-projects-file
(oni:data-location "projectile-bookmarks.eld")) (oni:data-location "projectile-bookmarks.eld"))
(require 'projectile)
(with-eval-after-load 'projectile (with-eval-after-load 'projectile
(setq projectile-mode-line (setq projectile-mode-line
'(:eval '(:eval
@ -365,6 +350,9 @@ ORIG-FUN is the function being wrapped, ARGS are the arguments specified"
(add-to-list 'grep-files-aliases '("css" . "*.css *.less *.sass *.scss")) (add-to-list 'grep-files-aliases '("css" . "*.css *.less *.sass *.scss"))
(add-to-list 'grep-files-aliases '("php" . "*.php *.inc *.module")) (add-to-list 'grep-files-aliases '("php" . "*.php *.inc *.module"))
(if (eq system-type 'windows-nt)
(require 'oni-windows-nt))
(setq custom-file (concat user-emacs-directory "custom.el")) (setq custom-file (concat user-emacs-directory "custom.el"))
(load custom-file t) (load custom-file t)