Use subdirectories for setup files (+READMEs)

Move setup files into subdirectories. Move mode directories to modes subdir.
This will make it easy to specify a recipe in melpa that maintains the directory
structure. Add interactive functions to jump to .el and README files

See #170
This commit is contained in:
Justin Burkett 2018-07-12 15:05:50 -04:00 committed by James N
parent 34d515e99e
commit 95dad4c734
101 changed files with 44 additions and 3 deletions

View File

@ -3,8 +3,9 @@ EMACS ?= emacs
compile:
cask exec $(EMACS) -Q -batch \
-L . \
--eval '(setq evil-want-integration nil)' \
--eval '(setq byte-compile-error-on-warn t)' \
-f batch-byte-compile *.el
-f batch-byte-compile *.el modes/*/*.el
lint:
cask exec $(EMACS) -Q -batch \
@ -14,7 +15,7 @@ lint:
--eval "(package-refresh-contents)" \
-l package-lint.el \
--eval "(advice-add 'package-lint--check-eval-after-load :around 'ignore)" \
-f package-lint-batch-and-exit *.el
-f package-lint-batch-and-exit *.el modes/*/*.el
test:
cask exec ert-runner

View File

@ -37,6 +37,9 @@
(require 'evil)
(require 'annalist)
(defvar evil-collection-base-dir (file-name-directory load-file-name)
"Store the directory evil-collection.el was loaded from.")
(defvar evil-want-integration)
(defvar evil-want-keybinding)
(if (featurep 'evil-keybindings)
@ -377,6 +380,41 @@ modes in the current buffer."
'evil-collection-active
'evil-collection-valid)))
(defun evil-collection--mode-file (mode file)
"Return path to FILE for MODE. Return nil if it doesn't exist."
(let ((path (expand-file-name
(format "modes/%s/%s" mode file) evil-collection-base-dir)))
(when (file-exists-p path)
path)))
(defun evil-collection-open-config-file (mode)
"Open configuration file corresponding to MODE."
(interactive
(list
(completing-read
"Mode: "
(cl-remove-if-not
(lambda (mode)
(evil-collection--mode-file mode (format "evil-collection-%s.el" mode)))
(directory-files
(expand-file-name "modes" evil-collection-base-dir)
nil "^[^.]")))))
(find-file (evil-collection--mode-file mode (format "evil-collection-%s.el" mode))))
(defun evil-collection-open-readme (mode)
"Open README.org corresponding to MODE."
(interactive
(list
(completing-read
"Mode: "
(cl-remove-if-not
(lambda (mode)
(evil-collection--mode-file mode "README.org"))
(directory-files
(expand-file-name "modes" evil-collection-base-dir)
nil "^[^.]")))))
(find-file (evil-collection--mode-file mode "README.org")))
(defun evil-collection--translate-key (state keymap-symbol
translations
destructive)
@ -485,7 +523,9 @@ instead of the modes in `evil-collection-mode-list'."
reqs (cdr mode)))
(dolist (req reqs)
(with-eval-after-load req
(require (intern (concat "evil-collection-" (symbol-name m))))
(load (expand-file-name (format "modes/%s/evil-collection-%s" m m)
evil-collection-base-dir)
nil t)
(funcall (intern (concat "evil-collection-" (symbol-name m)
"-setup")))
(let ((mode-keymaps

Some files were not shown because too many files have changed in this diff Show More