浏览代码

* org-attach.el: Allow to store a link to the attach-dir location.

* org-attach.el (org-attach-store-link-p): Allow to create a
link to the attach-dir location of the file.
(org-attach-attach): Allow to store a link to the attach-dir
location.

This was requested by Darlan Cavalcante Moreira.
Bastien Guerry 14 年之前
父节点
当前提交
b814d83b51
共有 1 个文件被更改,包括 8 次插入3 次删除
  1. 8 3
      lisp/org-attach.el

+ 8 - 3
lisp/org-attach.el

@@ -102,7 +102,10 @@ ln    create a hard link.  Note that this is not supported
 (defcustom org-attach-store-link-p nil
   "Non-nil means store a link to a file when attaching it."
   :group 'org-attach
-  :type 'boolean)
+  :type '(choice
+	  (const :tag "Don't store link" nil)
+	  (const :tag "Link to origin location" 'origin)
+	  (const :tag "Link to the attach-dir location" 'attach-dir)))
 
 ;;;###autoload
 (defun org-attach ()
@@ -294,8 +297,10 @@ METHOD may be `cp', `mv', or `ln', default taken from `org-attach-method'."
        ((eq method 'ln) (add-name-to-file file fname)))
       (org-attach-commit)
       (org-attach-tag)
-      (when org-attach-store-link-p 
-	(org-attach-store-link file))
+      (cond ((eq org-attach-store-link-p 'origin)
+	     (org-attach-store-link file))
+	    ((eq org-attach-store-link-p 'attach-dir)
+	     (org-attach-store-link fname)))
       (if visit-dir
 	  (dired attach-dir)
 	(message "File \"%s\" is now a task attachment." basename)))))