Linting Elisp

TL;DR:
- Prefer cl-lib
- Prefer spaces to tabs
- Resolve various checkdoc complaints
This commit is contained in:
William Carroll 2020-09-02 15:23:46 +01:00
parent ea274f924a
commit f089f3c550
11 changed files with 23 additions and 21 deletions

View file

@ -107,7 +107,7 @@
"Set K to V in XS."
(if (al-has-key? k xs)
(progn
;; Note: this is intentional `alist-get' and not `al-get'.
;; Note: this is intentional `alist-get' and not `al-get'.
(setf (alist-get k xs) v)
xs)
(list-cons `(,k . ,v) xs)))

View file

@ -20,19 +20,19 @@
;; Dependencies
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
(require 'cl-macs)
(require 'cl-lib)
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;; Library
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
(cl-defun clipboard-copy (x &key (message "[clipboard.el] Copied!"))
"Copy string, X, to X11's clipboard."
"Copy string, X, to X11's clipboard and `message' MESSAGE."
(kill-new x)
(message message))
(cl-defun clipboard-paste (&key (message "[clipboard.el] Pasted!"))
"Paste contents of X11 clipboard."
"Paste contents of X11 clipboard and `message' MESSAGE."
(yank)
(message message))

View file

@ -20,7 +20,7 @@
(require 'cycle)
(require '>)
(require 'cl-macs)
(require 'cl-lib)
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;; Library

View file

@ -19,7 +19,7 @@
(require 'math)
(require 'maybe)
(require 'struct)
(require 'cl-macs)
(require 'cl-lib)
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;; Wish list

View file

@ -19,14 +19,14 @@
(require 'prelude)
(require 'macros)
(require 'cl-macs)
(require 'cl-lib)
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;; Library
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
(cl-defun dotted-new (&optional a b)
"Create a new dotted pair (i.e. cons cell)."
"Create a new dotted pair of A and B."
(cons a b))
(defun dotted-instance? (x)

View file

@ -21,7 +21,7 @@
(require 'cycle)
(require 'device)
(require 'maybe)
(require 'cl-macs)
(require 'cl-lib)
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;; Constants

View file

@ -14,15 +14,16 @@
(require 'tuple)
(require 'string)
(require 'cl-macs)
(require 'cl-lib)
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;; Library
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
(cl-defun ivy-helpers-kv (prompt kv f)
"PROMPT users with the keys in KV and return its corresponding value. Calls F
with the key and value from KV."
"PROMPT users with the keys in KV and return its corresponding value.
Apply key and value from KV to F."
(ivy-read
prompt
kv

View file

@ -18,7 +18,7 @@
(require 'string)
(require 'number)
(require 'cl-macs)
(require 'cl-lib)
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;; Constants

View file

@ -15,7 +15,7 @@
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
(require 'maybe)
(require 'cl-macs)
(require 'cl-lib)
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;; Constants
@ -31,7 +31,6 @@
;; TODO: Support all three arguments.
;; Int -> Int -> Int -> Boolean
(cl-defun math-triangle-of-power (&key base power result)
;; TODO: Assert two of three are set.
(cond
((maybe-somes? base power result)
(error "All three arguments should not be set"))

View file

@ -23,7 +23,7 @@
(require 'dash)
(require 's)
(require 'f)
(require 'cl-macs)
(require 'cl-lib)
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;; Utilities
@ -130,7 +130,7 @@ This is a wrapper around `start-process' that has an API that resembles
,@program-args))))
(defun prelude-executable-exists? (name)
"Return t if CLI tool NAME exists according to `exec-path'."
"Return t if CLI tool NAME exists according to the variable `exec-path'."
(let ((file (locate-file name exec-path)))
(require 'maybe)
(if (maybe-some? file)

View file

@ -37,7 +37,7 @@
(require 'series)
(require 'random)
(require 'maybe)
(require 'cl-macs)
(require 'cl-lib)
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;; Library
@ -116,9 +116,11 @@ Depth-first traversals have the advantage of typically consuming less memory
(cl-defun tree-random (&optional (value-fn (lambda (_) nil))
(branching-factor 2))
"Randomly generate a tree with BRANCHING-FACTOR using VALUE-FN to compute the
node values. VALUE-FN is called with the current-depth of the node. Useful for
generating test data. Warning this function can overflow the stack."
"Randomly generate a tree with BRANCHING-FACTOR.
This uses VALUE-FN to compute the node values. VALUE-FN is called with the
current-depth of the node. Useful for generating test data. Warning this
function can overflow the stack."
(cl-labels ((do-random
(d vf bf)
(make-node