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.
This commit is contained in:
William Carroll 2020-09-02 14:09:15 +01:00
parent dffb224023
commit 4a69371065
6 changed files with 9 additions and 65 deletions

View file

@ -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)

View file

@ -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)

View file

@ -16,13 +16,6 @@
;;; Code:
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;; Dependencies
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
(require 'prelude)
(require 'ivy-clipmenu)
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;; Library
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;

View file

@ -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")

View file

@ -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))

View file

@ -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