From mboxrd@z Thu Jan 1 00:00:00 1970 From: Kyle Meyer Subject: Re: [PATCH] org-attach.el: Fetch attachments from git annex Date: Tue, 26 Jan 2016 02:40:33 -0500 Message-ID: <87egd4u6tq.fsf@kyleam.com> References: <568b532e.d111620a.b25a8.ffffbb7c@mx.google.com> <87poxg8s22.fsf@kyleam.com> <568c6aaa.c345620a.7f4da.6359@mx.google.com> <56a5b193.ca77420a.1551e.667c@mx.google.com> <87lh7dz79f.fsf@gmx.us> <56a70513.6861420a.33633.5843@mx.google.com> Mime-Version: 1.0 Content-Type: text/plain Return-path: Received: from eggs.gnu.org ([2001:4830:134:3::10]:59405) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1aNyF8-0000ee-9U for emacs-orgmode@gnu.org; Tue, 26 Jan 2016 02:40:51 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1aNyF4-00077B-8T for emacs-orgmode@gnu.org; Tue, 26 Jan 2016 02:40:50 -0500 Received: from pb-smtp0.int.icgroup.com ([208.72.237.35]:54418 helo=sasl.smtp.pobox.com) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1aNyF4-00076Q-2U for emacs-orgmode@gnu.org; Tue, 26 Jan 2016 02:40:46 -0500 In-Reply-To: <56a70513.6861420a.33633.5843@mx.google.com> (Erik Hetzner's message of "Sun, 24 Jan 2016 20:34:20 -0800") List-Id: "General discussions about Org-mode." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: emacs-orgmode-bounces+geo-emacs-orgmode=m.gmane.org@gnu.org Sender: emacs-orgmode-bounces+geo-emacs-orgmode=m.gmane.org@gnu.org To: Erik Hetzner Cc: emacs-orgmode@gnu.org Erik Hetzner 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. ^^^^^^ Typo > +(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))) s/if/when/ [...] > - (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. -- Kyle