浏览代码

org-attach: Make use of git optional

* lisp/org-attach.el (org-attach-commit): New variable.
(org-attach-attach): Use new variable.

TINYCHANGE
John Foerch 9 年之前
父节点
当前提交
ff98903015
共有 2 个文件被更改,包括 13 次插入1 次删除
  1. 3 0
      etc/ORG-NEWS
  2. 10 1
      lisp/org-attach.el

+ 3 - 0
etc/ORG-NEWS

@@ -209,6 +209,9 @@ an :indent parameter, much like the one in the clock table.
 
 
 On the other hand, stars no longer appear in an ITEM field.
 On the other hand, stars no longer appear in an ITEM field.
 *** Preview LaTeX snippets in buffers not visiting files
 *** Preview LaTeX snippets in buffers not visiting files
+*** New option ~org-attach-commit~
+When non-nil, commit attachments with git, assuming the document is in
+a git repository.
 ** New functions
 ** New functions
 *** ~org-next-line-empty-p~
 *** ~org-next-line-empty-p~
 It replaces the deprecated ~next~ argument to ~org-previous-line-empty-p~.
 It replaces the deprecated ~next~ argument to ~org-previous-line-empty-p~.

+ 10 - 1
lisp/org-attach.el

@@ -55,6 +55,14 @@ where the Org file lives."
   :group 'org-attach
   :group 'org-attach
   :type 'directory)
   :type 'directory)
 
 
+(defcustom org-attach-commit t
+  "If non-nil commit attachments with git.
+This is only done if the Org file is in a git repository."
+  :group 'org-attach
+  :type 'boolean
+  :version "25.1"
+  :package-version '(Org . "9.0"))
+
 (defcustom org-attach-git-annex-cutoff (* 32 1024)
 (defcustom org-attach-git-annex-cutoff (* 32 1024)
   "If non-nil, files larger than this will be annexed instead of stored."
   "If non-nil, files larger than this will be annexed instead of stored."
   :group 'org-attach
   :group 'org-attach
@@ -373,7 +381,8 @@ METHOD may be `cp', `mv', `ln', or `lns' default taken from
        ((eq method 'cp)	(copy-file file fname))
        ((eq method 'cp)	(copy-file file fname))
        ((eq method 'ln) (add-name-to-file file fname))
        ((eq method 'ln) (add-name-to-file file fname))
        ((eq method 'lns) (make-symbolic-link file fname)))
        ((eq method 'lns) (make-symbolic-link file fname)))
-      (org-attach-commit)
+      (when org-attach-commit
+	(org-attach-commit))
       (org-attach-tag)
       (org-attach-tag)
       (cond ((eq org-attach-store-link-p 'attached)
       (cond ((eq org-attach-store-link-p 'attached)
 	     (org-attach-store-link fname))
 	     (org-attach-store-link fname))