Skip to content

Instantly share code, notes, and snippets.

@4DA
Last active May 4, 2020 10:02
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save 4DA/a9ce5f23081a03808e4f4ab836c2ee93 to your computer and use it in GitHub Desktop.
Save 4DA/a9ce5f23081a03808e4f4ab836c2ee93 to your computer and use it in GitHub Desktop.
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