about summary refs log tree commit diff
path: root/emacs/.emacs.d/wpc/fs.el
diff options
context:
space:
mode:
authorWilliam Carroll <wpcarro@gmail.com>2020-09-01T09·17+0100
committerWilliam Carroll <wpcarro@gmail.com>2020-09-01T09·17+0100
commitfb5ec068ddd50f6bce41c7a0bad45673db787940 (patch)
tree19b4ff96983c08f451e7da5f58c95b8f6090ec84 /emacs/.emacs.d/wpc/fs.el
parenta638e15c0dd14a25e6f032b08de5ee1575677497 (diff)
More Elisp linting
This should cover most of the remaining linting errors. After this, I expect
fewer than ten linting errors.
Diffstat (limited to 'emacs/.emacs.d/wpc/fs.el')
-rw-r--r--emacs/.emacs.d/wpc/fs.el23
1 files changed, 14 insertions, 9 deletions
diff --git a/emacs/.emacs.d/wpc/fs.el b/emacs/.emacs.d/wpc/fs.el
index b1a79e280a57..2f83019fd4c9 100644
--- a/emacs/.emacs.d/wpc/fs.el
+++ b/emacs/.emacs.d/wpc/fs.el
@@ -1,5 +1,9 @@
 ;;; fs.el --- Make working with the filesystem easier -*- lexical-binding: t -*-
+
 ;; Author: William Carroll <wpcarro@gmail.com>
+;; Version: 0.0.1
+;; URL: https://git.wpcarro.dev/wpcarro/briefcase
+;; Package-Requires: ((emacs "24.1"))
 
 ;;; Commentary:
 ;; Ergonomic alternatives for working with the filesystem.
@@ -10,31 +14,33 @@
 ;; Dependencies
 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
 
+(require 'dash)
 (require 'f)
+(require 's)
 
 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
 ;; Library
 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
 
-(defun fs/ensure-file (path)
+(defun fs-ensure-file (path)
   "Ensure that a file and its directories in `PATH' exist.
 Will error for inputs with a trailing slash."
   (when (s-ends-with? "/" path)
     (error (format "Input path has trailing slash: %s" path)))
   (->> path
        f-dirname
-       fs/ensure-dir)
+       fs-ensure-dir)
   (f-touch path))
 
 (f-dirname "/tmp/a/b/file.txt")
 
-(defun fs/ensure-dir (path)
+(defun fs-ensure-dir (path)
   "Ensure that a directory and its ancestor directories in `PATH' exist."
   (->> path
        f-split
        (apply #'f-mkdir)))
 
-(defun fs/ls (dir &optional full-path?)
+(defun fs-ls (dir &optional full-path?)
   "List the files in `DIR' one-level deep.
 Should behave similarly in spirit to the Unix command, ls.
 If `FULL-PATH?' is set, return the full-path of the files."
@@ -44,20 +50,19 @@ If `FULL-PATH?' is set, return the full-path of the files."
 ;; Tests
 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
 
-;; TODO: Support `refute' function / macro.
-(ert-deftest fs/test/ensure-file ()
+(ert-deftest fs-test-ensure-file ()
   (let ((file "/tmp/file/a/b/c/file.txt"))
     ;; Ensure this file doesn't exist first to prevent false-positives.
     (f-delete file t)
-    (fs/ensure-file file)
+    (fs-ensure-file file)
     (should (and (f-exists? file)
                  (f-file? file)))))
 
-(ert-deftest fs/test/ensure-dir ()
+(ert-deftest fs-test-ensure-dir ()
   (let ((dir "/tmp/dir/a/b/c"))
     ;; Ensure the directory doesn't exist.
     (f-delete dir t)
-    (fs/ensure-dir dir)
+    (fs-ensure-dir dir)
     (should (and (f-exists? dir)
                  (f-dir? dir)))))