Skip to content

Instantly share code, notes, and snippets.

@4DA
Last active May 4, 2020
Embed
What would you like to do?
cryfs-mount
(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