diff --git a/README.md b/README.md index e69de29bb..b1c63c6cd 100644 --- a/README.md +++ b/README.md @@ -0,0 +1,51 @@ +# NARF Emacs + +![Screenshot](screenshots/01.png) + +> What we do every night, Pinky... + +This is emacs for the stubborn vimmer, megalomaniac mouse and/or masochists +alike. It has been configured first: to emulate vim as best it can, and second: +to surpass it in any way possible; all this is built on top of +[Evil-mode](https://gitorious.org/evil/pages/Home), a vim emulator for emacs. + +This has only been tested on Emacs 24.5 on OSX. YMMV. + +Any contributions or suggestions are welcome. The world won't take over itself. + +## Installation + +`brew install cask` + +Narf uses [Cask](https://github.com/cask/cask) to manage plugins. + +Also, though not strictly a requirement, I recommend the railwaycat/emacsmacport +build of emacs for OSX, which you can get via homebrew: + +```sh +brew tap railwaycat/emacsmacport +brew install emacs-mac --HEAD --use-git-head --with-imagemagick --with-modern-icon +``` + +A recursive clone of this repo will get you all you need. + +``` +git clone --recursive https://github.com/hlissner/emacs.d ~/.emacs.d +cd ~/.emacs.d +make # installs plugins via cask and generates autoloads +make compile # optionally byte-compiles everything +``` + +## Features + +A summary of what to expect can be found in these three files: + +``` +./Cask # what packages are used (and where) +./init.el # lists all core files and modules loaded +./private/my-bindings.el # the keybindings +./private/my-commands.el # what custom ex commands are defined +``` + +## What about Windo- +![Windows, you say...](http://i3.kym-cdn.com/photos/images/newsfeed/000/549/293/504.gif) diff --git a/core/core.el b/core/core.el index fd56892fa..ad4a43cfc 100644 --- a/core/core.el +++ b/core/core.el @@ -2,55 +2,27 @@ ;; ;;; Naming conventions: ;; -;; narf-* A public variable/constant or function -;; narf--* A private variable or function (non-interactive) -;; narf/* An autoloaded interactive function -;; narf:* An ex command -;; narf|* A hook -;; @* Macro call +;; narf-... A public variable/constant or function +;; narf--... An internal variable or function (non-interactive) +;; narf/... An autoloaded interactive function +;; narf:... An ex command +;; narf|... A hook +;; narf*... An advising function +;; ...! Macro ;; ;;; Bootstrap: -(fset '! 'eval-when-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-elpa-dir (! (concat narf-emacs-dir ".cask/" emacs-version "/elpa/"))) -(defconst narf-temp-dir (concat narf-private-dir "cache/" (system-name) "/")) -(defconst narf-snippet-dirs (! (list (concat narf-private-dir "snippets/") - (concat narf-private-dir "templates/")))) - -(! (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 - (! (append (--subdirs (concat narf-private-dir "themes/")) - custom-theme-load-path))) -(setq load-path - (! (setq load-path (append (list narf-core-dir narf-contrib-dir narf-modules-dir narf-private-dir) - (list (concat narf-core-dir "defuns")) - load-path - (--subdirs narf-contrib-dir) - (--subdirs narf-contrib-dir))) - (require 'cask) - (cask-initialize) - load-path)) - -;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; - -;; (require 'benchmark) ; records load times in `require-times'; also see `list-times' -(require 'autoloads nil t) ; generate autoloads with `make autoloads` +(message "> Autoloads? %s" (if (require 'autoloads nil t) "Yes" "No")) (require 'core-vars) (require 'core-defuns) +(require 'diminish) + +;; NARF! +(define-minor-mode narf-mode "Narf, yoink, poit." + :global t + :init-value t + :lighter "NARF" + :keymap (make-sparse-keymap)) ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; @@ -58,8 +30,6 @@ (require 'dash) (require 'f) - (add-to-list 'load-path (concat narf-core-dir "macros/")) - (setq use-package-verbose narf-debug-mode) ;; (setq use-package-expand-minimally (not narf-debug-mode)) (require 'use-package) @@ -69,11 +39,20 @@ (-insert-at (-find-index (lambda (key) (eq key after)) use-package-keywords) keyword use-package-keywords))) + (progn ; remap :bind to bind! macro instead of bind-keys + ;; (defun use-package-handler/:bind + ;; (name-symbol keyword arg rest state &optional override) + ;; (let ((commands (mapcar #'cdr arg))) + ;; (use-package-concat + ;; (use-package-process-keywords name-symbol + ;; (use-package-sort-keywords + ;; (use-package-plist-maybe-put rest :defer t)) + ;; (use-package-plist-append state :commands commands)) + ;; `((ignore (,bind! ,@arg)))))) + ) + (progn ; add :after to use-package (use-package--add-keyword :after :load-path) - (setq use-package-keywords - (-insert-at (--find-index (eq it :load-path) use-package-keywords) - :after use-package-keywords)) (defalias 'use-package-normalize/:after 'use-package-normalize-symlist) @@ -83,30 +62,20 @@ body (use-package-concat (use-package-process-keywords name-symbol - (use-package-sort-keywords (use-package-plist-maybe-put rest :defer t)) state) + (use-package-sort-keywords (use-package-plist-maybe-put rest :defer t)) state) (apply #'nconc (mapcar (lambda (feature) - `(,(macroexpand `(@after ,feature (require ',name-symbol))))) + `(,(macroexpand `(after! ,feature (require ',name-symbol))))) (delete-dups arg)))))))) - (progn ; add :map for in-house key binding macro - (use-package--add-keyword :map :bind) - - (defalias 'use-package-normalize/:map 'use-package-normalize-forms) - - ;; TODO: Write :map - (defun use-package-handler/:map (name-symbol keyword arg rest state) - (use-package-process-keywords name-symbol rest state)) - ) - ) -(require 'diminish) + ;; Make any folders needed + (dolist (file '("" "undo" "backup")) + (let ((path (concat narf-temp-dir file))) + (unless (file-exists-p path) + (make-directory path t))))) ;; Emacs configuration ;;;;;;;;;;;;;;;;; -(defconst IS-MAC (eq system-type 'darwin)) -(defconst IS-LINUX (eq system-type 'gnu/linux)) -(defconst IS-WINDOWS (eq system-type 'windows-nt)) - ;;; UTF-8 please (setq locale-coding-system 'utf-8) ; pretty (set-terminal-coding-system 'utf-8) ; pretty @@ -168,16 +137,10 @@ undo-tree-auto-save-history t undo-tree-history-directory-alist `(("." . ,(! (concat narf-temp-dir "undo/"))))) -;; Make any folders needed -(! (dolist (file '("" "undo" "backup")) - (let ((path (concat narf-temp-dir file))) - (unless (file-exists-p path) - (make-directory path t))))) - ;; Save cursor location across sessions. Only save for files that exist. (require 'saveplace) (setq save-place-file (! (concat narf-temp-dir "saveplace"))) -(@add-hook find-file (if (file-exists-p (buffer-file-name)) (setq save-place t))) +(add-hook! find-file (if (file-exists-p (buffer-file-name)) (setq save-place t))) ;; Save history across sessions (require 'savehist) @@ -204,32 +167,7 @@ (use-package popwin :config (popwin-mode 1)) -;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; - -(cond (IS-MAC (require 'core-os-osx)) - (IS-LINUX (require 'core-os-linux)) - (IS-WINDOWS (require 'core-os-win32))) - -(require 'core-ui) -(require 'core-evil) -;; (require 'core-editor) -;; (require 'core-completion) -;; (require 'core-syntax-checker) -;; (require 'core-snippets) -;; (require 'core-templates) -;; (require 'core-project) -;; (require 'core-vcs) -;; (require 'core-sessions) -;; (require 'core-quickrun) - -;; (@add-hook after-init -;; (use-package my-bindings) -;; (use-package my-commands)) - -;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; - (use-package server :config (unless (server-running-p) (server-start))) - (provide 'core) ;;; core.el ends here