about summary refs log tree commit diff
diff options
context:
space:
mode:
authorWilliam Carroll <wpcarro@gmail.com>2020-09-02T13·09+0100
committerWilliam Carroll <wpcarro@gmail.com>2020-09-02T13·09+0100
commit4a6937106559892f601999a6f3cae9beff1fe5f1 (patch)
tree98bc85caf2bad8ea4780a57b29e000b61ca718f5
parentdffb224023e3a663afc4b7461a94c0777fa8dd97 (diff)
General Elisp linting
TL;DR:
- Remove `require` statements from init.el
- Remove unused, auto-install KBDs for bookmark.el
- Remove unused `require` statements from clipboard
- Remove unused, commented-out code

I would like for an Elisp linting stage to test for unused `require` statements,
but I'm unsure how practical that is to support.
-rw-r--r--emacs/.emacs.d/init.el28
-rw-r--r--emacs/.emacs.d/wpc/bookmark.el7
-rw-r--r--emacs/.emacs.d/wpc/clipboard.el7
-rw-r--r--emacs/.emacs.d/wpc/keybindings.el9
-rw-r--r--emacs/.emacs.d/wpc/list.el22
-rw-r--r--emacs/.emacs.d/wpc/wpc-javascript.el1
6 files changed, 9 insertions, 65 deletions
diff --git a/emacs/.emacs.d/init.el b/emacs/.emacs.d/init.el
index c5b873db17ce..35c388f1d00c 100644
--- a/emacs/.emacs.d/init.el
+++ b/emacs/.emacs.d/init.el
@@ -1,42 +1,16 @@
-(require 'wpc-package)
-
 ;; load order is intentional
-(require 'constants)
+(require 'wpc-package)
 (require 'wpc-misc)
-
-;; my libraries
-(require 'functions)
-(require 'prelude)
-(require 'macros)
-
-;; Laptop XF-functionality
-(require 'pulse-audio)
-(require 'screen-brightness)
-
-;; miscellaneous
 (require 'ssh)
-(require 'clipboard)
-(require 'battery)
-(require 'bookmark)
 (require 'keyboard)
 (require 'irc)
 (require 'email)
-(require 'scrot)
-(require 'timestring)
-
-;; TODO: Remove path once published to MELPA.
-;; TODO: How can I package this using Nix?
-;; (require 'egg-timer "~/programming/egg-timer.el/egg-timer.el")
-
 (require 'keybindings)
 (require 'window-manager)
 (require 'wpc-ui)
 (require 'wpc-dired)
 (require 'wpc-org)
 (require 'wpc-company)
-;; TODO: Re-enable flycheck for all languages besides Elisp once I learn more
-;; about the issue with the `emacs-lisp' `flycheck-checker'.
-;; (require 'wpc-flycheck)
 (require 'wpc-shell)
 (require 'wpc-lisp)
 (require 'wpc-haskell)
diff --git a/emacs/.emacs.d/wpc/bookmark.el b/emacs/.emacs.d/wpc/bookmark.el
index 4d1a74e2e145..6384ba88b2b7 100644
--- a/emacs/.emacs.d/wpc/bookmark.el
+++ b/emacs/.emacs.d/wpc/bookmark.el
@@ -33,9 +33,6 @@
 
 (cl-defstruct bookmark label path kbd)
 
-(defconst bookmark-install-kbds? t
-  "When t, install keybindings.")
-
 ;; TODO: Consider hosting this function somewhere other than here, since it
 ;; feels useful above of the context of bookmarks.
 ;; TODO: Assess whether it'd be better to use the existing function:
@@ -82,7 +79,9 @@ Otherwise, open with `counsel-find-file'."
      ((f-file? path)
       (funcall bookmark-handle-file path)))))
 
-(when bookmark-install-kbds?
+
+(defun bookmark-install-kbds ()
+  "Install the keybindings defined herein."
   (->> bookmark-whitelist
        (list-map
         (lambda (b)
diff --git a/emacs/.emacs.d/wpc/clipboard.el b/emacs/.emacs.d/wpc/clipboard.el
index c5375b18c5e7..0570d82873bf 100644
--- a/emacs/.emacs.d/wpc/clipboard.el
+++ b/emacs/.emacs.d/wpc/clipboard.el
@@ -17,13 +17,6 @@
 ;;; Code:
 
 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
-;; Dependencies
-;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
-
-(require 'prelude)
-(require 'ivy-clipmenu)
-
-;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
 ;; Library
 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
 
diff --git a/emacs/.emacs.d/wpc/keybindings.el b/emacs/.emacs.d/wpc/keybindings.el
index 07067a9cdf12..c4fffe0d4f33 100644
--- a/emacs/.emacs.d/wpc/keybindings.el
+++ b/emacs/.emacs.d/wpc/keybindings.el
@@ -22,6 +22,7 @@
 ;; Dependencies
 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
 
+(require 'functions)
 (require 'clipboard)
 (require 'screen-brightness)
 (require 'scrot)
@@ -44,6 +45,10 @@
 (require 'evil-surround)
 (require 'key-chord)
 
+;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
+;; General Keybindings
+;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
+
 ;; Ensure that evil's command mode behaves with readline bindings.
 (general-define-key
  :keymaps 'evil-ex-completion-map
@@ -110,10 +115,6 @@
 (key-chord-mode 1)
 (key-chord-define evil-insert-state-map "jk" 'evil-normal-state)
 
-;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
-;; General KBDs
-;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
-
 ;; This may be contraversial, but I never use the prefix key, and I'd prefer to
 ;; have to bound to the readline function that deletes the entire line.
 (general-unbind "C-u")
diff --git a/emacs/.emacs.d/wpc/list.el b/emacs/.emacs.d/wpc/list.el
index 00ff2affcc8a..cc91ac1eaf60 100644
--- a/emacs/.emacs.d/wpc/list.el
+++ b/emacs/.emacs.d/wpc/list.el
@@ -128,28 +128,6 @@
   "Return over `XS' calling `F' on an element in `XS'and `ACC'."
   (-reduce-from (lambda (acc x) (funcall f x acc)) acc xs))
 
-;; TODO: Support this. It seems like `alist-set' is not working as I expected it
-;; to. Perhaps we should add some tests to confirm the expected behavior.
-;; (cl-defun list-index (f xs &key (transform (lambda (x) x)))
-;;   "Return a mapping of F applied to each x in XS to TRANSFORM applied to x.
-;; The TRANSFORM function defaults to the identity function."
-;;   (->> xs
-;;        (list-reduce (alist-new)
-;;                     (lambda (x acc)
-;;                       (let ((k (funcall f x))
-;;                             (v (funcall transform x)))
-;;                         (if (alist-has-key? k acc)
-;;                             (setf (alist-get k acc) (list v))
-;;                           (setf (alist-get k acc) (list v))))))))
-;; (prelude-assert
-;;  (equal '(("John" . ("Cleese" "Malkovich"))
-;;           ("Thomas" . ("Aquinas")))
-;;         (list-index (lambda (x) (plist-get x :first-name))
-;;                     '((:first-name "John" :last-name "Cleese")
-;;                       (:first-name "John" :last-name "Malkovich")
-;;                       (:first-name "Thomas" :last-name "Aquinas"))
-;;                     :transform (lambda (x) (plist-get x :last-name)))))
-
 (defun list-map (f xs)
   "Call `F' on each element of `XS'."
   (-map f xs))
diff --git a/emacs/.emacs.d/wpc/wpc-javascript.el b/emacs/.emacs.d/wpc/wpc-javascript.el
index 0b05dd325add..5ace2d876f86 100644
--- a/emacs/.emacs.d/wpc/wpc-javascript.el
+++ b/emacs/.emacs.d/wpc/wpc-javascript.el
@@ -32,7 +32,6 @@
   (-insert-at 0 'css-mode-hook wpc-javascript--js-hooks)
   "All of the commonly user hooks for frontend development.")
 
-
 ;; frontend indentation settings
 (setq typescript-indent-level 2
       js-indent-level 2