[PATCH] emacs: Remove "f" dependency

Philip K philip at warpmail.net
Fri Mar 27 12:09:23 CET 2020


The "f" library is a rather thin translation layer for already
existing Emacs functions. Most functions directly map to an already
existing function (eg. "f-no-ext" and "file-name-sans-extension"). For
this reason, removing "f" comes at no cost while reducing the number
of dependencies one has to count on and the user has to install.
---
 contrib/emacs/password-store.el | 11 +++++------
 1 file changed, 5 insertions(+), 6 deletions(-)

diff --git a/contrib/emacs/password-store.el b/contrib/emacs/password-store.el
index ca8ae40..fc53f74 100644
--- a/contrib/emacs/password-store.el
+++ b/contrib/emacs/password-store.el
@@ -33,7 +33,6 @@
 
 ;;; Code:
 
-(require 'f)
 (require 'with-editor)
 (require 'auth-source-pass)
 
@@ -187,11 +186,11 @@ Nil arguments are ignored.  Output is discarded."
 
 (defun password-store--entry-to-file (entry)
   "Return file name corresponding to ENTRY."
-  (concat (f-join (password-store-dir) entry) ".gpg"))
+  (concat (expand-file-name entry (password-store-dir)) ".gpg"))
 
 (defun password-store--file-to-entry (file)
   "Return entry name corresponding to FILE."
-  (f-no-ext (f-relative file (password-store-dir))))
+  (file-name-sans-extension (file-relative-name file (password-store-dir))))
 
 (defun password-store--completing-read (&optional require-match)
   "Read a password entry in the minibuffer, with completion.
@@ -214,11 +213,11 @@ ENTRY is the name of a password-store entry."
 (defun password-store-list (&optional subdir)
   "List password entries under SUBDIR."
   (unless subdir (setq subdir ""))
-  (let ((dir (f-join (password-store-dir) subdir)))
-    (if (f-directory? dir)
+  (let ((dir (expand-file-name subdir (password-store-dir))))
+    (if (file-directory-p dir)
         (delete-dups
          (mapcar 'password-store--file-to-entry
-                 (f-files dir (lambda (file) (equal (f-ext file) "gpg")) t))))))
+				 (directory-files-recursively dir ".+\\.gpg\\'"))))))
 
 ;;;###autoload
 (defun password-store-edit (entry)
-- 
2.20.1



More information about the Password-Store mailing list