Last active
May 4, 2020 10:02
-
-
Save 4DA/a9ce5f23081a03808e4f4ab836c2ee93 to your computer and use it in GitHub Desktop.
cryfs-mount
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
(defun mount-cryfs (what where) | |
(setq pass (concat (read-passwd "cryfs pw: ") "\n")) | |
(setq process | |
(start-process-shell-command "cryfs" "*cryfs*" | |
(format "cryfs %s %s" what where))) | |
(process-send-string process pass) | |
(while (process-live-p process) (sit-for 0.1)) | |
(eq (process-exit-status process) 0)) | |
;; mount cryfs `cryfs-dir` to `mount-dir' and open `file' | |
(defun cryfs-open (file mount-dir cryfs-dir) | |
(defun my-open-at-end (file) | |
(let ((buf (find-file file))) | |
(with-current-buffer buf | |
(end-of-buffer)))) | |
(if (not (file-readable-p file)) | |
(if (mount-cryfs cryfs-dir mount-dir) | |
;; then | |
(my-open-at-end file) | |
;; else | |
(message (format "Cannot access %s" file))) | |
(my-open-at-end file))) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment