Browse Source

Additional option for org-attach-store-link-p

* doc/org-manual.org (Attachment options)
* etc/ORG-NEWS (New option in ~org-attach-store-link-p~)
* lisp/org-attach.el (org-attach-store-link-p)
  (org-attach-attach): Add option to store a link to the attached file
  with a file link.
Gustav Wikström 5 years ago
parent
commit
edefb2835d
3 changed files with 19 additions and 1 deletions
  1. 9 0
      doc/org-manual.org
  2. 4 0
      etc/ORG-NEWS
  3. 6 1
      lisp/org-attach.el

+ 9 - 0
doc/org-manual.org

@@ -8031,6 +8031,15 @@ mentioning.
   tried when resolving existing ID's into paths, to maintain backward
   tried when resolving existing ID's into paths, to maintain backward
   compatibility with existing folders in your system.
   compatibility with existing folders in your system.
 
 
+- ~org-attach-store-link-p~ ::
+  #+vindex: org-attach-store-link-p
+  Stores a link to the file that is being attached.  The link is
+  stored in ~org-stored-links~ for later insertion with {{{kbd(C-c
+  C-l)}}} (see [[*Handling Links]]).  Depending on what option is set in
+  ~org-attach-store-link-p~, the link is stored to either the original
+  location as a file link, the attachment location as an attachment
+  link or to the attachment location as a file link.
+
 - ~org-attach-expert~ ::
 - ~org-attach-expert~ ::
   #+vindex: org-attach-expert
   #+vindex: org-attach-expert
   Do not show the splash buffer with the attach dispatcher when
   Do not show the splash buffer with the attach dispatcher when

+ 4 - 0
etc/ORG-NEWS

@@ -64,6 +64,10 @@ normal headlines.  The face can be customized via ~org-headline-todo~.
 there was only key =<q>= to exit column view and only functional on lines
 there was only key =<q>= to exit column view and only functional on lines
 which were affected by the column view.
 which were affected by the column view.
 
 
+*** New option in ~org-attach-store-link-p~
+~org-attach-store-link-p~ have a new option to store a file link to
+the attachment.
+
 * Version 9.3
 * Version 9.3
 
 
 ** Incompatible changes
 ** Incompatible changes

+ 6 - 1
lisp/org-attach.el

@@ -139,7 +139,8 @@ Selective means to respect the inheritance setting in
   :type '(choice
   :type '(choice
 	  (const :tag "Don't store link" nil)
 	  (const :tag "Don't store link" nil)
 	  (const :tag "Link to origin location" t)
 	  (const :tag "Link to origin location" t)
-	  (const :tag "Link to the attach-dir location" attached)))
+	  (const :tag "Attachment link to the attach-dir location" attached)
+	  (const :tag "File link to the attach-dir location" file)))
 
 
 (defcustom org-attach-archive-delete nil
 (defcustom org-attach-archive-delete nil
   "Non-nil means attachments are deleted upon archiving a subtree.
   "Non-nil means attachments are deleted upon archiving a subtree.
@@ -506,6 +507,10 @@ METHOD may be `cp', `mv', `ln', `lns' or `url' default taken from
             ((eq org-attach-store-link-p t)
             ((eq org-attach-store-link-p t)
              (push (list (concat "file:" file)
              (push (list (concat "file:" file)
 			 (file-name-nondirectory file))
 			 (file-name-nondirectory file))
+		   org-stored-links))
+	    ((eq org-attach-store-link-p 'file)
+	     (push (list (concat "file:" attach-file)
+			 (file-name-nondirectory attach-file))
 		   org-stored-links)))
 		   org-stored-links)))
       (if visit-dir
       (if visit-dir
           (dired attach-dir)
           (dired attach-dir)