diff options
Diffstat (limited to 'lisp/org/org-attach.el')
-rw-r--r-- | lisp/org/org-attach.el | 24 |
1 files changed, 15 insertions, 9 deletions
diff --git a/lisp/org/org-attach.el b/lisp/org/org-attach.el index 692631b64c1..42a3894388e 100644 --- a/lisp/org/org-attach.el +++ b/lisp/org/org-attach.el @@ -4,7 +4,7 @@ ;; Author: John Wiegley <johnw@newartisans.com> ;; Keywords: org data task -;; Version: 6.33x +;; Version: 6.35i ;; This file is part of GNU Emacs. ;; @@ -92,7 +92,7 @@ ln create a hard link. Note that this is not supported :type 'boolean) (defcustom org-attach-allow-inheritance t - "Non-nil means, allow attachment directories be inherited." + "Non-nil means allow attachment directories be inherited." :group 'org-attach :type 'boolean) @@ -241,12 +241,17 @@ the ATTACH_DIR property) their own attachment directory." "Commit changes to git if `org-attach-directory' is properly initialized. This checks for the existence of a \".git\" directory in that directory." (let ((dir (expand-file-name org-attach-directory))) - (if (file-exists-p (expand-file-name ".git" dir)) - (shell-command - (concat "(cd " dir "; " - " git add .; " - " git ls-files --deleted -z | xargs -0 git rm; " - " git commit -m 'Synchronized attachments')"))))) + (when (file-exists-p (expand-file-name ".git" dir)) + (with-temp-buffer + (cd dir) + (shell-command "git add .") + (shell-command "git ls-files --deleted" t) + (mapc '(lambda (file) + (unless (string= file "") + (shell-command + (concat "git rm \"" file "\"")))) + (split-string (buffer-string) "\n")) + (shell-command "git commit -m 'Synchronized attachments'"))))) (defun org-attach-tag (&optional off) "Turn the autotag on or (if OFF is set) off." @@ -322,7 +327,8 @@ The attachment is created as an Emacs buffer." (setq file (expand-file-name file attach-dir)) (unless (file-exists-p file) (error "No such attachment: %s" file)) - (delete-file file))) + (delete-file file) + (org-attach-commit))) (defun org-attach-delete-all (&optional force) "Delete all attachments from the current task. |