[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [O] [PATCH] org-attach.el: Fetch attachments from git annex

From: Kyle Meyer
Subject: Re: [O] [PATCH] org-attach.el: Fetch attachments from git annex
Date: Tue, 26 Jan 2016 02:40:33 -0500
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/25.0.50 (gnu/linux)

Erik Hetzner <address@hidden> writes:

> * org-attach.el (org-attach-use-annex): New function to check if git
>   annex should be used.
>   (org-attach-annex-get-maybe): New function to get a file from git
>   annex if necessary.
>   (org-annex-open): Automatically fetch attached files from git annex when
>   opening if necessary.
> * testing/lisp/test-org-annex.el: New file for testing org-attach. Only
>   contains code for testing org-attach with git annex at the moment.
> * mk/targets.mk: Fix cleantest target to for deleting git annex repos.
> +(defun org-attach-use-annex ()
> +  "Return non-nil if git annex can be used."
> +  (let ((git-dir (vc-git-root (expand-file-name org-attach-directory))))
> +    (and org-attach-git-annex-cutoff
> +         (or (file-exists-p (expand-file-name "annex" git-dir))
> +             (file-exists-p (expand-file-name ".git/annex" git-dir))))))
> +
> +(defun org-attach-annex-get-maybe (path)
> +  "Call git annex get PATH if using git annex."
> +  (if (org-attach-use-annex)
> +      (call-process "git" nil nil nil "annex" "get" path)))



> -                               (mapcar #'list files) nil t))))
> -    (org-open-file (expand-file-name file attach-dir) in-emacs)))
> +                               (mapcar #'list files) nil t)))
> +         (path (expand-file-name file attach-dir)))
> +    (org-attach-annex-get-maybe path)
> +    (org-open-file path in-emacs)))

I think it's a mistake to always run git annex get and to remove the
message, because this process can hang if all the repos with the file
are unavailable.

This is also one of the reasons why I think there should be an option to
turn off automatic fetching.  Users should be able to stop org-attach
from trying to make connections.


reply via email to

[Prev in Thread] Current Thread [Next in Thread]