init-packages.el -> bootstrap + remove init-org.el

This commit is contained in:
Henrik Lissner 2016-01-29 02:04:27 -05:00
parent a3f4e5c545
commit ab937bf013
4 changed files with 142 additions and 195 deletions

81
bootstrap.el Normal file
View file

@ -0,0 +1,81 @@
;;; bootstrap.el
(defconst narf-emacs-dir user-emacs-directory)
(defconst narf-core-dir (concat narf-emacs-dir "core/"))
(defconst narf-modules-dir (concat narf-emacs-dir "modules/"))
(defconst narf-private-dir (concat narf-emacs-dir "private/"))
(defconst narf-packages-dir (concat narf-emacs-dir ".cask/" emacs-version "/elpa/"))
(defconst narf-script-dir (concat narf-emacs-dir "scripts/"))
(defconst narf-snippet-dirs (list (concat narf-private-dir "snippets/")
(concat narf-private-dir "templates/")))
;; Hostname and emacs version-based elisp temp directories
(defconst narf-temp-dir
(format "%scache/%s/%s.%s/"
narf-private-dir (system-name)
emacs-major-version emacs-minor-version))
(defconst IS-MAC (eq system-type 'darwin))
(defconst IS-LINUX (eq system-type 'gnu/linux))
(defconst IS-WINDOWS (eq system-type 'windows-nt))
;; Global settings
(scroll-bar-mode -1) ; no scrollbar
(tool-bar-mode -1) ; no toolbar
(setq-default
;; stop package.el from being annoying. NARF relies entirely on Cask.
package--init-file-ensured t
package-enable-at-startup nil
gc-cons-threshold 4388608
gc-cons-percentage 0.3)
(eval-when-compile
;; Make sure that cask is in the right place
(unless (eq 0 (call-process "which" nil nil nil "cask"))
(error "Cask could not be found"))
(let ((cask-dir (cond (IS-MAC "/usr/local/Cellar/cask/HEAD")
(t "~/.cask"))))
(unless (file-exists-p cask-dir)
(error "Cask folder not found"))
(add-to-list 'load-path cask-dir))
;; Helper for traversing subdirectories recursively
(defun --subdirs (path &optional include-self)
(let ((result (if include-self (list path) (list)))
(paths (ignore-errors (directory-files path t "^[^.]" t))))
(dolist (file paths)
(when (file-directory-p file)
(push file result)))
result)))
;; Scan various folders to populate the load-paths
(setq custom-theme-load-path
(eval-when-compile
(append (--subdirs (concat narf-private-dir "themes/"))
custom-theme-load-path)))
(setq load-path
(eval-when-compile
(require 'cask)
(cask-initialize)
(setq load-path (append (list narf-private-dir)
(--subdirs narf-core-dir t)
(--subdirs narf-modules-dir t)
(--subdirs narf-packages-dir)
load-path))))
(defun narf (packages)
"Bootstrap NARF emacs and initialize PACKAGES"
;; prematurely optimize for faster startup
(let (file-name-handler-alist
(gc-cons-threshold 169715200))
;; Load local settings, if available
(when (file-exists-p "~/.emacs.local.el")
(load "~/.emacs.local.el"))
(load-theme narf-theme t)
(setq narf-current-theme narf-theme)
(mapc 'require packages)))
;;; bootstrap.el ends here

View file

@ -1,53 +0,0 @@
;;; init-org.el --- inits Emacs for Org-mode and writing
;;
;; This orgfile is sourced instead of init.el for instances of Emacs dedicated for
;; writing fiction, papers, or simply org-mode. I prefer to keep this functionality
;; separate from stock Emacs.
;;
;;;
(defconst EMACS-WRITE t)
(defconst narf-theme 'narf-light)
(defconst narf-default-font (font-spec :family "Hack" :size 14))
(defconst narf-writing-font (font-spec :family "Deja Sans" :size 14))
(defconst narf-packages
'(core ; core/core.el
core-popup ; taming stray windows
core-ui ; draw me like one of your French editors
core-evil ; come to the dark side, we have cookies
core-editor ; filling the editor-shaped hole in the emacs OS
core-company ; for the lazy typist
core-yasnippet ; for the lazier typist
core-auto-insert ; for the laziest typist
core-flycheck ; remember that semicolon you forgot?
core-project ; whose project am I in?
core-vcs ; version control is a programmer's best friend
core-helm ; a search engine for life and love
core-eval ; run code, run.
core-workgroups ; cure Emacs alzheimers
;;; Environments
module-markdown
module-org
module-plantuml
;;; Specific custom functionality
;; lib-plugin ; plugin dev for various programs
lib-tmux ; closing the rift between GUI & terminal
lib-demo ; let me demonstrate...
lib-writing ; yes, I write papers and fiction in emacs
;; lib-crm ; emacs and org-mode based CRM
;;; Key bindings & ex commands
my-bindings
my-commands
))
(load (concat user-emacs-directory "init-packages.el"))
(setq wg-session-file (expand-file-name "wg-org-default" narf-temp-dir))
(cd org-directory)

View file

@ -1,84 +0,0 @@
;;; init-packages.el
(setq-default
;; stop package.el from being annoying. NARF relies entirely on Cask.
package--init-file-ensured t
package-enable-at-startup nil
gc-cons-threshold 8388608
gc-cons-percentage 0.3)
(eval-and-compile
(defconst narf-emacs-dir user-emacs-directory)
(defconst narf-core-dir (concat narf-emacs-dir "core/"))
(defconst narf-modules-dir (concat narf-emacs-dir "modules/"))
(defconst narf-contrib-dir (concat narf-emacs-dir "contrib/"))
(defconst narf-private-dir (concat narf-emacs-dir "private/"))
(defconst narf-packages-dir (concat narf-emacs-dir ".cask/" emacs-version "/elpa/"))
(defconst narf-script-dir (concat narf-emacs-dir "scripts/"))
(defconst narf-dropbox-dir "~/Dropbox/")
(defconst narf-snippet-dirs (list (concat narf-private-dir "snippets/")
(concat narf-private-dir "templates/")))
(defconst narf-temp-dir
(format "%scache/%s/%s.%s/"
narf-private-dir (system-name)
emacs-major-version emacs-minor-version))
(defconst IS-MAC (eq system-type 'darwin))
(defconst IS-LINUX (eq system-type 'gnu/linux))
(defconst IS-WINDOWS (eq system-type 'windows-nt)))
;;;;;;;;;;;;;;;;
(eval-when-compile
(add-to-list 'load-path "/usr/local/Cellar/cask/HEAD")
(defun --subdirs (path)
(let ((result '())
(paths (ignore-errors (directory-files path t "^[^.]" t))))
(dolist (file paths)
(when (file-directory-p file)
(add-to-list 'result file)))
result)))
;; Scan various folders to populate the load-dirs
(setq custom-theme-load-path
(eval-when-compile
(append (--subdirs (concat narf-private-dir "themes/"))
custom-theme-load-path)))
(setq load-path
(eval-when-compile
(require 'cask)
(cask-initialize)
(setq load-path (append (list narf-core-dir narf-contrib-dir narf-modules-dir narf-private-dir)
(list (concat narf-core-dir "lib"))
(list (concat narf-modules-dir "lib"))
(--subdirs narf-contrib-dir)
(--subdirs narf-packages-dir)
load-path))))
;; Load local settings, if available
(when (file-exists-p "~/.emacs.local.el")
(load "~/.emacs.local.el"))
;; prematurely optimize for faster startup
(let (file-name-handler-alist
(gc-cons-threshold 169715200))
(scroll-bar-mode -1) ; no scrollbar
(tool-bar-mode -1) ; no toolbar
(load-theme narf-theme t)
(mapc 'require narf-packages))
(defadvice save-buffers-kill-emacs (around no-query-kill-emacs activate)
"Prevent annoying \"Active processes exist\" query when you quit Emacs."
(cl-flet ((process-list ())) ad-do-it))
(defun display-startup-echo-area-message ()
(after! workgroups2
(message "%sLoaded in %s" (narf/tab-display t t) (emacs-init-time))))
(require 'server)
(unless (server-running-p)
(server-start))
;;; init-packages.el ends here

119
init.el
View file

@ -40,71 +40,74 @@
;; ;;
;;; License: GPLv3 ;;; License: GPLv3
(defconst EMACS-WRITE nil) (defconst narf-theme 'narf-dark)
(defconst narf-default-font (font-spec :family "Terminus (TTF)" :size 12 :antialias nil))
(defconst narf-big-font (font-spec :family "Inconsolata" :size 20))
(defconst narf-theme 'narf-dark) ;; Write-mode settings
(defconst narf-default-font (font-spec :family "Terminus (TTF)" :size 12 :antialias nil)) (defvar write-mode-theme 'narf-write)
(defconst narf-writing-font (font-spec :family "Hack" :size 14)) (defvar write-mode-font (font-spec :family "Hack" :size 12))
(defconst narf-big-font (font-spec :family "Inconsolata" :size 20)) (defvar write-mode-dir "~/Dropbox/notes")
(defvar write-mode-biblio-dir "~/Dropbox/docs/biblio")
(defconst narf-packages ;;
'(core ; core/core.el (load (concat user-emacs-directory "bootstrap.el"))
;;
;;; The heart of NARF (narf '(core ; core/core.el
core-popup ; taming stray windows
core-ui ; draw me like one of your French editors
core-evil ; come to the dark side, we have cookies
core-editor ; filling the editor-shaped hole in the emacs OS
core-company ; for the lazy typist
core-yasnippet ; for the lazier typist
core-auto-insert ; for the laziest typist
core-flycheck ; remember that semicolon you forgot?
core-project ; whose project am I in?
core-vcs ; version control is a programmer's best friend
core-helm ; a search engine for life and love
core-eval ; run code, run.
core-workgroups ; cure Emacs alzheimers + tab emulation
;;; Environments ;; The heart of NARF
module-cc ; c/c++/obj-c madness core-popup ; taming stray and sudden windows
module-csharp ; unity, .NET, and mono shenanigans core-ui ; draw me like one of your French editors
module-data ; dbs 'n data formats core-evil ; come to the dark side, we have cookies
module-go ; the hipster dialect core-editor ; filling the editor-shaped hole in the emacs OS
module-java ; the poster child for carpal tunnel syndome core-completion ; for the lazy typist
module-js ; all(hope(abandon(ye(who(enter(here)))))) core-yasnippet ; for the lazier typist
module-lisp ; drowning in parentheses core-file-templates ; for the laziest typist
module-lua ; one-based indices? one-based indices. core-flycheck ; code police; tazing you for every semicolon you forget
module-markdown ; markdown core-project ; whose project am I in?
;; module-org ; for fearless [organized] leader core-vcs ; remember remember, that commit in November
module-php ; making php less painful to work with core-helm ; a search engine for life and love
module-plantuml ; to help show others how right I am core-eval ; run code, run.
module-python ; beautiful is better than ugly core-sessions ; cure Emacs alzheimers + tab emulation
module-regex ; /^[^\s](meaning)[^\n]*/
module-ruby ; <3
module-rust ; Fe2O3; for gamedev and great good
module-sh ; she sells Z-shells by the C XOR
module-swift ; yay, emoji variables!
module-vim ; my mistress
module-web ; for the 2.0'er
;;; Experimental ;; Environments
;; module-crystal ; ruby at the speed of c module-apple ; Applescript, Swift, Launchbar, iOS
;; module-eshell ; for inferior OSes *cough*windows module-cc ; c/c++/obj-c madness
;; module-nim ; look out Abraham module-csharp ; unity, .NET, and mono shenanigans
;; module-pony ; Dear Princess Compiler module-go ; the hipster dialect
module-java ; the poster child for carpal tunnel syndome
module-js ; all(hope(abandon(ye(who(enter(here))))))
module-lisp ; drowning in parentheses
module-lua ; one-based indices? one-based indices.
module-markdown ; markdown
module-php ; making php less painful to work with
module-plantuml ; to help show others how right I am
module-python ; beautiful is better than ugly
module-regex ; /^[^\s](meaning)[^\n]*/
module-ruby ; <3
module-rust ; Fe2O3; for gamedev and great good
module-sh ; she sells Z-shells by the C XOR
module-tmux ; closing the rift between GUI & terminal
module-web ; for the 2.0'er
;;; Specific custom functionality ;; Experimental
lib-plugin ; plugin dev for various programs ;;module-crystal ; ruby at the speed of c
lib-tmux ; closing the rift between GUI & terminal ;;module-eshell ; for inferior OSes *cough*windows
lib-demo ; let me demonstrate... ;;module-nim ; look out Abraham
lib-writing ; yes, I write papers and fiction in emacs ;;module-pony ; Dear Princess Compiler
;; lib-crm ; emacs and org-mode based CRM
;;; Key bindings & ex commands ;; Organizational/Writing
my-bindings module-org ; for fearless [and organized] leader
my-commands module-crm ; emacs and org-mode based CRM
)) module-write ; making Emacs fit for writing fiction, papers & notes
(load (concat user-emacs-directory "init-packages.el")) ;; Extra Tools
module-demo ; let me demonstrate...
;; Key bindings & ex commands
my-bindings
my-commands
))
;;; I think so Brain... ;;; I think so Brain...