;;; module-alioth.el --- alioth automount -*- lexical-binding: t; -*- ;;; ;;; Commentary: ;;; ;;; Automount alioth on demand. ;;; ;;; Code: (defun ensure-alioth-mounted () "Check if ~/alioth is mounted, and if not, mount it." (unless (file-exists-p "~/alioth/.exists") (mount-alioth-sshfs))) (defun umount-alioth-sshfs () "Unmount Alioth Uberspace using SSHFS." (interactive) (let ((default-directory "~")) (shell-command "umount ~/alioth"))) (defun mount-alioth-sshfs () "Mount Alioth Uberspace using SSHFS." (interactive) (let ((default-directory "~")) (shell-command "sshfs lkn@alioth.uberspace.de:/home/lkn/ ~/alioth"))) (add-hook 'find-file-hook (lambda () (when (string-prefix-p (expand-file-name "~/alioth/") (expand-file-name (buffer-file-name))) (ensure-alioth-mounted)))) (add-hook 'dired-mode-hook (lambda () (when (string-prefix-p (expand-file-name "~/alioth/") (expand-file-name default-directory)) (ensure-alioth-mounted)))) (provide 'module-alioth) ;;; module-alioth.el ends here.