org-attach*, org, org-manual, org-news, ox-html, testing/*
* lisp/org-attach.el
Changed the way attachments deal with property-inheritance. It now
adheres to the =org-use-property-inheritance= setting by default but
it can be customized if needed (I recommend to enable it!).
The property ATTACH_DIR is deprecated in favour of the shorter and simpler
property DIR.
Added an explicit option to =org-attach= for unsetting
attachment-directories (i.e. remove DIR property and deal with the
attachments by interaction).
Added attachment link type with the prefix "attachment:".
Added customizations:
- org-attach-dir-relative
- org-attach-preferred-new-method
- org-attach-use-inheritance
- org-attach-id-to-path-function
Hooks added:
- org-attach-after-change-hook
- org-attach-open-hook
A new linktype "attachment" is added in order to reduce
link-duplication when wanting to link to files in attached folders of
nodes. This works for both ID and DIR properties. The goal is to
make the functionality for attachment links mirror the functionality
for file links.
* lisp/org-attach-git.el
New file, existing functionality. Code here has been factored out
from org-attach.el and if GIT-functionality is to be used this module
needs to be required sepatately. It extends org-attach by use of its
hooks.
Activating git functionality in org-attach is done by loading
org-attach-git from now on, instead of customizing a variable.
Naming of both functions and tests has been modified to match the move
of functionality into its own module.
* lisp/org.el
Inline images are shown also using attachment-links, exactly the same
as it works for file-links today.
Make org-open-at-point respect ARG when opening attachment-dir.
* lisp/org-compat.el
org-attach-directory has been deprecated in favour for
org-attach-id-dir. The new name matches its purpose better.
* lisp/ox-html.el
Export attachment links to images as inline images, in the same way as
file links work today.
* etc/ORG-NEWS
Mention the changes in this patch.
* doc/org-manual.org
The chapter "Refile, Copy, Archive" has been split into two separate
chapters.
- "Refile, Copy and Archiving" for information related to moving
existing data around.
- "Capture, Attachments, RSS Feeds and Protocols" for information
related to working with external data.
The attachment-part has been rewritten and extended to match the
changes in this patch.
The new attachment link type is mentioned both inside the attachments
chapter and in the chapter dealing with links.
Documentation related to external links has been improved.
* testing/lisp/test-org-attach-annex.el
Require org-attach-git instead of org-attach, since this file tests
the GIT-functionality.
* testing/lisp/test-org-attach.el
Add tests for org-attach.
* testing/org-test.el
Define a symbol for a file to test attachments with.
* testing/examples/*
A bunch of new example files and folders are created and are used in
testing of org-attach to verify its functionality.
2018-11-25 15:38:44 -05:00
|
|
|
|
;;; org-attach.el --- Manage file attachments to Org outlines -*- lexical-binding: t; -*-
|
2008-10-01 03:25:18 -04:00
|
|
|
|
|
2024-01-01 20:47:10 -05:00
|
|
|
|
;; Copyright (C) 2008-2024 Free Software Foundation, Inc.
|
2008-10-01 03:25:18 -04:00
|
|
|
|
|
|
|
|
|
;; Author: John Wiegley <johnw@newartisans.com>
|
org-attach*, org, org-manual, org-news, ox-html, testing/*
* lisp/org-attach.el
Changed the way attachments deal with property-inheritance. It now
adheres to the =org-use-property-inheritance= setting by default but
it can be customized if needed (I recommend to enable it!).
The property ATTACH_DIR is deprecated in favour of the shorter and simpler
property DIR.
Added an explicit option to =org-attach= for unsetting
attachment-directories (i.e. remove DIR property and deal with the
attachments by interaction).
Added attachment link type with the prefix "attachment:".
Added customizations:
- org-attach-dir-relative
- org-attach-preferred-new-method
- org-attach-use-inheritance
- org-attach-id-to-path-function
Hooks added:
- org-attach-after-change-hook
- org-attach-open-hook
A new linktype "attachment" is added in order to reduce
link-duplication when wanting to link to files in attached folders of
nodes. This works for both ID and DIR properties. The goal is to
make the functionality for attachment links mirror the functionality
for file links.
* lisp/org-attach-git.el
New file, existing functionality. Code here has been factored out
from org-attach.el and if GIT-functionality is to be used this module
needs to be required sepatately. It extends org-attach by use of its
hooks.
Activating git functionality in org-attach is done by loading
org-attach-git from now on, instead of customizing a variable.
Naming of both functions and tests has been modified to match the move
of functionality into its own module.
* lisp/org.el
Inline images are shown also using attachment-links, exactly the same
as it works for file-links today.
Make org-open-at-point respect ARG when opening attachment-dir.
* lisp/org-compat.el
org-attach-directory has been deprecated in favour for
org-attach-id-dir. The new name matches its purpose better.
* lisp/ox-html.el
Export attachment links to images as inline images, in the same way as
file links work today.
* etc/ORG-NEWS
Mention the changes in this patch.
* doc/org-manual.org
The chapter "Refile, Copy, Archive" has been split into two separate
chapters.
- "Refile, Copy and Archiving" for information related to moving
existing data around.
- "Capture, Attachments, RSS Feeds and Protocols" for information
related to working with external data.
The attachment-part has been rewritten and extended to match the
changes in this patch.
The new attachment link type is mentioned both inside the attachments
chapter and in the chapter dealing with links.
Documentation related to external links has been improved.
* testing/lisp/test-org-attach-annex.el
Require org-attach-git instead of org-attach, since this file tests
the GIT-functionality.
* testing/lisp/test-org-attach.el
Add tests for org-attach.
* testing/org-test.el
Define a symbol for a file to test attachments with.
* testing/examples/*
A bunch of new example files and folders are created and are used in
testing of org-attach to verify its functionality.
2018-11-25 15:38:44 -05:00
|
|
|
|
;; Keywords: org data attachment
|
2008-10-01 03:25:18 -04:00
|
|
|
|
;; This file is part of GNU Emacs.
|
|
|
|
|
;;
|
|
|
|
|
;; GNU Emacs is free software: you can redistribute it and/or modify
|
|
|
|
|
;; it under the terms of the GNU General Public License as published by
|
|
|
|
|
;; the Free Software Foundation, either version 3 of the License, or
|
|
|
|
|
;; (at your option) any later version.
|
|
|
|
|
|
|
|
|
|
;; GNU Emacs is distributed in the hope that it will be useful,
|
|
|
|
|
;; but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
|
;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
|
|
|
;; GNU General Public License for more details.
|
|
|
|
|
|
|
|
|
|
;; You should have received a copy of the GNU General Public License
|
2017-09-13 18:52:52 -04:00
|
|
|
|
;; along with GNU Emacs. If not, see <https://www.gnu.org/licenses/>.
|
2008-10-01 03:25:18 -04:00
|
|
|
|
|
|
|
|
|
;;; Commentary:
|
|
|
|
|
|
2016-08-23 16:13:56 -04:00
|
|
|
|
;; See the Org manual for information on how to use it.
|
2008-10-01 03:25:18 -04:00
|
|
|
|
;;
|
org-attach*, org, org-manual, org-news, ox-html, testing/*
* lisp/org-attach.el
Changed the way attachments deal with property-inheritance. It now
adheres to the =org-use-property-inheritance= setting by default but
it can be customized if needed (I recommend to enable it!).
The property ATTACH_DIR is deprecated in favour of the shorter and simpler
property DIR.
Added an explicit option to =org-attach= for unsetting
attachment-directories (i.e. remove DIR property and deal with the
attachments by interaction).
Added attachment link type with the prefix "attachment:".
Added customizations:
- org-attach-dir-relative
- org-attach-preferred-new-method
- org-attach-use-inheritance
- org-attach-id-to-path-function
Hooks added:
- org-attach-after-change-hook
- org-attach-open-hook
A new linktype "attachment" is added in order to reduce
link-duplication when wanting to link to files in attached folders of
nodes. This works for both ID and DIR properties. The goal is to
make the functionality for attachment links mirror the functionality
for file links.
* lisp/org-attach-git.el
New file, existing functionality. Code here has been factored out
from org-attach.el and if GIT-functionality is to be used this module
needs to be required sepatately. It extends org-attach by use of its
hooks.
Activating git functionality in org-attach is done by loading
org-attach-git from now on, instead of customizing a variable.
Naming of both functions and tests has been modified to match the move
of functionality into its own module.
* lisp/org.el
Inline images are shown also using attachment-links, exactly the same
as it works for file-links today.
Make org-open-at-point respect ARG when opening attachment-dir.
* lisp/org-compat.el
org-attach-directory has been deprecated in favour for
org-attach-id-dir. The new name matches its purpose better.
* lisp/ox-html.el
Export attachment links to images as inline images, in the same way as
file links work today.
* etc/ORG-NEWS
Mention the changes in this patch.
* doc/org-manual.org
The chapter "Refile, Copy, Archive" has been split into two separate
chapters.
- "Refile, Copy and Archiving" for information related to moving
existing data around.
- "Capture, Attachments, RSS Feeds and Protocols" for information
related to working with external data.
The attachment-part has been rewritten and extended to match the
changes in this patch.
The new attachment link type is mentioned both inside the attachments
chapter and in the chapter dealing with links.
Documentation related to external links has been improved.
* testing/lisp/test-org-attach-annex.el
Require org-attach-git instead of org-attach, since this file tests
the GIT-functionality.
* testing/lisp/test-org-attach.el
Add tests for org-attach.
* testing/org-test.el
Define a symbol for a file to test attachments with.
* testing/examples/*
A bunch of new example files and folders are created and are used in
testing of org-attach to verify its functionality.
2018-11-25 15:38:44 -05:00
|
|
|
|
;; Attachments are managed either by using a custom property DIR or by
|
|
|
|
|
;; using property ID from org-id. When DIR is defined, a location in
|
|
|
|
|
;; the filesystem is directly attached to the outline node. When
|
|
|
|
|
;; org-id is used, attachments are stored in a folder named after the
|
|
|
|
|
;; ID, in a location defined by `org-attach-id-dir'. DIR has
|
|
|
|
|
;; precedence over ID when both parameters are defined for the current
|
|
|
|
|
;; outline node (also when inherited parameters are taken into
|
|
|
|
|
;; account).
|
2008-10-01 03:25:18 -04:00
|
|
|
|
|
2008-10-09 06:19:43 -04:00
|
|
|
|
;;; Code:
|
2008-10-01 03:25:18 -04:00
|
|
|
|
|
2022-08-04 09:53:05 -04:00
|
|
|
|
(require 'org-macs)
|
|
|
|
|
(org-assert-version)
|
|
|
|
|
|
2016-07-25 09:54:06 -04:00
|
|
|
|
(require 'cl-lib)
|
2008-10-01 03:25:18 -04:00
|
|
|
|
(require 'org)
|
org-attach*, org, org-manual, org-news, ox-html, testing/*
* lisp/org-attach.el
Changed the way attachments deal with property-inheritance. It now
adheres to the =org-use-property-inheritance= setting by default but
it can be customized if needed (I recommend to enable it!).
The property ATTACH_DIR is deprecated in favour of the shorter and simpler
property DIR.
Added an explicit option to =org-attach= for unsetting
attachment-directories (i.e. remove DIR property and deal with the
attachments by interaction).
Added attachment link type with the prefix "attachment:".
Added customizations:
- org-attach-dir-relative
- org-attach-preferred-new-method
- org-attach-use-inheritance
- org-attach-id-to-path-function
Hooks added:
- org-attach-after-change-hook
- org-attach-open-hook
A new linktype "attachment" is added in order to reduce
link-duplication when wanting to link to files in attached folders of
nodes. This works for both ID and DIR properties. The goal is to
make the functionality for attachment links mirror the functionality
for file links.
* lisp/org-attach-git.el
New file, existing functionality. Code here has been factored out
from org-attach.el and if GIT-functionality is to be used this module
needs to be required sepatately. It extends org-attach by use of its
hooks.
Activating git functionality in org-attach is done by loading
org-attach-git from now on, instead of customizing a variable.
Naming of both functions and tests has been modified to match the move
of functionality into its own module.
* lisp/org.el
Inline images are shown also using attachment-links, exactly the same
as it works for file-links today.
Make org-open-at-point respect ARG when opening attachment-dir.
* lisp/org-compat.el
org-attach-directory has been deprecated in favour for
org-attach-id-dir. The new name matches its purpose better.
* lisp/ox-html.el
Export attachment links to images as inline images, in the same way as
file links work today.
* etc/ORG-NEWS
Mention the changes in this patch.
* doc/org-manual.org
The chapter "Refile, Copy, Archive" has been split into two separate
chapters.
- "Refile, Copy and Archiving" for information related to moving
existing data around.
- "Capture, Attachments, RSS Feeds and Protocols" for information
related to working with external data.
The attachment-part has been rewritten and extended to match the
changes in this patch.
The new attachment link type is mentioned both inside the attachments
chapter and in the chapter dealing with links.
Documentation related to external links has been improved.
* testing/lisp/test-org-attach-annex.el
Require org-attach-git instead of org-attach, since this file tests
the GIT-functionality.
* testing/lisp/test-org-attach.el
Add tests for org-attach.
* testing/org-test.el
Define a symbol for a file to test attachments with.
* testing/examples/*
A bunch of new example files and folders are created and are used in
testing of org-attach to verify its functionality.
2018-11-25 15:38:44 -05:00
|
|
|
|
(require 'ol)
|
2016-07-25 09:54:06 -04:00
|
|
|
|
(require 'org-id)
|
2013-09-02 07:33:52 -04:00
|
|
|
|
|
2017-05-09 11:51:32 -04:00
|
|
|
|
(declare-function dired-dwim-target-directory "dired-aux")
|
2021-09-25 15:05:08 -04:00
|
|
|
|
(declare-function dired-get-marked-files "dired" (&optional localp arg filter distinguish-one-marked error))
|
2023-05-16 06:41:53 -04:00
|
|
|
|
(declare-function org-element-property "org-element-ast" (property node))
|
2023-05-03 10:26:41 -04:00
|
|
|
|
(declare-function org-element-begin "org-element" (node))
|
|
|
|
|
(declare-function org-element-end "org-element" (node))
|
|
|
|
|
(declare-function org-element-contents-begin "org-element" (node))
|
|
|
|
|
(declare-function org-element-contents-end "org-element" (node))
|
2023-05-16 06:41:53 -04:00
|
|
|
|
(declare-function org-element-type-p "org-element-ast" (node types))
|
2020-12-23 00:05:22 -05:00
|
|
|
|
(declare-function org-inlinetask-goto-beginning "org-inlinetask" ())
|
|
|
|
|
(declare-function org-inlinetask-in-task-p "org-inlinetask" ())
|
2017-05-09 11:51:32 -04:00
|
|
|
|
|
2008-10-01 03:25:18 -04:00
|
|
|
|
(defgroup org-attach nil
|
org-attach*, org, org-manual, org-news, ox-html, testing/*
* lisp/org-attach.el
Changed the way attachments deal with property-inheritance. It now
adheres to the =org-use-property-inheritance= setting by default but
it can be customized if needed (I recommend to enable it!).
The property ATTACH_DIR is deprecated in favour of the shorter and simpler
property DIR.
Added an explicit option to =org-attach= for unsetting
attachment-directories (i.e. remove DIR property and deal with the
attachments by interaction).
Added attachment link type with the prefix "attachment:".
Added customizations:
- org-attach-dir-relative
- org-attach-preferred-new-method
- org-attach-use-inheritance
- org-attach-id-to-path-function
Hooks added:
- org-attach-after-change-hook
- org-attach-open-hook
A new linktype "attachment" is added in order to reduce
link-duplication when wanting to link to files in attached folders of
nodes. This works for both ID and DIR properties. The goal is to
make the functionality for attachment links mirror the functionality
for file links.
* lisp/org-attach-git.el
New file, existing functionality. Code here has been factored out
from org-attach.el and if GIT-functionality is to be used this module
needs to be required sepatately. It extends org-attach by use of its
hooks.
Activating git functionality in org-attach is done by loading
org-attach-git from now on, instead of customizing a variable.
Naming of both functions and tests has been modified to match the move
of functionality into its own module.
* lisp/org.el
Inline images are shown also using attachment-links, exactly the same
as it works for file-links today.
Make org-open-at-point respect ARG when opening attachment-dir.
* lisp/org-compat.el
org-attach-directory has been deprecated in favour for
org-attach-id-dir. The new name matches its purpose better.
* lisp/ox-html.el
Export attachment links to images as inline images, in the same way as
file links work today.
* etc/ORG-NEWS
Mention the changes in this patch.
* doc/org-manual.org
The chapter "Refile, Copy, Archive" has been split into two separate
chapters.
- "Refile, Copy and Archiving" for information related to moving
existing data around.
- "Capture, Attachments, RSS Feeds and Protocols" for information
related to working with external data.
The attachment-part has been rewritten and extended to match the
changes in this patch.
The new attachment link type is mentioned both inside the attachments
chapter and in the chapter dealing with links.
Documentation related to external links has been improved.
* testing/lisp/test-org-attach-annex.el
Require org-attach-git instead of org-attach, since this file tests
the GIT-functionality.
* testing/lisp/test-org-attach.el
Add tests for org-attach.
* testing/org-test.el
Define a symbol for a file to test attachments with.
* testing/examples/*
A bunch of new example files and folders are created and are used in
testing of org-attach to verify its functionality.
2018-11-25 15:38:44 -05:00
|
|
|
|
"Options concerning attachments in Org mode."
|
2008-10-09 06:19:43 -04:00
|
|
|
|
:tag "Org Attach"
|
2008-10-01 03:25:18 -04:00
|
|
|
|
:group 'org)
|
|
|
|
|
|
org-attach*, org, org-manual, org-news, ox-html, testing/*
* lisp/org-attach.el
Changed the way attachments deal with property-inheritance. It now
adheres to the =org-use-property-inheritance= setting by default but
it can be customized if needed (I recommend to enable it!).
The property ATTACH_DIR is deprecated in favour of the shorter and simpler
property DIR.
Added an explicit option to =org-attach= for unsetting
attachment-directories (i.e. remove DIR property and deal with the
attachments by interaction).
Added attachment link type with the prefix "attachment:".
Added customizations:
- org-attach-dir-relative
- org-attach-preferred-new-method
- org-attach-use-inheritance
- org-attach-id-to-path-function
Hooks added:
- org-attach-after-change-hook
- org-attach-open-hook
A new linktype "attachment" is added in order to reduce
link-duplication when wanting to link to files in attached folders of
nodes. This works for both ID and DIR properties. The goal is to
make the functionality for attachment links mirror the functionality
for file links.
* lisp/org-attach-git.el
New file, existing functionality. Code here has been factored out
from org-attach.el and if GIT-functionality is to be used this module
needs to be required sepatately. It extends org-attach by use of its
hooks.
Activating git functionality in org-attach is done by loading
org-attach-git from now on, instead of customizing a variable.
Naming of both functions and tests has been modified to match the move
of functionality into its own module.
* lisp/org.el
Inline images are shown also using attachment-links, exactly the same
as it works for file-links today.
Make org-open-at-point respect ARG when opening attachment-dir.
* lisp/org-compat.el
org-attach-directory has been deprecated in favour for
org-attach-id-dir. The new name matches its purpose better.
* lisp/ox-html.el
Export attachment links to images as inline images, in the same way as
file links work today.
* etc/ORG-NEWS
Mention the changes in this patch.
* doc/org-manual.org
The chapter "Refile, Copy, Archive" has been split into two separate
chapters.
- "Refile, Copy and Archiving" for information related to moving
existing data around.
- "Capture, Attachments, RSS Feeds and Protocols" for information
related to working with external data.
The attachment-part has been rewritten and extended to match the
changes in this patch.
The new attachment link type is mentioned both inside the attachments
chapter and in the chapter dealing with links.
Documentation related to external links has been improved.
* testing/lisp/test-org-attach-annex.el
Require org-attach-git instead of org-attach, since this file tests
the GIT-functionality.
* testing/lisp/test-org-attach.el
Add tests for org-attach.
* testing/org-test.el
Define a symbol for a file to test attachments with.
* testing/examples/*
A bunch of new example files and folders are created and are used in
testing of org-attach to verify its functionality.
2018-11-25 15:38:44 -05:00
|
|
|
|
(defcustom org-attach-id-dir "data/"
|
2008-10-01 03:25:18 -04:00
|
|
|
|
"The directory where attachments are stored.
|
|
|
|
|
If this is a relative path, it will be interpreted relative to the directory
|
|
|
|
|
where the Org file lives."
|
|
|
|
|
:group 'org-attach
|
2017-12-04 08:55:20 -05:00
|
|
|
|
:type 'directory
|
|
|
|
|
:safe #'stringp)
|
2008-10-01 03:25:18 -04:00
|
|
|
|
|
org-attach*, org, org-manual, org-news, ox-html, testing/*
* lisp/org-attach.el
Changed the way attachments deal with property-inheritance. It now
adheres to the =org-use-property-inheritance= setting by default but
it can be customized if needed (I recommend to enable it!).
The property ATTACH_DIR is deprecated in favour of the shorter and simpler
property DIR.
Added an explicit option to =org-attach= for unsetting
attachment-directories (i.e. remove DIR property and deal with the
attachments by interaction).
Added attachment link type with the prefix "attachment:".
Added customizations:
- org-attach-dir-relative
- org-attach-preferred-new-method
- org-attach-use-inheritance
- org-attach-id-to-path-function
Hooks added:
- org-attach-after-change-hook
- org-attach-open-hook
A new linktype "attachment" is added in order to reduce
link-duplication when wanting to link to files in attached folders of
nodes. This works for both ID and DIR properties. The goal is to
make the functionality for attachment links mirror the functionality
for file links.
* lisp/org-attach-git.el
New file, existing functionality. Code here has been factored out
from org-attach.el and if GIT-functionality is to be used this module
needs to be required sepatately. It extends org-attach by use of its
hooks.
Activating git functionality in org-attach is done by loading
org-attach-git from now on, instead of customizing a variable.
Naming of both functions and tests has been modified to match the move
of functionality into its own module.
* lisp/org.el
Inline images are shown also using attachment-links, exactly the same
as it works for file-links today.
Make org-open-at-point respect ARG when opening attachment-dir.
* lisp/org-compat.el
org-attach-directory has been deprecated in favour for
org-attach-id-dir. The new name matches its purpose better.
* lisp/ox-html.el
Export attachment links to images as inline images, in the same way as
file links work today.
* etc/ORG-NEWS
Mention the changes in this patch.
* doc/org-manual.org
The chapter "Refile, Copy, Archive" has been split into two separate
chapters.
- "Refile, Copy and Archiving" for information related to moving
existing data around.
- "Capture, Attachments, RSS Feeds and Protocols" for information
related to working with external data.
The attachment-part has been rewritten and extended to match the
changes in this patch.
The new attachment link type is mentioned both inside the attachments
chapter and in the chapter dealing with links.
Documentation related to external links has been improved.
* testing/lisp/test-org-attach-annex.el
Require org-attach-git instead of org-attach, since this file tests
the GIT-functionality.
* testing/lisp/test-org-attach.el
Add tests for org-attach.
* testing/org-test.el
Define a symbol for a file to test attachments with.
* testing/examples/*
A bunch of new example files and folders are created and are used in
testing of org-attach to verify its functionality.
2018-11-25 15:38:44 -05:00
|
|
|
|
(defcustom org-attach-dir-relative nil
|
|
|
|
|
"Non-nil means directories in DIR property are added as relative links.
|
|
|
|
|
Defaults to absolute location."
|
2016-02-10 17:37:03 -05:00
|
|
|
|
:group 'org-attach
|
|
|
|
|
:type 'boolean
|
org-attach*, org, org-manual, org-news, ox-html, testing/*
* lisp/org-attach.el
Changed the way attachments deal with property-inheritance. It now
adheres to the =org-use-property-inheritance= setting by default but
it can be customized if needed (I recommend to enable it!).
The property ATTACH_DIR is deprecated in favour of the shorter and simpler
property DIR.
Added an explicit option to =org-attach= for unsetting
attachment-directories (i.e. remove DIR property and deal with the
attachments by interaction).
Added attachment link type with the prefix "attachment:".
Added customizations:
- org-attach-dir-relative
- org-attach-preferred-new-method
- org-attach-use-inheritance
- org-attach-id-to-path-function
Hooks added:
- org-attach-after-change-hook
- org-attach-open-hook
A new linktype "attachment" is added in order to reduce
link-duplication when wanting to link to files in attached folders of
nodes. This works for both ID and DIR properties. The goal is to
make the functionality for attachment links mirror the functionality
for file links.
* lisp/org-attach-git.el
New file, existing functionality. Code here has been factored out
from org-attach.el and if GIT-functionality is to be used this module
needs to be required sepatately. It extends org-attach by use of its
hooks.
Activating git functionality in org-attach is done by loading
org-attach-git from now on, instead of customizing a variable.
Naming of both functions and tests has been modified to match the move
of functionality into its own module.
* lisp/org.el
Inline images are shown also using attachment-links, exactly the same
as it works for file-links today.
Make org-open-at-point respect ARG when opening attachment-dir.
* lisp/org-compat.el
org-attach-directory has been deprecated in favour for
org-attach-id-dir. The new name matches its purpose better.
* lisp/ox-html.el
Export attachment links to images as inline images, in the same way as
file links work today.
* etc/ORG-NEWS
Mention the changes in this patch.
* doc/org-manual.org
The chapter "Refile, Copy, Archive" has been split into two separate
chapters.
- "Refile, Copy and Archiving" for information related to moving
existing data around.
- "Capture, Attachments, RSS Feeds and Protocols" for information
related to working with external data.
The attachment-part has been rewritten and extended to match the
changes in this patch.
The new attachment link type is mentioned both inside the attachments
chapter and in the chapter dealing with links.
Documentation related to external links has been improved.
* testing/lisp/test-org-attach-annex.el
Require org-attach-git instead of org-attach, since this file tests
the GIT-functionality.
* testing/lisp/test-org-attach.el
Add tests for org-attach.
* testing/org-test.el
Define a symbol for a file to test attachments with.
* testing/examples/*
A bunch of new example files and folders are created and are used in
testing of org-attach to verify its functionality.
2018-11-25 15:38:44 -05:00
|
|
|
|
:package-version '(Org . "9.3")
|
|
|
|
|
:safe #'booleanp)
|
2012-10-20 10:47:01 -04:00
|
|
|
|
|
2008-10-06 03:38:50 -04:00
|
|
|
|
(defcustom org-attach-auto-tag "ATTACH"
|
|
|
|
|
"Tag that will be triggered automatically when an entry has an attachment."
|
|
|
|
|
:group 'org-attach
|
|
|
|
|
:type '(choice
|
|
|
|
|
(const :tag "None" nil)
|
|
|
|
|
(string :tag "Tag")))
|
|
|
|
|
|
org-attach*, org, org-manual, org-news, ox-html, testing/*
* lisp/org-attach.el
Changed the way attachments deal with property-inheritance. It now
adheres to the =org-use-property-inheritance= setting by default but
it can be customized if needed (I recommend to enable it!).
The property ATTACH_DIR is deprecated in favour of the shorter and simpler
property DIR.
Added an explicit option to =org-attach= for unsetting
attachment-directories (i.e. remove DIR property and deal with the
attachments by interaction).
Added attachment link type with the prefix "attachment:".
Added customizations:
- org-attach-dir-relative
- org-attach-preferred-new-method
- org-attach-use-inheritance
- org-attach-id-to-path-function
Hooks added:
- org-attach-after-change-hook
- org-attach-open-hook
A new linktype "attachment" is added in order to reduce
link-duplication when wanting to link to files in attached folders of
nodes. This works for both ID and DIR properties. The goal is to
make the functionality for attachment links mirror the functionality
for file links.
* lisp/org-attach-git.el
New file, existing functionality. Code here has been factored out
from org-attach.el and if GIT-functionality is to be used this module
needs to be required sepatately. It extends org-attach by use of its
hooks.
Activating git functionality in org-attach is done by loading
org-attach-git from now on, instead of customizing a variable.
Naming of both functions and tests has been modified to match the move
of functionality into its own module.
* lisp/org.el
Inline images are shown also using attachment-links, exactly the same
as it works for file-links today.
Make org-open-at-point respect ARG when opening attachment-dir.
* lisp/org-compat.el
org-attach-directory has been deprecated in favour for
org-attach-id-dir. The new name matches its purpose better.
* lisp/ox-html.el
Export attachment links to images as inline images, in the same way as
file links work today.
* etc/ORG-NEWS
Mention the changes in this patch.
* doc/org-manual.org
The chapter "Refile, Copy, Archive" has been split into two separate
chapters.
- "Refile, Copy and Archiving" for information related to moving
existing data around.
- "Capture, Attachments, RSS Feeds and Protocols" for information
related to working with external data.
The attachment-part has been rewritten and extended to match the
changes in this patch.
The new attachment link type is mentioned both inside the attachments
chapter and in the chapter dealing with links.
Documentation related to external links has been improved.
* testing/lisp/test-org-attach-annex.el
Require org-attach-git instead of org-attach, since this file tests
the GIT-functionality.
* testing/lisp/test-org-attach.el
Add tests for org-attach.
* testing/org-test.el
Define a symbol for a file to test attachments with.
* testing/examples/*
A bunch of new example files and folders are created and are used in
testing of org-attach to verify its functionality.
2018-11-25 15:38:44 -05:00
|
|
|
|
(defcustom org-attach-preferred-new-method 'id
|
|
|
|
|
"Preferred way to attach to nodes without existing ID and DIR property.
|
|
|
|
|
This choice is used when adding attachments to nodes without ID
|
|
|
|
|
and DIR properties.
|
|
|
|
|
|
|
|
|
|
Allowed values are:
|
|
|
|
|
|
|
|
|
|
id Create and use an ID parameter
|
|
|
|
|
dir Create and use a DIR parameter
|
|
|
|
|
ask Ask the user for input of which method to choose
|
|
|
|
|
nil Prefer to not create a new parameter
|
|
|
|
|
|
|
|
|
|
nil means that ID or DIR has to be created explicitly
|
|
|
|
|
before attaching files."
|
2008-10-08 06:46:40 -04:00
|
|
|
|
:group 'org-attach
|
org-attach*, org, org-manual, org-news, ox-html, testing/*
* lisp/org-attach.el
Changed the way attachments deal with property-inheritance. It now
adheres to the =org-use-property-inheritance= setting by default but
it can be customized if needed (I recommend to enable it!).
The property ATTACH_DIR is deprecated in favour of the shorter and simpler
property DIR.
Added an explicit option to =org-attach= for unsetting
attachment-directories (i.e. remove DIR property and deal with the
attachments by interaction).
Added attachment link type with the prefix "attachment:".
Added customizations:
- org-attach-dir-relative
- org-attach-preferred-new-method
- org-attach-use-inheritance
- org-attach-id-to-path-function
Hooks added:
- org-attach-after-change-hook
- org-attach-open-hook
A new linktype "attachment" is added in order to reduce
link-duplication when wanting to link to files in attached folders of
nodes. This works for both ID and DIR properties. The goal is to
make the functionality for attachment links mirror the functionality
for file links.
* lisp/org-attach-git.el
New file, existing functionality. Code here has been factored out
from org-attach.el and if GIT-functionality is to be used this module
needs to be required sepatately. It extends org-attach by use of its
hooks.
Activating git functionality in org-attach is done by loading
org-attach-git from now on, instead of customizing a variable.
Naming of both functions and tests has been modified to match the move
of functionality into its own module.
* lisp/org.el
Inline images are shown also using attachment-links, exactly the same
as it works for file-links today.
Make org-open-at-point respect ARG when opening attachment-dir.
* lisp/org-compat.el
org-attach-directory has been deprecated in favour for
org-attach-id-dir. The new name matches its purpose better.
* lisp/ox-html.el
Export attachment links to images as inline images, in the same way as
file links work today.
* etc/ORG-NEWS
Mention the changes in this patch.
* doc/org-manual.org
The chapter "Refile, Copy, Archive" has been split into two separate
chapters.
- "Refile, Copy and Archiving" for information related to moving
existing data around.
- "Capture, Attachments, RSS Feeds and Protocols" for information
related to working with external data.
The attachment-part has been rewritten and extended to match the
changes in this patch.
The new attachment link type is mentioned both inside the attachments
chapter and in the chapter dealing with links.
Documentation related to external links has been improved.
* testing/lisp/test-org-attach-annex.el
Require org-attach-git instead of org-attach, since this file tests
the GIT-functionality.
* testing/lisp/test-org-attach.el
Add tests for org-attach.
* testing/org-test.el
Define a symbol for a file to test attachments with.
* testing/examples/*
A bunch of new example files and folders are created and are used in
testing of org-attach to verify its functionality.
2018-11-25 15:38:44 -05:00
|
|
|
|
:package-version '(org . "9.3")
|
2008-10-08 06:46:40 -04:00
|
|
|
|
:type '(choice
|
org-attach*, org, org-manual, org-news, ox-html, testing/*
* lisp/org-attach.el
Changed the way attachments deal with property-inheritance. It now
adheres to the =org-use-property-inheritance= setting by default but
it can be customized if needed (I recommend to enable it!).
The property ATTACH_DIR is deprecated in favour of the shorter and simpler
property DIR.
Added an explicit option to =org-attach= for unsetting
attachment-directories (i.e. remove DIR property and deal with the
attachments by interaction).
Added attachment link type with the prefix "attachment:".
Added customizations:
- org-attach-dir-relative
- org-attach-preferred-new-method
- org-attach-use-inheritance
- org-attach-id-to-path-function
Hooks added:
- org-attach-after-change-hook
- org-attach-open-hook
A new linktype "attachment" is added in order to reduce
link-duplication when wanting to link to files in attached folders of
nodes. This works for both ID and DIR properties. The goal is to
make the functionality for attachment links mirror the functionality
for file links.
* lisp/org-attach-git.el
New file, existing functionality. Code here has been factored out
from org-attach.el and if GIT-functionality is to be used this module
needs to be required sepatately. It extends org-attach by use of its
hooks.
Activating git functionality in org-attach is done by loading
org-attach-git from now on, instead of customizing a variable.
Naming of both functions and tests has been modified to match the move
of functionality into its own module.
* lisp/org.el
Inline images are shown also using attachment-links, exactly the same
as it works for file-links today.
Make org-open-at-point respect ARG when opening attachment-dir.
* lisp/org-compat.el
org-attach-directory has been deprecated in favour for
org-attach-id-dir. The new name matches its purpose better.
* lisp/ox-html.el
Export attachment links to images as inline images, in the same way as
file links work today.
* etc/ORG-NEWS
Mention the changes in this patch.
* doc/org-manual.org
The chapter "Refile, Copy, Archive" has been split into two separate
chapters.
- "Refile, Copy and Archiving" for information related to moving
existing data around.
- "Capture, Attachments, RSS Feeds and Protocols" for information
related to working with external data.
The attachment-part has been rewritten and extended to match the
changes in this patch.
The new attachment link type is mentioned both inside the attachments
chapter and in the chapter dealing with links.
Documentation related to external links has been improved.
* testing/lisp/test-org-attach-annex.el
Require org-attach-git instead of org-attach, since this file tests
the GIT-functionality.
* testing/lisp/test-org-attach.el
Add tests for org-attach.
* testing/org-test.el
Define a symbol for a file to test attachments with.
* testing/examples/*
A bunch of new example files and folders are created and are used in
testing of org-attach to verify its functionality.
2018-11-25 15:38:44 -05:00
|
|
|
|
(const :tag "ID parameter" id)
|
|
|
|
|
(const :tag "DIR parameter" dir)
|
|
|
|
|
(const :tag "Ask user" ask)
|
|
|
|
|
(const :tag "Don't create" nil)))
|
2008-10-08 06:46:40 -04:00
|
|
|
|
|
2008-10-07 08:28:21 -04:00
|
|
|
|
(defcustom org-attach-method 'cp
|
2008-10-09 06:19:43 -04:00
|
|
|
|
"The preferred method to attach a file.
|
2008-10-07 08:28:21 -04:00
|
|
|
|
Allowed values are:
|
|
|
|
|
|
|
|
|
|
mv rename the file to move it into the attachment directory
|
|
|
|
|
cp copy the file
|
2008-10-09 06:19:43 -04:00
|
|
|
|
ln create a hard link. Note that this is not supported
|
2012-04-12 14:20:39 -04:00
|
|
|
|
on all systems, and then the result is not defined.
|
|
|
|
|
lns create a symbol link. Note that this is not supported
|
2008-10-09 06:19:43 -04:00
|
|
|
|
on all systems, and then the result is not defined."
|
2008-10-07 08:28:21 -04:00
|
|
|
|
:group 'org-attach
|
|
|
|
|
:type '(choice
|
|
|
|
|
(const :tag "Copy" cp)
|
|
|
|
|
(const :tag "Move/Rename" mv)
|
2012-04-12 14:20:39 -04:00
|
|
|
|
(const :tag "Hard Link" ln)
|
|
|
|
|
(const :tag "Symbol Link" lns)))
|
2008-10-07 08:28:21 -04:00
|
|
|
|
|
2008-10-01 03:25:18 -04:00
|
|
|
|
(defcustom org-attach-expert nil
|
|
|
|
|
"Non-nil means do not show the splash buffer with the attach dispatcher."
|
|
|
|
|
:group 'org-attach
|
|
|
|
|
:type 'boolean)
|
|
|
|
|
|
org-attach*, org, org-manual, org-news, ox-html, testing/*
* lisp/org-attach.el
Changed the way attachments deal with property-inheritance. It now
adheres to the =org-use-property-inheritance= setting by default but
it can be customized if needed (I recommend to enable it!).
The property ATTACH_DIR is deprecated in favour of the shorter and simpler
property DIR.
Added an explicit option to =org-attach= for unsetting
attachment-directories (i.e. remove DIR property and deal with the
attachments by interaction).
Added attachment link type with the prefix "attachment:".
Added customizations:
- org-attach-dir-relative
- org-attach-preferred-new-method
- org-attach-use-inheritance
- org-attach-id-to-path-function
Hooks added:
- org-attach-after-change-hook
- org-attach-open-hook
A new linktype "attachment" is added in order to reduce
link-duplication when wanting to link to files in attached folders of
nodes. This works for both ID and DIR properties. The goal is to
make the functionality for attachment links mirror the functionality
for file links.
* lisp/org-attach-git.el
New file, existing functionality. Code here has been factored out
from org-attach.el and if GIT-functionality is to be used this module
needs to be required sepatately. It extends org-attach by use of its
hooks.
Activating git functionality in org-attach is done by loading
org-attach-git from now on, instead of customizing a variable.
Naming of both functions and tests has been modified to match the move
of functionality into its own module.
* lisp/org.el
Inline images are shown also using attachment-links, exactly the same
as it works for file-links today.
Make org-open-at-point respect ARG when opening attachment-dir.
* lisp/org-compat.el
org-attach-directory has been deprecated in favour for
org-attach-id-dir. The new name matches its purpose better.
* lisp/ox-html.el
Export attachment links to images as inline images, in the same way as
file links work today.
* etc/ORG-NEWS
Mention the changes in this patch.
* doc/org-manual.org
The chapter "Refile, Copy, Archive" has been split into two separate
chapters.
- "Refile, Copy and Archiving" for information related to moving
existing data around.
- "Capture, Attachments, RSS Feeds and Protocols" for information
related to working with external data.
The attachment-part has been rewritten and extended to match the
changes in this patch.
The new attachment link type is mentioned both inside the attachments
chapter and in the chapter dealing with links.
Documentation related to external links has been improved.
* testing/lisp/test-org-attach-annex.el
Require org-attach-git instead of org-attach, since this file tests
the GIT-functionality.
* testing/lisp/test-org-attach.el
Add tests for org-attach.
* testing/org-test.el
Define a symbol for a file to test attachments with.
* testing/examples/*
A bunch of new example files and folders are created and are used in
testing of org-attach to verify its functionality.
2018-11-25 15:38:44 -05:00
|
|
|
|
(defcustom org-attach-use-inheritance 'selective
|
|
|
|
|
"Attachment inheritance for the outline.
|
|
|
|
|
|
2021-09-16 06:32:43 -04:00
|
|
|
|
Enabling inheritance for `org-attach' implies two things. First,
|
org-attach*, org, org-manual, org-news, ox-html, testing/*
* lisp/org-attach.el
Changed the way attachments deal with property-inheritance. It now
adheres to the =org-use-property-inheritance= setting by default but
it can be customized if needed (I recommend to enable it!).
The property ATTACH_DIR is deprecated in favour of the shorter and simpler
property DIR.
Added an explicit option to =org-attach= for unsetting
attachment-directories (i.e. remove DIR property and deal with the
attachments by interaction).
Added attachment link type with the prefix "attachment:".
Added customizations:
- org-attach-dir-relative
- org-attach-preferred-new-method
- org-attach-use-inheritance
- org-attach-id-to-path-function
Hooks added:
- org-attach-after-change-hook
- org-attach-open-hook
A new linktype "attachment" is added in order to reduce
link-duplication when wanting to link to files in attached folders of
nodes. This works for both ID and DIR properties. The goal is to
make the functionality for attachment links mirror the functionality
for file links.
* lisp/org-attach-git.el
New file, existing functionality. Code here has been factored out
from org-attach.el and if GIT-functionality is to be used this module
needs to be required sepatately. It extends org-attach by use of its
hooks.
Activating git functionality in org-attach is done by loading
org-attach-git from now on, instead of customizing a variable.
Naming of both functions and tests has been modified to match the move
of functionality into its own module.
* lisp/org.el
Inline images are shown also using attachment-links, exactly the same
as it works for file-links today.
Make org-open-at-point respect ARG when opening attachment-dir.
* lisp/org-compat.el
org-attach-directory has been deprecated in favour for
org-attach-id-dir. The new name matches its purpose better.
* lisp/ox-html.el
Export attachment links to images as inline images, in the same way as
file links work today.
* etc/ORG-NEWS
Mention the changes in this patch.
* doc/org-manual.org
The chapter "Refile, Copy, Archive" has been split into two separate
chapters.
- "Refile, Copy and Archiving" for information related to moving
existing data around.
- "Capture, Attachments, RSS Feeds and Protocols" for information
related to working with external data.
The attachment-part has been rewritten and extended to match the
changes in this patch.
The new attachment link type is mentioned both inside the attachments
chapter and in the chapter dealing with links.
Documentation related to external links has been improved.
* testing/lisp/test-org-attach-annex.el
Require org-attach-git instead of org-attach, since this file tests
the GIT-functionality.
* testing/lisp/test-org-attach.el
Add tests for org-attach.
* testing/org-test.el
Define a symbol for a file to test attachments with.
* testing/examples/*
A bunch of new example files and folders are created and are used in
testing of org-attach to verify its functionality.
2018-11-25 15:38:44 -05:00
|
|
|
|
that attachment links will look through all parent headings until
|
2021-09-30 16:07:15 -04:00
|
|
|
|
it finds the linked attachment. Second, that running `org-attach'
|
|
|
|
|
inside a node without attachments will make `org-attach' operate on
|
org-attach*, org, org-manual, org-news, ox-html, testing/*
* lisp/org-attach.el
Changed the way attachments deal with property-inheritance. It now
adheres to the =org-use-property-inheritance= setting by default but
it can be customized if needed (I recommend to enable it!).
The property ATTACH_DIR is deprecated in favour of the shorter and simpler
property DIR.
Added an explicit option to =org-attach= for unsetting
attachment-directories (i.e. remove DIR property and deal with the
attachments by interaction).
Added attachment link type with the prefix "attachment:".
Added customizations:
- org-attach-dir-relative
- org-attach-preferred-new-method
- org-attach-use-inheritance
- org-attach-id-to-path-function
Hooks added:
- org-attach-after-change-hook
- org-attach-open-hook
A new linktype "attachment" is added in order to reduce
link-duplication when wanting to link to files in attached folders of
nodes. This works for both ID and DIR properties. The goal is to
make the functionality for attachment links mirror the functionality
for file links.
* lisp/org-attach-git.el
New file, existing functionality. Code here has been factored out
from org-attach.el and if GIT-functionality is to be used this module
needs to be required sepatately. It extends org-attach by use of its
hooks.
Activating git functionality in org-attach is done by loading
org-attach-git from now on, instead of customizing a variable.
Naming of both functions and tests has been modified to match the move
of functionality into its own module.
* lisp/org.el
Inline images are shown also using attachment-links, exactly the same
as it works for file-links today.
Make org-open-at-point respect ARG when opening attachment-dir.
* lisp/org-compat.el
org-attach-directory has been deprecated in favour for
org-attach-id-dir. The new name matches its purpose better.
* lisp/ox-html.el
Export attachment links to images as inline images, in the same way as
file links work today.
* etc/ORG-NEWS
Mention the changes in this patch.
* doc/org-manual.org
The chapter "Refile, Copy, Archive" has been split into two separate
chapters.
- "Refile, Copy and Archiving" for information related to moving
existing data around.
- "Capture, Attachments, RSS Feeds and Protocols" for information
related to working with external data.
The attachment-part has been rewritten and extended to match the
changes in this patch.
The new attachment link type is mentioned both inside the attachments
chapter and in the chapter dealing with links.
Documentation related to external links has been improved.
* testing/lisp/test-org-attach-annex.el
Require org-attach-git instead of org-attach, since this file tests
the GIT-functionality.
* testing/lisp/test-org-attach.el
Add tests for org-attach.
* testing/org-test.el
Define a symbol for a file to test attachments with.
* testing/examples/*
A bunch of new example files and folders are created and are used in
testing of org-attach to verify its functionality.
2018-11-25 15:38:44 -05:00
|
|
|
|
the first parent heading it finds with an attachment.
|
|
|
|
|
|
|
|
|
|
Selective means to respect the inheritance setting in
|
|
|
|
|
`org-use-property-inheritance'."
|
2009-01-19 02:42:38 -05:00
|
|
|
|
:group 'org-attach
|
org-attach*, org, org-manual, org-news, ox-html, testing/*
* lisp/org-attach.el
Changed the way attachments deal with property-inheritance. It now
adheres to the =org-use-property-inheritance= setting by default but
it can be customized if needed (I recommend to enable it!).
The property ATTACH_DIR is deprecated in favour of the shorter and simpler
property DIR.
Added an explicit option to =org-attach= for unsetting
attachment-directories (i.e. remove DIR property and deal with the
attachments by interaction).
Added attachment link type with the prefix "attachment:".
Added customizations:
- org-attach-dir-relative
- org-attach-preferred-new-method
- org-attach-use-inheritance
- org-attach-id-to-path-function
Hooks added:
- org-attach-after-change-hook
- org-attach-open-hook
A new linktype "attachment" is added in order to reduce
link-duplication when wanting to link to files in attached folders of
nodes. This works for both ID and DIR properties. The goal is to
make the functionality for attachment links mirror the functionality
for file links.
* lisp/org-attach-git.el
New file, existing functionality. Code here has been factored out
from org-attach.el and if GIT-functionality is to be used this module
needs to be required sepatately. It extends org-attach by use of its
hooks.
Activating git functionality in org-attach is done by loading
org-attach-git from now on, instead of customizing a variable.
Naming of both functions and tests has been modified to match the move
of functionality into its own module.
* lisp/org.el
Inline images are shown also using attachment-links, exactly the same
as it works for file-links today.
Make org-open-at-point respect ARG when opening attachment-dir.
* lisp/org-compat.el
org-attach-directory has been deprecated in favour for
org-attach-id-dir. The new name matches its purpose better.
* lisp/ox-html.el
Export attachment links to images as inline images, in the same way as
file links work today.
* etc/ORG-NEWS
Mention the changes in this patch.
* doc/org-manual.org
The chapter "Refile, Copy, Archive" has been split into two separate
chapters.
- "Refile, Copy and Archiving" for information related to moving
existing data around.
- "Capture, Attachments, RSS Feeds and Protocols" for information
related to working with external data.
The attachment-part has been rewritten and extended to match the
changes in this patch.
The new attachment link type is mentioned both inside the attachments
chapter and in the chapter dealing with links.
Documentation related to external links has been improved.
* testing/lisp/test-org-attach-annex.el
Require org-attach-git instead of org-attach, since this file tests
the GIT-functionality.
* testing/lisp/test-org-attach.el
Add tests for org-attach.
* testing/org-test.el
Define a symbol for a file to test attachments with.
* testing/examples/*
A bunch of new example files and folders are created and are used in
testing of org-attach to verify its functionality.
2018-11-25 15:38:44 -05:00
|
|
|
|
:type '(choice
|
|
|
|
|
(const :tag "Don't use inheritance" nil)
|
|
|
|
|
(const :tag "Inherit parent node attachments" t)
|
2020-07-08 00:11:34 -04:00
|
|
|
|
(const :tag "Respect org-use-property-inheritance" selective)))
|
2009-06-08 02:00:46 -04:00
|
|
|
|
|
2024-01-20 10:20:20 -05:00
|
|
|
|
(defcustom org-attach-store-link-p 'attached
|
2022-11-04 22:53:37 -04:00
|
|
|
|
"Non-nil means store a link to a file when attaching it.
|
|
|
|
|
When t, store the link to original file location.
|
|
|
|
|
When `file', store link to the attached file location.
|
|
|
|
|
When `attached', store attach: link to the attached file."
|
2011-03-03 05:17:55 -05:00
|
|
|
|
:group 'org-attach
|
2012-03-19 16:38:12 -04:00
|
|
|
|
:version "24.1"
|
2011-03-10 05:18:40 -05:00
|
|
|
|
:type '(choice
|
|
|
|
|
(const :tag "Don't store link" nil)
|
2011-03-10 05:22:33 -05:00
|
|
|
|
(const :tag "Link to origin location" t)
|
2020-01-19 04:29:36 -05:00
|
|
|
|
(const :tag "Attachment link to the attach-dir location" attached)
|
|
|
|
|
(const :tag "File link to the attach-dir location" file)))
|
2011-03-03 05:17:55 -05:00
|
|
|
|
|
2014-10-13 21:51:01 -04:00
|
|
|
|
(defcustom org-attach-archive-delete nil
|
|
|
|
|
"Non-nil means attachments are deleted upon archiving a subtree.
|
|
|
|
|
When set to `query', ask the user instead."
|
|
|
|
|
:group 'org-attach
|
2017-01-25 23:39:18 -05:00
|
|
|
|
:version "26.1"
|
2014-10-13 21:51:01 -04:00
|
|
|
|
:package-version '(Org . "8.3")
|
|
|
|
|
:type '(choice
|
|
|
|
|
(const :tag "Never delete attachments" nil)
|
|
|
|
|
(const :tag "Always delete attachments" t)
|
|
|
|
|
(const :tag "Query the user" query)))
|
|
|
|
|
|
2019-10-19 20:49:48 -04:00
|
|
|
|
(defun org-attach-id-uuid-folder-format (id)
|
|
|
|
|
"Translate an UUID ID into a folder-path.
|
org-attach*, org, org-manual, org-news, ox-html, testing/*
* lisp/org-attach.el
Changed the way attachments deal with property-inheritance. It now
adheres to the =org-use-property-inheritance= setting by default but
it can be customized if needed (I recommend to enable it!).
The property ATTACH_DIR is deprecated in favour of the shorter and simpler
property DIR.
Added an explicit option to =org-attach= for unsetting
attachment-directories (i.e. remove DIR property and deal with the
attachments by interaction).
Added attachment link type with the prefix "attachment:".
Added customizations:
- org-attach-dir-relative
- org-attach-preferred-new-method
- org-attach-use-inheritance
- org-attach-id-to-path-function
Hooks added:
- org-attach-after-change-hook
- org-attach-open-hook
A new linktype "attachment" is added in order to reduce
link-duplication when wanting to link to files in attached folders of
nodes. This works for both ID and DIR properties. The goal is to
make the functionality for attachment links mirror the functionality
for file links.
* lisp/org-attach-git.el
New file, existing functionality. Code here has been factored out
from org-attach.el and if GIT-functionality is to be used this module
needs to be required sepatately. It extends org-attach by use of its
hooks.
Activating git functionality in org-attach is done by loading
org-attach-git from now on, instead of customizing a variable.
Naming of both functions and tests has been modified to match the move
of functionality into its own module.
* lisp/org.el
Inline images are shown also using attachment-links, exactly the same
as it works for file-links today.
Make org-open-at-point respect ARG when opening attachment-dir.
* lisp/org-compat.el
org-attach-directory has been deprecated in favour for
org-attach-id-dir. The new name matches its purpose better.
* lisp/ox-html.el
Export attachment links to images as inline images, in the same way as
file links work today.
* etc/ORG-NEWS
Mention the changes in this patch.
* doc/org-manual.org
The chapter "Refile, Copy, Archive" has been split into two separate
chapters.
- "Refile, Copy and Archiving" for information related to moving
existing data around.
- "Capture, Attachments, RSS Feeds and Protocols" for information
related to working with external data.
The attachment-part has been rewritten and extended to match the
changes in this patch.
The new attachment link type is mentioned both inside the attachments
chapter and in the chapter dealing with links.
Documentation related to external links has been improved.
* testing/lisp/test-org-attach-annex.el
Require org-attach-git instead of org-attach, since this file tests
the GIT-functionality.
* testing/lisp/test-org-attach.el
Add tests for org-attach.
* testing/org-test.el
Define a symbol for a file to test attachments with.
* testing/examples/*
A bunch of new example files and folders are created and are used in
testing of org-attach to verify its functionality.
2018-11-25 15:38:44 -05:00
|
|
|
|
Default format for how Org translates ID properties to a path for
|
2019-10-19 20:49:48 -04:00
|
|
|
|
attachments. Useful if ID is generated with UUID."
|
2022-11-07 11:48:02 -05:00
|
|
|
|
(and (< 2 (length id))
|
|
|
|
|
(format "%s/%s"
|
|
|
|
|
(substring id 0 2)
|
|
|
|
|
(substring id 2))))
|
org-attach*, org, org-manual, org-news, ox-html, testing/*
* lisp/org-attach.el
Changed the way attachments deal with property-inheritance. It now
adheres to the =org-use-property-inheritance= setting by default but
it can be customized if needed (I recommend to enable it!).
The property ATTACH_DIR is deprecated in favour of the shorter and simpler
property DIR.
Added an explicit option to =org-attach= for unsetting
attachment-directories (i.e. remove DIR property and deal with the
attachments by interaction).
Added attachment link type with the prefix "attachment:".
Added customizations:
- org-attach-dir-relative
- org-attach-preferred-new-method
- org-attach-use-inheritance
- org-attach-id-to-path-function
Hooks added:
- org-attach-after-change-hook
- org-attach-open-hook
A new linktype "attachment" is added in order to reduce
link-duplication when wanting to link to files in attached folders of
nodes. This works for both ID and DIR properties. The goal is to
make the functionality for attachment links mirror the functionality
for file links.
* lisp/org-attach-git.el
New file, existing functionality. Code here has been factored out
from org-attach.el and if GIT-functionality is to be used this module
needs to be required sepatately. It extends org-attach by use of its
hooks.
Activating git functionality in org-attach is done by loading
org-attach-git from now on, instead of customizing a variable.
Naming of both functions and tests has been modified to match the move
of functionality into its own module.
* lisp/org.el
Inline images are shown also using attachment-links, exactly the same
as it works for file-links today.
Make org-open-at-point respect ARG when opening attachment-dir.
* lisp/org-compat.el
org-attach-directory has been deprecated in favour for
org-attach-id-dir. The new name matches its purpose better.
* lisp/ox-html.el
Export attachment links to images as inline images, in the same way as
file links work today.
* etc/ORG-NEWS
Mention the changes in this patch.
* doc/org-manual.org
The chapter "Refile, Copy, Archive" has been split into two separate
chapters.
- "Refile, Copy and Archiving" for information related to moving
existing data around.
- "Capture, Attachments, RSS Feeds and Protocols" for information
related to working with external data.
The attachment-part has been rewritten and extended to match the
changes in this patch.
The new attachment link type is mentioned both inside the attachments
chapter and in the chapter dealing with links.
Documentation related to external links has been improved.
* testing/lisp/test-org-attach-annex.el
Require org-attach-git instead of org-attach, since this file tests
the GIT-functionality.
* testing/lisp/test-org-attach.el
Add tests for org-attach.
* testing/org-test.el
Define a symbol for a file to test attachments with.
* testing/examples/*
A bunch of new example files and folders are created and are used in
testing of org-attach to verify its functionality.
2018-11-25 15:38:44 -05:00
|
|
|
|
|
2019-10-19 20:49:48 -04:00
|
|
|
|
(defun org-attach-id-ts-folder-format (id)
|
|
|
|
|
"Translate an ID based on a timestamp to a folder-path.
|
|
|
|
|
Useful way of translation if ID is generated based on ISO8601
|
|
|
|
|
timestamp. Splits the attachment folder hierarchy into
|
|
|
|
|
year-month, the rest."
|
2022-11-07 11:48:02 -05:00
|
|
|
|
(and (< 6 (length id))
|
|
|
|
|
(format "%s/%s"
|
|
|
|
|
(substring id 0 6)
|
|
|
|
|
(substring id 6))))
|
|
|
|
|
|
|
|
|
|
(defun org-attach-id-fallback-folder-format (id)
|
|
|
|
|
"Return \"__/X/ID\" folder path as a dumb fallback.
|
|
|
|
|
X is the first character in the ID string.
|
|
|
|
|
|
|
|
|
|
This function may be appended to `org-attach-id-path-function-list' to
|
|
|
|
|
provide a fallback for non-standard ID values that other functions in
|
|
|
|
|
`org-attach-id-path-function-list' are unable to handle. For example,
|
|
|
|
|
when the ID is too short for `org-attach-id-ts-folder-format'.
|
|
|
|
|
|
|
|
|
|
However, we recommend to define a more specific function spreading
|
|
|
|
|
entries over multiple folders. This function may create a large
|
|
|
|
|
number of entries in a single folder, which may cause issues on some
|
|
|
|
|
systems."
|
|
|
|
|
(format "__/%s/%s" (substring id 0 1) id))
|
|
|
|
|
|
|
|
|
|
(defcustom org-attach-id-to-path-function-list
|
|
|
|
|
'(org-attach-id-uuid-folder-format
|
|
|
|
|
org-attach-id-ts-folder-format
|
|
|
|
|
org-attach-id-fallback-folder-format)
|
|
|
|
|
"List of functions used to derive attachment path from an ID string.
|
|
|
|
|
The functions are called with a single ID argument until the return
|
|
|
|
|
value is an existing folder. If no folder has been created yet for
|
|
|
|
|
the given ID, then the first non-nil value defines the attachment
|
|
|
|
|
dir to be created.
|
|
|
|
|
|
|
|
|
|
Usually, the ID format passed to the functions is defined by
|
|
|
|
|
`org-id-method'. It is advised that the first function in the list do
|
|
|
|
|
not generate all the attachment dirs inside the same parent dir. Some
|
|
|
|
|
file systems may have performance issues in such scenario.
|
|
|
|
|
|
|
|
|
|
Care should be taken when customizing this variable. Previously
|
|
|
|
|
created attachment folders might not be correctly mapped upon removing
|
|
|
|
|
functions from the list. Then, Org will not be able to detect the
|
|
|
|
|
existing attachments."
|
2016-02-06 07:16:52 -05:00
|
|
|
|
:group 'org-attach
|
2022-11-07 11:48:02 -05:00
|
|
|
|
:package-version '(Org . "9.6")
|
2019-10-19 20:49:48 -04:00
|
|
|
|
:type '(repeat (function :tag "Function with ID as input")))
|
org-attach*, org, org-manual, org-news, ox-html, testing/*
* lisp/org-attach.el
Changed the way attachments deal with property-inheritance. It now
adheres to the =org-use-property-inheritance= setting by default but
it can be customized if needed (I recommend to enable it!).
The property ATTACH_DIR is deprecated in favour of the shorter and simpler
property DIR.
Added an explicit option to =org-attach= for unsetting
attachment-directories (i.e. remove DIR property and deal with the
attachments by interaction).
Added attachment link type with the prefix "attachment:".
Added customizations:
- org-attach-dir-relative
- org-attach-preferred-new-method
- org-attach-use-inheritance
- org-attach-id-to-path-function
Hooks added:
- org-attach-after-change-hook
- org-attach-open-hook
A new linktype "attachment" is added in order to reduce
link-duplication when wanting to link to files in attached folders of
nodes. This works for both ID and DIR properties. The goal is to
make the functionality for attachment links mirror the functionality
for file links.
* lisp/org-attach-git.el
New file, existing functionality. Code here has been factored out
from org-attach.el and if GIT-functionality is to be used this module
needs to be required sepatately. It extends org-attach by use of its
hooks.
Activating git functionality in org-attach is done by loading
org-attach-git from now on, instead of customizing a variable.
Naming of both functions and tests has been modified to match the move
of functionality into its own module.
* lisp/org.el
Inline images are shown also using attachment-links, exactly the same
as it works for file-links today.
Make org-open-at-point respect ARG when opening attachment-dir.
* lisp/org-compat.el
org-attach-directory has been deprecated in favour for
org-attach-id-dir. The new name matches its purpose better.
* lisp/ox-html.el
Export attachment links to images as inline images, in the same way as
file links work today.
* etc/ORG-NEWS
Mention the changes in this patch.
* doc/org-manual.org
The chapter "Refile, Copy, Archive" has been split into two separate
chapters.
- "Refile, Copy and Archiving" for information related to moving
existing data around.
- "Capture, Attachments, RSS Feeds and Protocols" for information
related to working with external data.
The attachment-part has been rewritten and extended to match the
changes in this patch.
The new attachment link type is mentioned both inside the attachments
chapter and in the chapter dealing with links.
Documentation related to external links has been improved.
* testing/lisp/test-org-attach-annex.el
Require org-attach-git instead of org-attach, since this file tests
the GIT-functionality.
* testing/lisp/test-org-attach.el
Add tests for org-attach.
* testing/org-test.el
Define a symbol for a file to test attachments with.
* testing/examples/*
A bunch of new example files and folders are created and are used in
testing of org-attach to verify its functionality.
2018-11-25 15:38:44 -05:00
|
|
|
|
|
|
|
|
|
(defvar org-attach-after-change-hook nil
|
2020-12-19 11:35:50 -05:00
|
|
|
|
"Hook called when files have been added or removed to the attachment folder.")
|
org-attach*, org, org-manual, org-news, ox-html, testing/*
* lisp/org-attach.el
Changed the way attachments deal with property-inheritance. It now
adheres to the =org-use-property-inheritance= setting by default but
it can be customized if needed (I recommend to enable it!).
The property ATTACH_DIR is deprecated in favour of the shorter and simpler
property DIR.
Added an explicit option to =org-attach= for unsetting
attachment-directories (i.e. remove DIR property and deal with the
attachments by interaction).
Added attachment link type with the prefix "attachment:".
Added customizations:
- org-attach-dir-relative
- org-attach-preferred-new-method
- org-attach-use-inheritance
- org-attach-id-to-path-function
Hooks added:
- org-attach-after-change-hook
- org-attach-open-hook
A new linktype "attachment" is added in order to reduce
link-duplication when wanting to link to files in attached folders of
nodes. This works for both ID and DIR properties. The goal is to
make the functionality for attachment links mirror the functionality
for file links.
* lisp/org-attach-git.el
New file, existing functionality. Code here has been factored out
from org-attach.el and if GIT-functionality is to be used this module
needs to be required sepatately. It extends org-attach by use of its
hooks.
Activating git functionality in org-attach is done by loading
org-attach-git from now on, instead of customizing a variable.
Naming of both functions and tests has been modified to match the move
of functionality into its own module.
* lisp/org.el
Inline images are shown also using attachment-links, exactly the same
as it works for file-links today.
Make org-open-at-point respect ARG when opening attachment-dir.
* lisp/org-compat.el
org-attach-directory has been deprecated in favour for
org-attach-id-dir. The new name matches its purpose better.
* lisp/ox-html.el
Export attachment links to images as inline images, in the same way as
file links work today.
* etc/ORG-NEWS
Mention the changes in this patch.
* doc/org-manual.org
The chapter "Refile, Copy, Archive" has been split into two separate
chapters.
- "Refile, Copy and Archiving" for information related to moving
existing data around.
- "Capture, Attachments, RSS Feeds and Protocols" for information
related to working with external data.
The attachment-part has been rewritten and extended to match the
changes in this patch.
The new attachment link type is mentioned both inside the attachments
chapter and in the chapter dealing with links.
Documentation related to external links has been improved.
* testing/lisp/test-org-attach-annex.el
Require org-attach-git instead of org-attach, since this file tests
the GIT-functionality.
* testing/lisp/test-org-attach.el
Add tests for org-attach.
* testing/org-test.el
Define a symbol for a file to test attachments with.
* testing/examples/*
A bunch of new example files and folders are created and are used in
testing of org-attach to verify its functionality.
2018-11-25 15:38:44 -05:00
|
|
|
|
|
|
|
|
|
(defvar org-attach-open-hook nil
|
|
|
|
|
"Hook that is invoked by `org-attach-open'.
|
|
|
|
|
|
|
|
|
|
Created mostly to be compatible with org-attach-git after removing
|
2019-12-10 23:04:36 -05:00
|
|
|
|
git-functionality from this file.")
|
2016-02-06 07:16:52 -05:00
|
|
|
|
|
2019-04-26 15:21:00 -04:00
|
|
|
|
(defcustom org-attach-commands
|
|
|
|
|
'(((?a ?\C-a) org-attach-attach
|
|
|
|
|
"Select a file and attach it to the task, using `org-attach-method'.")
|
|
|
|
|
((?c ?\C-c) org-attach-attach-cp
|
|
|
|
|
"Attach a file using copy method.")
|
|
|
|
|
((?m ?\C-m) org-attach-attach-mv
|
|
|
|
|
"Attach a file using move method.")
|
|
|
|
|
((?l ?\C-l) org-attach-attach-ln
|
|
|
|
|
"Attach a file using link method.")
|
|
|
|
|
((?y ?\C-y) org-attach-attach-lns
|
|
|
|
|
"Attach a file using symbolic-link method.")
|
|
|
|
|
((?u ?\C-u) org-attach-url
|
|
|
|
|
"Attach a file from URL (downloading it).")
|
|
|
|
|
((?b) org-attach-buffer
|
|
|
|
|
"Select a buffer and attach its contents to the task.")
|
|
|
|
|
((?n ?\C-n) org-attach-new
|
|
|
|
|
"Create a new attachment, as an Emacs buffer.")
|
|
|
|
|
((?z ?\C-z) org-attach-sync
|
2019-09-01 08:43:54 -04:00
|
|
|
|
"Synchronize the current node with its attachment\n directory, in case \
|
2019-04-26 15:21:00 -04:00
|
|
|
|
you added attachments yourself.\n")
|
|
|
|
|
((?o ?\C-o) org-attach-open
|
2019-09-01 08:43:54 -04:00
|
|
|
|
"Open current node's attachments.")
|
2019-04-26 15:21:00 -04:00
|
|
|
|
((?O) org-attach-open-in-emacs
|
|
|
|
|
"Like \"o\", but force opening in Emacs.")
|
|
|
|
|
((?f ?\C-f) org-attach-reveal
|
2019-09-02 17:15:13 -04:00
|
|
|
|
"Open current node's attachment directory. Create if missing.")
|
2019-04-26 15:21:00 -04:00
|
|
|
|
((?F) org-attach-reveal-in-emacs
|
|
|
|
|
"Like \"f\", but force using Dired in Emacs.\n")
|
|
|
|
|
((?d ?\C-d) org-attach-delete-one
|
|
|
|
|
"Delete one attachment, you will be prompted for a file name.")
|
|
|
|
|
((?D) org-attach-delete-all
|
2019-09-01 08:43:54 -04:00
|
|
|
|
"Delete all of a node's attachments. A safer way is\n to open the \
|
2019-04-26 15:21:00 -04:00
|
|
|
|
directory in dired and delete from there.\n")
|
|
|
|
|
((?s ?\C-s) org-attach-set-directory
|
org-attach*, org, org-manual, org-news, ox-html, testing/*
* lisp/org-attach.el
Changed the way attachments deal with property-inheritance. It now
adheres to the =org-use-property-inheritance= setting by default but
it can be customized if needed (I recommend to enable it!).
The property ATTACH_DIR is deprecated in favour of the shorter and simpler
property DIR.
Added an explicit option to =org-attach= for unsetting
attachment-directories (i.e. remove DIR property and deal with the
attachments by interaction).
Added attachment link type with the prefix "attachment:".
Added customizations:
- org-attach-dir-relative
- org-attach-preferred-new-method
- org-attach-use-inheritance
- org-attach-id-to-path-function
Hooks added:
- org-attach-after-change-hook
- org-attach-open-hook
A new linktype "attachment" is added in order to reduce
link-duplication when wanting to link to files in attached folders of
nodes. This works for both ID and DIR properties. The goal is to
make the functionality for attachment links mirror the functionality
for file links.
* lisp/org-attach-git.el
New file, existing functionality. Code here has been factored out
from org-attach.el and if GIT-functionality is to be used this module
needs to be required sepatately. It extends org-attach by use of its
hooks.
Activating git functionality in org-attach is done by loading
org-attach-git from now on, instead of customizing a variable.
Naming of both functions and tests has been modified to match the move
of functionality into its own module.
* lisp/org.el
Inline images are shown also using attachment-links, exactly the same
as it works for file-links today.
Make org-open-at-point respect ARG when opening attachment-dir.
* lisp/org-compat.el
org-attach-directory has been deprecated in favour for
org-attach-id-dir. The new name matches its purpose better.
* lisp/ox-html.el
Export attachment links to images as inline images, in the same way as
file links work today.
* etc/ORG-NEWS
Mention the changes in this patch.
* doc/org-manual.org
The chapter "Refile, Copy, Archive" has been split into two separate
chapters.
- "Refile, Copy and Archiving" for information related to moving
existing data around.
- "Capture, Attachments, RSS Feeds and Protocols" for information
related to working with external data.
The attachment-part has been rewritten and extended to match the
changes in this patch.
The new attachment link type is mentioned both inside the attachments
chapter and in the chapter dealing with links.
Documentation related to external links has been improved.
* testing/lisp/test-org-attach-annex.el
Require org-attach-git instead of org-attach, since this file tests
the GIT-functionality.
* testing/lisp/test-org-attach.el
Add tests for org-attach.
* testing/org-test.el
Define a symbol for a file to test attachments with.
* testing/examples/*
A bunch of new example files and folders are created and are used in
testing of org-attach to verify its functionality.
2018-11-25 15:38:44 -05:00
|
|
|
|
"Set a specific attachment directory for this entry. Sets DIR property.")
|
|
|
|
|
((?S ?\C-S) org-attach-unset-directory
|
|
|
|
|
"Unset the attachment directory for this entry. Removes DIR property.")
|
2019-04-26 15:21:00 -04:00
|
|
|
|
((?q) (lambda () (interactive) (message "Abort")) "Abort."))
|
|
|
|
|
"The list of commands for the attachment dispatcher.
|
|
|
|
|
Each entry in this list is a list of three elements:
|
|
|
|
|
- A list of keys (characters) to select the command (the fist
|
|
|
|
|
character in the list is shown in the attachment dispatcher's
|
2019-12-10 23:04:36 -05:00
|
|
|
|
splash buffer and minibuffer prompt).
|
2019-04-26 15:21:00 -04:00
|
|
|
|
- A command that is called interactively when one of these keys
|
|
|
|
|
is pressed.
|
|
|
|
|
- A docstring for this command in the attachment dispatcher's
|
|
|
|
|
splash buffer."
|
|
|
|
|
:group 'org-attach
|
|
|
|
|
:package-version '(Org . "9.3")
|
|
|
|
|
:type '(repeat (list (repeat :tag "Keys" character)
|
|
|
|
|
(function :tag "Command")
|
|
|
|
|
(string :tag "Docstring"))))
|
|
|
|
|
|
2021-07-09 15:03:44 -04:00
|
|
|
|
(defcustom org-attach-sync-delete-empty-dir 'query
|
|
|
|
|
"Determine what to do with an empty attachment directory on sync.
|
|
|
|
|
When set to nil, don't touch the directory. When set to `query',
|
|
|
|
|
ask the user instead, else remove without asking."
|
|
|
|
|
:group 'org-attach
|
|
|
|
|
:package-version '(Org . "9.5")
|
|
|
|
|
:type '(choice
|
|
|
|
|
(const :tag "Never delete" nil)
|
|
|
|
|
(const :tag "Always delete" t)
|
|
|
|
|
(const :tag "Query the user" query)))
|
|
|
|
|
|
2008-10-01 03:25:18 -04:00
|
|
|
|
;;;###autoload
|
|
|
|
|
(defun org-attach ()
|
|
|
|
|
"The dispatcher for attachment commands.
|
|
|
|
|
Shows a list of commands and prompts for another key to execute a command."
|
|
|
|
|
(interactive)
|
2023-08-18 06:24:13 -04:00
|
|
|
|
(let (c marker)
|
2008-10-01 03:25:18 -04:00
|
|
|
|
(when (eq major-mode 'org-agenda-mode)
|
|
|
|
|
(setq marker (or (get-text-property (point) 'org-hd-marker)
|
|
|
|
|
(get-text-property (point) 'org-marker)))
|
|
|
|
|
(unless marker
|
org-attach*, org, org-manual, org-news, ox-html, testing/*
* lisp/org-attach.el
Changed the way attachments deal with property-inheritance. It now
adheres to the =org-use-property-inheritance= setting by default but
it can be customized if needed (I recommend to enable it!).
The property ATTACH_DIR is deprecated in favour of the shorter and simpler
property DIR.
Added an explicit option to =org-attach= for unsetting
attachment-directories (i.e. remove DIR property and deal with the
attachments by interaction).
Added attachment link type with the prefix "attachment:".
Added customizations:
- org-attach-dir-relative
- org-attach-preferred-new-method
- org-attach-use-inheritance
- org-attach-id-to-path-function
Hooks added:
- org-attach-after-change-hook
- org-attach-open-hook
A new linktype "attachment" is added in order to reduce
link-duplication when wanting to link to files in attached folders of
nodes. This works for both ID and DIR properties. The goal is to
make the functionality for attachment links mirror the functionality
for file links.
* lisp/org-attach-git.el
New file, existing functionality. Code here has been factored out
from org-attach.el and if GIT-functionality is to be used this module
needs to be required sepatately. It extends org-attach by use of its
hooks.
Activating git functionality in org-attach is done by loading
org-attach-git from now on, instead of customizing a variable.
Naming of both functions and tests has been modified to match the move
of functionality into its own module.
* lisp/org.el
Inline images are shown also using attachment-links, exactly the same
as it works for file-links today.
Make org-open-at-point respect ARG when opening attachment-dir.
* lisp/org-compat.el
org-attach-directory has been deprecated in favour for
org-attach-id-dir. The new name matches its purpose better.
* lisp/ox-html.el
Export attachment links to images as inline images, in the same way as
file links work today.
* etc/ORG-NEWS
Mention the changes in this patch.
* doc/org-manual.org
The chapter "Refile, Copy, Archive" has been split into two separate
chapters.
- "Refile, Copy and Archiving" for information related to moving
existing data around.
- "Capture, Attachments, RSS Feeds and Protocols" for information
related to working with external data.
The attachment-part has been rewritten and extended to match the
changes in this patch.
The new attachment link type is mentioned both inside the attachments
chapter and in the chapter dealing with links.
Documentation related to external links has been improved.
* testing/lisp/test-org-attach-annex.el
Require org-attach-git instead of org-attach, since this file tests
the GIT-functionality.
* testing/lisp/test-org-attach.el
Add tests for org-attach.
* testing/org-test.el
Define a symbol for a file to test attachments with.
* testing/examples/*
A bunch of new example files and folders are created and are used in
testing of org-attach to verify its functionality.
2018-11-25 15:38:44 -05:00
|
|
|
|
(error "No item in current line")))
|
2019-12-15 13:08:07 -05:00
|
|
|
|
(org-with-point-at marker
|
2023-08-18 06:24:13 -04:00
|
|
|
|
(let ((dir (org-attach-dir nil 'no-fs-check)))
|
2020-12-17 01:03:30 -05:00
|
|
|
|
(if (and (featurep 'org-inlinetask)
|
2023-08-18 06:24:13 -04:00
|
|
|
|
(not (org-inlinetask-in-task-p)))
|
|
|
|
|
(org-with-limited-levels
|
|
|
|
|
(org-back-to-heading-or-point-min t))
|
|
|
|
|
(if (and (featurep 'org-inlinetask)
|
|
|
|
|
(org-inlinetask-in-task-p))
|
|
|
|
|
(org-inlinetask-goto-beginning)
|
|
|
|
|
(org-back-to-heading-or-point-min t)))
|
|
|
|
|
(save-excursion
|
|
|
|
|
(save-window-excursion
|
|
|
|
|
(unless org-attach-expert
|
2024-01-24 08:54:30 -05:00
|
|
|
|
(switch-to-buffer-other-window "*Org Attach*")
|
2023-08-18 06:24:13 -04:00
|
|
|
|
(erase-buffer)
|
|
|
|
|
(setq cursor-type nil
|
|
|
|
|
header-line-format "Use C-v, M-v, C-n or C-p to navigate.")
|
|
|
|
|
(insert
|
|
|
|
|
(concat "Attachment folder:\n"
|
|
|
|
|
(or dir
|
|
|
|
|
"Can't find an existing attachment-folder")
|
|
|
|
|
(unless (and dir (file-directory-p dir))
|
|
|
|
|
"\n(Not yet created)")
|
|
|
|
|
"\n\n"
|
|
|
|
|
(format "Select an Attachment Command:\n\n%s"
|
|
|
|
|
(mapconcat
|
|
|
|
|
(lambda (entry)
|
|
|
|
|
(pcase entry
|
|
|
|
|
(`((,key . ,_) ,_ ,docstring)
|
|
|
|
|
(format "%c %s"
|
|
|
|
|
key
|
|
|
|
|
(replace-regexp-in-string "\n\\([\t ]*\\)"
|
|
|
|
|
" "
|
|
|
|
|
docstring
|
|
|
|
|
nil nil 1)))
|
|
|
|
|
(_
|
|
|
|
|
(user-error
|
|
|
|
|
"Invalid `org-attach-commands' item: %S"
|
|
|
|
|
entry))))
|
|
|
|
|
org-attach-commands
|
|
|
|
|
"\n"))))
|
|
|
|
|
(goto-char (point-min)))
|
|
|
|
|
(org-fit-window-to-buffer (get-buffer-window "*Org Attach*"))
|
|
|
|
|
(let ((msg (format "Select command: [%s]"
|
|
|
|
|
(concat (mapcar #'caar org-attach-commands)))))
|
|
|
|
|
(message msg)
|
|
|
|
|
(while (and (setq c (read-char-exclusive))
|
|
|
|
|
(memq c '(?\C-n ?\C-p ?\C-v ?\M-v)))
|
|
|
|
|
(org-scroll c t)))
|
|
|
|
|
(and (get-buffer "*Org Attach*") (kill-buffer "*Org Attach*"))))
|
|
|
|
|
(let ((command (cl-some (lambda (entry)
|
|
|
|
|
(and (memq c (nth 0 entry)) (nth 1 entry)))
|
|
|
|
|
org-attach-commands)))
|
|
|
|
|
(if (commandp command)
|
|
|
|
|
(command-execute command)
|
|
|
|
|
(error "No such attachment command: %c" c)))))))
|
2008-10-01 03:25:18 -04:00
|
|
|
|
|
2022-06-10 03:01:37 -04:00
|
|
|
|
;;;###autoload
|
2019-09-02 17:15:13 -04:00
|
|
|
|
(defun org-attach-dir (&optional create-if-not-exists-p no-fs-check)
|
org-attach*, org, org-manual, org-news, ox-html, testing/*
* lisp/org-attach.el
Changed the way attachments deal with property-inheritance. It now
adheres to the =org-use-property-inheritance= setting by default but
it can be customized if needed (I recommend to enable it!).
The property ATTACH_DIR is deprecated in favour of the shorter and simpler
property DIR.
Added an explicit option to =org-attach= for unsetting
attachment-directories (i.e. remove DIR property and deal with the
attachments by interaction).
Added attachment link type with the prefix "attachment:".
Added customizations:
- org-attach-dir-relative
- org-attach-preferred-new-method
- org-attach-use-inheritance
- org-attach-id-to-path-function
Hooks added:
- org-attach-after-change-hook
- org-attach-open-hook
A new linktype "attachment" is added in order to reduce
link-duplication when wanting to link to files in attached folders of
nodes. This works for both ID and DIR properties. The goal is to
make the functionality for attachment links mirror the functionality
for file links.
* lisp/org-attach-git.el
New file, existing functionality. Code here has been factored out
from org-attach.el and if GIT-functionality is to be used this module
needs to be required sepatately. It extends org-attach by use of its
hooks.
Activating git functionality in org-attach is done by loading
org-attach-git from now on, instead of customizing a variable.
Naming of both functions and tests has been modified to match the move
of functionality into its own module.
* lisp/org.el
Inline images are shown also using attachment-links, exactly the same
as it works for file-links today.
Make org-open-at-point respect ARG when opening attachment-dir.
* lisp/org-compat.el
org-attach-directory has been deprecated in favour for
org-attach-id-dir. The new name matches its purpose better.
* lisp/ox-html.el
Export attachment links to images as inline images, in the same way as
file links work today.
* etc/ORG-NEWS
Mention the changes in this patch.
* doc/org-manual.org
The chapter "Refile, Copy, Archive" has been split into two separate
chapters.
- "Refile, Copy and Archiving" for information related to moving
existing data around.
- "Capture, Attachments, RSS Feeds and Protocols" for information
related to working with external data.
The attachment-part has been rewritten and extended to match the
changes in this patch.
The new attachment link type is mentioned both inside the attachments
chapter and in the chapter dealing with links.
Documentation related to external links has been improved.
* testing/lisp/test-org-attach-annex.el
Require org-attach-git instead of org-attach, since this file tests
the GIT-functionality.
* testing/lisp/test-org-attach.el
Add tests for org-attach.
* testing/org-test.el
Define a symbol for a file to test attachments with.
* testing/examples/*
A bunch of new example files and folders are created and are used in
testing of org-attach to verify its functionality.
2018-11-25 15:38:44 -05:00
|
|
|
|
"Return the directory associated with the current outline node.
|
|
|
|
|
First check for DIR property, then ID property.
|
|
|
|
|
`org-attach-use-inheritance' determines whether inherited
|
|
|
|
|
properties also will be considered.
|
|
|
|
|
|
|
|
|
|
If an ID property is found the default mechanism using that ID
|
|
|
|
|
will be invoked to access the directory for the current entry.
|
2019-09-01 08:43:54 -04:00
|
|
|
|
Note that this method returns the directory as declared by ID or
|
|
|
|
|
DIR even if the directory doesn't exist in the filesystem.
|
org-attach*, org, org-manual, org-news, ox-html, testing/*
* lisp/org-attach.el
Changed the way attachments deal with property-inheritance. It now
adheres to the =org-use-property-inheritance= setting by default but
it can be customized if needed (I recommend to enable it!).
The property ATTACH_DIR is deprecated in favour of the shorter and simpler
property DIR.
Added an explicit option to =org-attach= for unsetting
attachment-directories (i.e. remove DIR property and deal with the
attachments by interaction).
Added attachment link type with the prefix "attachment:".
Added customizations:
- org-attach-dir-relative
- org-attach-preferred-new-method
- org-attach-use-inheritance
- org-attach-id-to-path-function
Hooks added:
- org-attach-after-change-hook
- org-attach-open-hook
A new linktype "attachment" is added in order to reduce
link-duplication when wanting to link to files in attached folders of
nodes. This works for both ID and DIR properties. The goal is to
make the functionality for attachment links mirror the functionality
for file links.
* lisp/org-attach-git.el
New file, existing functionality. Code here has been factored out
from org-attach.el and if GIT-functionality is to be used this module
needs to be required sepatately. It extends org-attach by use of its
hooks.
Activating git functionality in org-attach is done by loading
org-attach-git from now on, instead of customizing a variable.
Naming of both functions and tests has been modified to match the move
of functionality into its own module.
* lisp/org.el
Inline images are shown also using attachment-links, exactly the same
as it works for file-links today.
Make org-open-at-point respect ARG when opening attachment-dir.
* lisp/org-compat.el
org-attach-directory has been deprecated in favour for
org-attach-id-dir. The new name matches its purpose better.
* lisp/ox-html.el
Export attachment links to images as inline images, in the same way as
file links work today.
* etc/ORG-NEWS
Mention the changes in this patch.
* doc/org-manual.org
The chapter "Refile, Copy, Archive" has been split into two separate
chapters.
- "Refile, Copy and Archiving" for information related to moving
existing data around.
- "Capture, Attachments, RSS Feeds and Protocols" for information
related to working with external data.
The attachment-part has been rewritten and extended to match the
changes in this patch.
The new attachment link type is mentioned both inside the attachments
chapter and in the chapter dealing with links.
Documentation related to external links has been improved.
* testing/lisp/test-org-attach-annex.el
Require org-attach-git instead of org-attach, since this file tests
the GIT-functionality.
* testing/lisp/test-org-attach.el
Add tests for org-attach.
* testing/org-test.el
Define a symbol for a file to test attachments with.
* testing/examples/*
A bunch of new example files and folders are created and are used in
testing of org-attach to verify its functionality.
2018-11-25 15:38:44 -05:00
|
|
|
|
|
2021-09-30 16:07:15 -04:00
|
|
|
|
If CREATE-IF-NOT-EXISTS-P is non-nil, `org-attach-dir-get-create'
|
2019-09-02 17:15:13 -04:00
|
|
|
|
is run. If NO-FS-CHECK is non-nil, the function returns the path
|
|
|
|
|
to the attachment even if it has not yet been initialized in the
|
|
|
|
|
filesystem.
|
2019-09-01 08:43:54 -04:00
|
|
|
|
|
2019-10-19 20:49:48 -04:00
|
|
|
|
If no attachment directory can be derived, return nil."
|
org-attach*, org, org-manual, org-news, ox-html, testing/*
* lisp/org-attach.el
Changed the way attachments deal with property-inheritance. It now
adheres to the =org-use-property-inheritance= setting by default but
it can be customized if needed (I recommend to enable it!).
The property ATTACH_DIR is deprecated in favour of the shorter and simpler
property DIR.
Added an explicit option to =org-attach= for unsetting
attachment-directories (i.e. remove DIR property and deal with the
attachments by interaction).
Added attachment link type with the prefix "attachment:".
Added customizations:
- org-attach-dir-relative
- org-attach-preferred-new-method
- org-attach-use-inheritance
- org-attach-id-to-path-function
Hooks added:
- org-attach-after-change-hook
- org-attach-open-hook
A new linktype "attachment" is added in order to reduce
link-duplication when wanting to link to files in attached folders of
nodes. This works for both ID and DIR properties. The goal is to
make the functionality for attachment links mirror the functionality
for file links.
* lisp/org-attach-git.el
New file, existing functionality. Code here has been factored out
from org-attach.el and if GIT-functionality is to be used this module
needs to be required sepatately. It extends org-attach by use of its
hooks.
Activating git functionality in org-attach is done by loading
org-attach-git from now on, instead of customizing a variable.
Naming of both functions and tests has been modified to match the move
of functionality into its own module.
* lisp/org.el
Inline images are shown also using attachment-links, exactly the same
as it works for file-links today.
Make org-open-at-point respect ARG when opening attachment-dir.
* lisp/org-compat.el
org-attach-directory has been deprecated in favour for
org-attach-id-dir. The new name matches its purpose better.
* lisp/ox-html.el
Export attachment links to images as inline images, in the same way as
file links work today.
* etc/ORG-NEWS
Mention the changes in this patch.
* doc/org-manual.org
The chapter "Refile, Copy, Archive" has been split into two separate
chapters.
- "Refile, Copy and Archiving" for information related to moving
existing data around.
- "Capture, Attachments, RSS Feeds and Protocols" for information
related to working with external data.
The attachment-part has been rewritten and extended to match the
changes in this patch.
The new attachment link type is mentioned both inside the attachments
chapter and in the chapter dealing with links.
Documentation related to external links has been improved.
* testing/lisp/test-org-attach-annex.el
Require org-attach-git instead of org-attach, since this file tests
the GIT-functionality.
* testing/lisp/test-org-attach.el
Add tests for org-attach.
* testing/org-test.el
Define a symbol for a file to test attachments with.
* testing/examples/*
A bunch of new example files and folders are created and are used in
testing of org-attach to verify its functionality.
2018-11-25 15:38:44 -05:00
|
|
|
|
(let (attach-dir id)
|
2009-01-19 02:42:38 -05:00
|
|
|
|
(cond
|
org-attach*, org, org-manual, org-news, ox-html, testing/*
* lisp/org-attach.el
Changed the way attachments deal with property-inheritance. It now
adheres to the =org-use-property-inheritance= setting by default but
it can be customized if needed (I recommend to enable it!).
The property ATTACH_DIR is deprecated in favour of the shorter and simpler
property DIR.
Added an explicit option to =org-attach= for unsetting
attachment-directories (i.e. remove DIR property and deal with the
attachments by interaction).
Added attachment link type with the prefix "attachment:".
Added customizations:
- org-attach-dir-relative
- org-attach-preferred-new-method
- org-attach-use-inheritance
- org-attach-id-to-path-function
Hooks added:
- org-attach-after-change-hook
- org-attach-open-hook
A new linktype "attachment" is added in order to reduce
link-duplication when wanting to link to files in attached folders of
nodes. This works for both ID and DIR properties. The goal is to
make the functionality for attachment links mirror the functionality
for file links.
* lisp/org-attach-git.el
New file, existing functionality. Code here has been factored out
from org-attach.el and if GIT-functionality is to be used this module
needs to be required sepatately. It extends org-attach by use of its
hooks.
Activating git functionality in org-attach is done by loading
org-attach-git from now on, instead of customizing a variable.
Naming of both functions and tests has been modified to match the move
of functionality into its own module.
* lisp/org.el
Inline images are shown also using attachment-links, exactly the same
as it works for file-links today.
Make org-open-at-point respect ARG when opening attachment-dir.
* lisp/org-compat.el
org-attach-directory has been deprecated in favour for
org-attach-id-dir. The new name matches its purpose better.
* lisp/ox-html.el
Export attachment links to images as inline images, in the same way as
file links work today.
* etc/ORG-NEWS
Mention the changes in this patch.
* doc/org-manual.org
The chapter "Refile, Copy, Archive" has been split into two separate
chapters.
- "Refile, Copy and Archiving" for information related to moving
existing data around.
- "Capture, Attachments, RSS Feeds and Protocols" for information
related to working with external data.
The attachment-part has been rewritten and extended to match the
changes in this patch.
The new attachment link type is mentioned both inside the attachments
chapter and in the chapter dealing with links.
Documentation related to external links has been improved.
* testing/lisp/test-org-attach-annex.el
Require org-attach-git instead of org-attach, since this file tests
the GIT-functionality.
* testing/lisp/test-org-attach.el
Add tests for org-attach.
* testing/org-test.el
Define a symbol for a file to test attachments with.
* testing/examples/*
A bunch of new example files and folders are created and are used in
testing of org-attach to verify its functionality.
2018-11-25 15:38:44 -05:00
|
|
|
|
(create-if-not-exists-p
|
|
|
|
|
(setq attach-dir (org-attach-dir-get-create)))
|
|
|
|
|
((setq attach-dir (org-entry-get nil "DIR" org-attach-use-inheritance))
|
2009-01-19 02:42:38 -05:00
|
|
|
|
(org-attach-check-absolute-path attach-dir))
|
org-attach*, org, org-manual, org-news, ox-html, testing/*
* lisp/org-attach.el
Changed the way attachments deal with property-inheritance. It now
adheres to the =org-use-property-inheritance= setting by default but
it can be customized if needed (I recommend to enable it!).
The property ATTACH_DIR is deprecated in favour of the shorter and simpler
property DIR.
Added an explicit option to =org-attach= for unsetting
attachment-directories (i.e. remove DIR property and deal with the
attachments by interaction).
Added attachment link type with the prefix "attachment:".
Added customizations:
- org-attach-dir-relative
- org-attach-preferred-new-method
- org-attach-use-inheritance
- org-attach-id-to-path-function
Hooks added:
- org-attach-after-change-hook
- org-attach-open-hook
A new linktype "attachment" is added in order to reduce
link-duplication when wanting to link to files in attached folders of
nodes. This works for both ID and DIR properties. The goal is to
make the functionality for attachment links mirror the functionality
for file links.
* lisp/org-attach-git.el
New file, existing functionality. Code here has been factored out
from org-attach.el and if GIT-functionality is to be used this module
needs to be required sepatately. It extends org-attach by use of its
hooks.
Activating git functionality in org-attach is done by loading
org-attach-git from now on, instead of customizing a variable.
Naming of both functions and tests has been modified to match the move
of functionality into its own module.
* lisp/org.el
Inline images are shown also using attachment-links, exactly the same
as it works for file-links today.
Make org-open-at-point respect ARG when opening attachment-dir.
* lisp/org-compat.el
org-attach-directory has been deprecated in favour for
org-attach-id-dir. The new name matches its purpose better.
* lisp/ox-html.el
Export attachment links to images as inline images, in the same way as
file links work today.
* etc/ORG-NEWS
Mention the changes in this patch.
* doc/org-manual.org
The chapter "Refile, Copy, Archive" has been split into two separate
chapters.
- "Refile, Copy and Archiving" for information related to moving
existing data around.
- "Capture, Attachments, RSS Feeds and Protocols" for information
related to working with external data.
The attachment-part has been rewritten and extended to match the
changes in this patch.
The new attachment link type is mentioned both inside the attachments
chapter and in the chapter dealing with links.
Documentation related to external links has been improved.
* testing/lisp/test-org-attach-annex.el
Require org-attach-git instead of org-attach, since this file tests
the GIT-functionality.
* testing/lisp/test-org-attach.el
Add tests for org-attach.
* testing/org-test.el
Define a symbol for a file to test attachments with.
* testing/examples/*
A bunch of new example files and folders are created and are used in
testing of org-attach to verify its functionality.
2018-11-25 15:38:44 -05:00
|
|
|
|
;; Deprecated and removed from documentation, but still
|
|
|
|
|
;; works. FIXME: Remove after major nr change.
|
|
|
|
|
((setq attach-dir (org-entry-get nil "ATTACH_DIR" org-attach-use-inheritance))
|
|
|
|
|
(org-attach-check-absolute-path attach-dir))
|
|
|
|
|
((setq id (org-entry-get nil "ID" org-attach-use-inheritance))
|
2009-01-19 02:42:38 -05:00
|
|
|
|
(org-attach-check-absolute-path nil)
|
2022-11-07 11:48:02 -05:00
|
|
|
|
(setq attach-dir (org-attach-dir-from-id id 'existing))))
|
2019-09-02 17:15:13 -04:00
|
|
|
|
(if no-fs-check
|
|
|
|
|
attach-dir
|
|
|
|
|
(when (and attach-dir (file-directory-p attach-dir))
|
|
|
|
|
attach-dir))))
|
org-attach*, org, org-manual, org-news, ox-html, testing/*
* lisp/org-attach.el
Changed the way attachments deal with property-inheritance. It now
adheres to the =org-use-property-inheritance= setting by default but
it can be customized if needed (I recommend to enable it!).
The property ATTACH_DIR is deprecated in favour of the shorter and simpler
property DIR.
Added an explicit option to =org-attach= for unsetting
attachment-directories (i.e. remove DIR property and deal with the
attachments by interaction).
Added attachment link type with the prefix "attachment:".
Added customizations:
- org-attach-dir-relative
- org-attach-preferred-new-method
- org-attach-use-inheritance
- org-attach-id-to-path-function
Hooks added:
- org-attach-after-change-hook
- org-attach-open-hook
A new linktype "attachment" is added in order to reduce
link-duplication when wanting to link to files in attached folders of
nodes. This works for both ID and DIR properties. The goal is to
make the functionality for attachment links mirror the functionality
for file links.
* lisp/org-attach-git.el
New file, existing functionality. Code here has been factored out
from org-attach.el and if GIT-functionality is to be used this module
needs to be required sepatately. It extends org-attach by use of its
hooks.
Activating git functionality in org-attach is done by loading
org-attach-git from now on, instead of customizing a variable.
Naming of both functions and tests has been modified to match the move
of functionality into its own module.
* lisp/org.el
Inline images are shown also using attachment-links, exactly the same
as it works for file-links today.
Make org-open-at-point respect ARG when opening attachment-dir.
* lisp/org-compat.el
org-attach-directory has been deprecated in favour for
org-attach-id-dir. The new name matches its purpose better.
* lisp/ox-html.el
Export attachment links to images as inline images, in the same way as
file links work today.
* etc/ORG-NEWS
Mention the changes in this patch.
* doc/org-manual.org
The chapter "Refile, Copy, Archive" has been split into two separate
chapters.
- "Refile, Copy and Archiving" for information related to moving
existing data around.
- "Capture, Attachments, RSS Feeds and Protocols" for information
related to working with external data.
The attachment-part has been rewritten and extended to match the
changes in this patch.
The new attachment link type is mentioned both inside the attachments
chapter and in the chapter dealing with links.
Documentation related to external links has been improved.
* testing/lisp/test-org-attach-annex.el
Require org-attach-git instead of org-attach, since this file tests
the GIT-functionality.
* testing/lisp/test-org-attach.el
Add tests for org-attach.
* testing/org-test.el
Define a symbol for a file to test attachments with.
* testing/examples/*
A bunch of new example files and folders are created and are used in
testing of org-attach to verify its functionality.
2018-11-25 15:38:44 -05:00
|
|
|
|
|
|
|
|
|
(defun org-attach-dir-get-create ()
|
|
|
|
|
"Return existing or new directory associated with the current outline node.
|
2019-09-01 08:43:54 -04:00
|
|
|
|
`org-attach-preferred-new-method' decides how to attach new
|
|
|
|
|
directory if neither ID nor DIR property exist.
|
org-attach*, org, org-manual, org-news, ox-html, testing/*
* lisp/org-attach.el
Changed the way attachments deal with property-inheritance. It now
adheres to the =org-use-property-inheritance= setting by default but
it can be customized if needed (I recommend to enable it!).
The property ATTACH_DIR is deprecated in favour of the shorter and simpler
property DIR.
Added an explicit option to =org-attach= for unsetting
attachment-directories (i.e. remove DIR property and deal with the
attachments by interaction).
Added attachment link type with the prefix "attachment:".
Added customizations:
- org-attach-dir-relative
- org-attach-preferred-new-method
- org-attach-use-inheritance
- org-attach-id-to-path-function
Hooks added:
- org-attach-after-change-hook
- org-attach-open-hook
A new linktype "attachment" is added in order to reduce
link-duplication when wanting to link to files in attached folders of
nodes. This works for both ID and DIR properties. The goal is to
make the functionality for attachment links mirror the functionality
for file links.
* lisp/org-attach-git.el
New file, existing functionality. Code here has been factored out
from org-attach.el and if GIT-functionality is to be used this module
needs to be required sepatately. It extends org-attach by use of its
hooks.
Activating git functionality in org-attach is done by loading
org-attach-git from now on, instead of customizing a variable.
Naming of both functions and tests has been modified to match the move
of functionality into its own module.
* lisp/org.el
Inline images are shown also using attachment-links, exactly the same
as it works for file-links today.
Make org-open-at-point respect ARG when opening attachment-dir.
* lisp/org-compat.el
org-attach-directory has been deprecated in favour for
org-attach-id-dir. The new name matches its purpose better.
* lisp/ox-html.el
Export attachment links to images as inline images, in the same way as
file links work today.
* etc/ORG-NEWS
Mention the changes in this patch.
* doc/org-manual.org
The chapter "Refile, Copy, Archive" has been split into two separate
chapters.
- "Refile, Copy and Archiving" for information related to moving
existing data around.
- "Capture, Attachments, RSS Feeds and Protocols" for information
related to working with external data.
The attachment-part has been rewritten and extended to match the
changes in this patch.
The new attachment link type is mentioned both inside the attachments
chapter and in the chapter dealing with links.
Documentation related to external links has been improved.
* testing/lisp/test-org-attach-annex.el
Require org-attach-git instead of org-attach, since this file tests
the GIT-functionality.
* testing/lisp/test-org-attach.el
Add tests for org-attach.
* testing/org-test.el
Define a symbol for a file to test attachments with.
* testing/examples/*
A bunch of new example files and folders are created and are used in
testing of org-attach to verify its functionality.
2018-11-25 15:38:44 -05:00
|
|
|
|
|
2019-09-01 08:43:54 -04:00
|
|
|
|
If the attachment by some reason cannot be created an error will be raised."
|
org-attach*, org, org-manual, org-news, ox-html, testing/*
* lisp/org-attach.el
Changed the way attachments deal with property-inheritance. It now
adheres to the =org-use-property-inheritance= setting by default but
it can be customized if needed (I recommend to enable it!).
The property ATTACH_DIR is deprecated in favour of the shorter and simpler
property DIR.
Added an explicit option to =org-attach= for unsetting
attachment-directories (i.e. remove DIR property and deal with the
attachments by interaction).
Added attachment link type with the prefix "attachment:".
Added customizations:
- org-attach-dir-relative
- org-attach-preferred-new-method
- org-attach-use-inheritance
- org-attach-id-to-path-function
Hooks added:
- org-attach-after-change-hook
- org-attach-open-hook
A new linktype "attachment" is added in order to reduce
link-duplication when wanting to link to files in attached folders of
nodes. This works for both ID and DIR properties. The goal is to
make the functionality for attachment links mirror the functionality
for file links.
* lisp/org-attach-git.el
New file, existing functionality. Code here has been factored out
from org-attach.el and if GIT-functionality is to be used this module
needs to be required sepatately. It extends org-attach by use of its
hooks.
Activating git functionality in org-attach is done by loading
org-attach-git from now on, instead of customizing a variable.
Naming of both functions and tests has been modified to match the move
of functionality into its own module.
* lisp/org.el
Inline images are shown also using attachment-links, exactly the same
as it works for file-links today.
Make org-open-at-point respect ARG when opening attachment-dir.
* lisp/org-compat.el
org-attach-directory has been deprecated in favour for
org-attach-id-dir. The new name matches its purpose better.
* lisp/ox-html.el
Export attachment links to images as inline images, in the same way as
file links work today.
* etc/ORG-NEWS
Mention the changes in this patch.
* doc/org-manual.org
The chapter "Refile, Copy, Archive" has been split into two separate
chapters.
- "Refile, Copy and Archiving" for information related to moving
existing data around.
- "Capture, Attachments, RSS Feeds and Protocols" for information
related to working with external data.
The attachment-part has been rewritten and extended to match the
changes in this patch.
The new attachment link type is mentioned both inside the attachments
chapter and in the chapter dealing with links.
Documentation related to external links has been improved.
* testing/lisp/test-org-attach-annex.el
Require org-attach-git instead of org-attach, since this file tests
the GIT-functionality.
* testing/lisp/test-org-attach.el
Add tests for org-attach.
* testing/org-test.el
Define a symbol for a file to test attachments with.
* testing/examples/*
A bunch of new example files and folders are created and are used in
testing of org-attach to verify its functionality.
2018-11-25 15:38:44 -05:00
|
|
|
|
(interactive)
|
2019-09-02 17:15:13 -04:00
|
|
|
|
(let ((attach-dir (org-attach-dir nil 'no-fs-check)))
|
org-attach*, org, org-manual, org-news, ox-html, testing/*
* lisp/org-attach.el
Changed the way attachments deal with property-inheritance. It now
adheres to the =org-use-property-inheritance= setting by default but
it can be customized if needed (I recommend to enable it!).
The property ATTACH_DIR is deprecated in favour of the shorter and simpler
property DIR.
Added an explicit option to =org-attach= for unsetting
attachment-directories (i.e. remove DIR property and deal with the
attachments by interaction).
Added attachment link type with the prefix "attachment:".
Added customizations:
- org-attach-dir-relative
- org-attach-preferred-new-method
- org-attach-use-inheritance
- org-attach-id-to-path-function
Hooks added:
- org-attach-after-change-hook
- org-attach-open-hook
A new linktype "attachment" is added in order to reduce
link-duplication when wanting to link to files in attached folders of
nodes. This works for both ID and DIR properties. The goal is to
make the functionality for attachment links mirror the functionality
for file links.
* lisp/org-attach-git.el
New file, existing functionality. Code here has been factored out
from org-attach.el and if GIT-functionality is to be used this module
needs to be required sepatately. It extends org-attach by use of its
hooks.
Activating git functionality in org-attach is done by loading
org-attach-git from now on, instead of customizing a variable.
Naming of both functions and tests has been modified to match the move
of functionality into its own module.
* lisp/org.el
Inline images are shown also using attachment-links, exactly the same
as it works for file-links today.
Make org-open-at-point respect ARG when opening attachment-dir.
* lisp/org-compat.el
org-attach-directory has been deprecated in favour for
org-attach-id-dir. The new name matches its purpose better.
* lisp/ox-html.el
Export attachment links to images as inline images, in the same way as
file links work today.
* etc/ORG-NEWS
Mention the changes in this patch.
* doc/org-manual.org
The chapter "Refile, Copy, Archive" has been split into two separate
chapters.
- "Refile, Copy and Archiving" for information related to moving
existing data around.
- "Capture, Attachments, RSS Feeds and Protocols" for information
related to working with external data.
The attachment-part has been rewritten and extended to match the
changes in this patch.
The new attachment link type is mentioned both inside the attachments
chapter and in the chapter dealing with links.
Documentation related to external links has been improved.
* testing/lisp/test-org-attach-annex.el
Require org-attach-git instead of org-attach, since this file tests
the GIT-functionality.
* testing/lisp/test-org-attach.el
Add tests for org-attach.
* testing/org-test.el
Define a symbol for a file to test attachments with.
* testing/examples/*
A bunch of new example files and folders are created and are used in
testing of org-attach to verify its functionality.
2018-11-25 15:38:44 -05:00
|
|
|
|
(unless attach-dir
|
|
|
|
|
(let (answer)
|
|
|
|
|
(when (eq org-attach-preferred-new-method 'ask)
|
|
|
|
|
(message "Create new ID [1] property or DIR [2] property for attachments?")
|
|
|
|
|
(setq answer (read-char-exclusive)))
|
|
|
|
|
(cond
|
|
|
|
|
((or (eq org-attach-preferred-new-method 'id) (eq answer ?1))
|
2022-11-07 11:48:02 -05:00
|
|
|
|
(let ((id (org-id-get nil t)))
|
|
|
|
|
(or (setq attach-dir (org-attach-dir-from-id id))
|
|
|
|
|
(error "Failed to get folder for id %s, \
|
|
|
|
|
adjust `org-attach-id-to-path-function-list'"
|
|
|
|
|
id))))
|
org-attach*, org, org-manual, org-news, ox-html, testing/*
* lisp/org-attach.el
Changed the way attachments deal with property-inheritance. It now
adheres to the =org-use-property-inheritance= setting by default but
it can be customized if needed (I recommend to enable it!).
The property ATTACH_DIR is deprecated in favour of the shorter and simpler
property DIR.
Added an explicit option to =org-attach= for unsetting
attachment-directories (i.e. remove DIR property and deal with the
attachments by interaction).
Added attachment link type with the prefix "attachment:".
Added customizations:
- org-attach-dir-relative
- org-attach-preferred-new-method
- org-attach-use-inheritance
- org-attach-id-to-path-function
Hooks added:
- org-attach-after-change-hook
- org-attach-open-hook
A new linktype "attachment" is added in order to reduce
link-duplication when wanting to link to files in attached folders of
nodes. This works for both ID and DIR properties. The goal is to
make the functionality for attachment links mirror the functionality
for file links.
* lisp/org-attach-git.el
New file, existing functionality. Code here has been factored out
from org-attach.el and if GIT-functionality is to be used this module
needs to be required sepatately. It extends org-attach by use of its
hooks.
Activating git functionality in org-attach is done by loading
org-attach-git from now on, instead of customizing a variable.
Naming of both functions and tests has been modified to match the move
of functionality into its own module.
* lisp/org.el
Inline images are shown also using attachment-links, exactly the same
as it works for file-links today.
Make org-open-at-point respect ARG when opening attachment-dir.
* lisp/org-compat.el
org-attach-directory has been deprecated in favour for
org-attach-id-dir. The new name matches its purpose better.
* lisp/ox-html.el
Export attachment links to images as inline images, in the same way as
file links work today.
* etc/ORG-NEWS
Mention the changes in this patch.
* doc/org-manual.org
The chapter "Refile, Copy, Archive" has been split into two separate
chapters.
- "Refile, Copy and Archiving" for information related to moving
existing data around.
- "Capture, Attachments, RSS Feeds and Protocols" for information
related to working with external data.
The attachment-part has been rewritten and extended to match the
changes in this patch.
The new attachment link type is mentioned both inside the attachments
chapter and in the chapter dealing with links.
Documentation related to external links has been improved.
* testing/lisp/test-org-attach-annex.el
Require org-attach-git instead of org-attach, since this file tests
the GIT-functionality.
* testing/lisp/test-org-attach.el
Add tests for org-attach.
* testing/org-test.el
Define a symbol for a file to test attachments with.
* testing/examples/*
A bunch of new example files and folders are created and are used in
testing of org-attach to verify its functionality.
2018-11-25 15:38:44 -05:00
|
|
|
|
((or (eq org-attach-preferred-new-method 'dir) (eq answer ?2))
|
|
|
|
|
(setq attach-dir (org-attach-set-directory)))
|
|
|
|
|
((eq org-attach-preferred-new-method 'nil)
|
2021-09-30 16:07:15 -04:00
|
|
|
|
(error "No existing directory. DIR or ID property has to be explicitly created")))))
|
org-attach*, org, org-manual, org-news, ox-html, testing/*
* lisp/org-attach.el
Changed the way attachments deal with property-inheritance. It now
adheres to the =org-use-property-inheritance= setting by default but
it can be customized if needed (I recommend to enable it!).
The property ATTACH_DIR is deprecated in favour of the shorter and simpler
property DIR.
Added an explicit option to =org-attach= for unsetting
attachment-directories (i.e. remove DIR property and deal with the
attachments by interaction).
Added attachment link type with the prefix "attachment:".
Added customizations:
- org-attach-dir-relative
- org-attach-preferred-new-method
- org-attach-use-inheritance
- org-attach-id-to-path-function
Hooks added:
- org-attach-after-change-hook
- org-attach-open-hook
A new linktype "attachment" is added in order to reduce
link-duplication when wanting to link to files in attached folders of
nodes. This works for both ID and DIR properties. The goal is to
make the functionality for attachment links mirror the functionality
for file links.
* lisp/org-attach-git.el
New file, existing functionality. Code here has been factored out
from org-attach.el and if GIT-functionality is to be used this module
needs to be required sepatately. It extends org-attach by use of its
hooks.
Activating git functionality in org-attach is done by loading
org-attach-git from now on, instead of customizing a variable.
Naming of both functions and tests has been modified to match the move
of functionality into its own module.
* lisp/org.el
Inline images are shown also using attachment-links, exactly the same
as it works for file-links today.
Make org-open-at-point respect ARG when opening attachment-dir.
* lisp/org-compat.el
org-attach-directory has been deprecated in favour for
org-attach-id-dir. The new name matches its purpose better.
* lisp/ox-html.el
Export attachment links to images as inline images, in the same way as
file links work today.
* etc/ORG-NEWS
Mention the changes in this patch.
* doc/org-manual.org
The chapter "Refile, Copy, Archive" has been split into two separate
chapters.
- "Refile, Copy and Archiving" for information related to moving
existing data around.
- "Capture, Attachments, RSS Feeds and Protocols" for information
related to working with external data.
The attachment-part has been rewritten and extended to match the
changes in this patch.
The new attachment link type is mentioned both inside the attachments
chapter and in the chapter dealing with links.
Documentation related to external links has been improved.
* testing/lisp/test-org-attach-annex.el
Require org-attach-git instead of org-attach, since this file tests
the GIT-functionality.
* testing/lisp/test-org-attach.el
Add tests for org-attach.
* testing/org-test.el
Define a symbol for a file to test attachments with.
* testing/examples/*
A bunch of new example files and folders are created and are used in
testing of org-attach to verify its functionality.
2018-11-25 15:38:44 -05:00
|
|
|
|
(unless attach-dir
|
|
|
|
|
(error "No attachment directory is associated with the current node"))
|
|
|
|
|
(unless (file-directory-p attach-dir)
|
|
|
|
|
(make-directory attach-dir t))
|
|
|
|
|
attach-dir))
|
|
|
|
|
|
2022-11-07 11:48:02 -05:00
|
|
|
|
(defun org-attach-dir-from-id (id &optional existing)
|
2021-09-16 06:32:43 -04:00
|
|
|
|
"Return a folder path based on `org-attach-id-dir' and ID.
|
2022-11-07 11:48:02 -05:00
|
|
|
|
Try id-to-path functions in `org-attach-id-to-path-function-list'
|
|
|
|
|
ignoring nils. If EXISTING is non-nil, then return the first path
|
|
|
|
|
found in the filesystem. Otherwise return the first non-nil value."
|
|
|
|
|
(let ((fun-list org-attach-id-to-path-function-list)
|
|
|
|
|
(base-dir (expand-file-name org-attach-id-dir))
|
2023-09-20 06:39:20 -04:00
|
|
|
|
(default-base-dir (expand-file-name "data/"))
|
2022-11-07 11:48:02 -05:00
|
|
|
|
preferred first)
|
|
|
|
|
(while (and fun-list
|
|
|
|
|
(not preferred))
|
|
|
|
|
(let* ((name (funcall (car fun-list) id))
|
2023-09-20 06:39:20 -04:00
|
|
|
|
(candidate (and name (expand-file-name name base-dir)))
|
|
|
|
|
;; Try the default value `org-attach-id-dir' as a fallback.
|
|
|
|
|
(candidate2 (and name (not (equal base-dir default-base-dir))
|
|
|
|
|
(expand-file-name name default-base-dir))))
|
2022-11-07 11:48:02 -05:00
|
|
|
|
(setq fun-list (cdr fun-list))
|
|
|
|
|
(when candidate
|
|
|
|
|
(if (or (not existing) (file-directory-p candidate))
|
|
|
|
|
(setq preferred candidate)
|
|
|
|
|
(unless first
|
2023-09-20 06:39:20 -04:00
|
|
|
|
(setq first candidate)))
|
|
|
|
|
(when (and existing
|
|
|
|
|
candidate2
|
|
|
|
|
(not (file-directory-p candidate))
|
|
|
|
|
(file-directory-p candidate2))
|
|
|
|
|
(setq preferred candidate2)))))
|
2022-11-07 11:48:02 -05:00
|
|
|
|
(or preferred first)))
|
2009-01-19 02:42:38 -05:00
|
|
|
|
|
|
|
|
|
(defun org-attach-check-absolute-path (dir)
|
2009-11-12 07:39:29 -05:00
|
|
|
|
"Check if we have enough information to root the attachment directory.
|
2009-01-19 02:42:38 -05:00
|
|
|
|
When DIR is given, check also if it is already absolute. Otherwise,
|
org-attach*, org, org-manual, org-news, ox-html, testing/*
* lisp/org-attach.el
Changed the way attachments deal with property-inheritance. It now
adheres to the =org-use-property-inheritance= setting by default but
it can be customized if needed (I recommend to enable it!).
The property ATTACH_DIR is deprecated in favour of the shorter and simpler
property DIR.
Added an explicit option to =org-attach= for unsetting
attachment-directories (i.e. remove DIR property and deal with the
attachments by interaction).
Added attachment link type with the prefix "attachment:".
Added customizations:
- org-attach-dir-relative
- org-attach-preferred-new-method
- org-attach-use-inheritance
- org-attach-id-to-path-function
Hooks added:
- org-attach-after-change-hook
- org-attach-open-hook
A new linktype "attachment" is added in order to reduce
link-duplication when wanting to link to files in attached folders of
nodes. This works for both ID and DIR properties. The goal is to
make the functionality for attachment links mirror the functionality
for file links.
* lisp/org-attach-git.el
New file, existing functionality. Code here has been factored out
from org-attach.el and if GIT-functionality is to be used this module
needs to be required sepatately. It extends org-attach by use of its
hooks.
Activating git functionality in org-attach is done by loading
org-attach-git from now on, instead of customizing a variable.
Naming of both functions and tests has been modified to match the move
of functionality into its own module.
* lisp/org.el
Inline images are shown also using attachment-links, exactly the same
as it works for file-links today.
Make org-open-at-point respect ARG when opening attachment-dir.
* lisp/org-compat.el
org-attach-directory has been deprecated in favour for
org-attach-id-dir. The new name matches its purpose better.
* lisp/ox-html.el
Export attachment links to images as inline images, in the same way as
file links work today.
* etc/ORG-NEWS
Mention the changes in this patch.
* doc/org-manual.org
The chapter "Refile, Copy, Archive" has been split into two separate
chapters.
- "Refile, Copy and Archiving" for information related to moving
existing data around.
- "Capture, Attachments, RSS Feeds and Protocols" for information
related to working with external data.
The attachment-part has been rewritten and extended to match the
changes in this patch.
The new attachment link type is mentioned both inside the attachments
chapter and in the chapter dealing with links.
Documentation related to external links has been improved.
* testing/lisp/test-org-attach-annex.el
Require org-attach-git instead of org-attach, since this file tests
the GIT-functionality.
* testing/lisp/test-org-attach.el
Add tests for org-attach.
* testing/org-test.el
Define a symbol for a file to test attachments with.
* testing/examples/*
A bunch of new example files and folders are created and are used in
testing of org-attach to verify its functionality.
2018-11-25 15:38:44 -05:00
|
|
|
|
assume that it will be relative, and check if `org-attach-id-dir' is
|
2009-01-19 02:42:38 -05:00
|
|
|
|
absolute, or if at least the current buffer has a file name.
|
|
|
|
|
Throw an error if we cannot root the directory."
|
|
|
|
|
(or (and dir (file-name-absolute-p dir))
|
org-attach*, org, org-manual, org-news, ox-html, testing/*
* lisp/org-attach.el
Changed the way attachments deal with property-inheritance. It now
adheres to the =org-use-property-inheritance= setting by default but
it can be customized if needed (I recommend to enable it!).
The property ATTACH_DIR is deprecated in favour of the shorter and simpler
property DIR.
Added an explicit option to =org-attach= for unsetting
attachment-directories (i.e. remove DIR property and deal with the
attachments by interaction).
Added attachment link type with the prefix "attachment:".
Added customizations:
- org-attach-dir-relative
- org-attach-preferred-new-method
- org-attach-use-inheritance
- org-attach-id-to-path-function
Hooks added:
- org-attach-after-change-hook
- org-attach-open-hook
A new linktype "attachment" is added in order to reduce
link-duplication when wanting to link to files in attached folders of
nodes. This works for both ID and DIR properties. The goal is to
make the functionality for attachment links mirror the functionality
for file links.
* lisp/org-attach-git.el
New file, existing functionality. Code here has been factored out
from org-attach.el and if GIT-functionality is to be used this module
needs to be required sepatately. It extends org-attach by use of its
hooks.
Activating git functionality in org-attach is done by loading
org-attach-git from now on, instead of customizing a variable.
Naming of both functions and tests has been modified to match the move
of functionality into its own module.
* lisp/org.el
Inline images are shown also using attachment-links, exactly the same
as it works for file-links today.
Make org-open-at-point respect ARG when opening attachment-dir.
* lisp/org-compat.el
org-attach-directory has been deprecated in favour for
org-attach-id-dir. The new name matches its purpose better.
* lisp/ox-html.el
Export attachment links to images as inline images, in the same way as
file links work today.
* etc/ORG-NEWS
Mention the changes in this patch.
* doc/org-manual.org
The chapter "Refile, Copy, Archive" has been split into two separate
chapters.
- "Refile, Copy and Archiving" for information related to moving
existing data around.
- "Capture, Attachments, RSS Feeds and Protocols" for information
related to working with external data.
The attachment-part has been rewritten and extended to match the
changes in this patch.
The new attachment link type is mentioned both inside the attachments
chapter and in the chapter dealing with links.
Documentation related to external links has been improved.
* testing/lisp/test-org-attach-annex.el
Require org-attach-git instead of org-attach, since this file tests
the GIT-functionality.
* testing/lisp/test-org-attach.el
Add tests for org-attach.
* testing/org-test.el
Define a symbol for a file to test attachments with.
* testing/examples/*
A bunch of new example files and folders are created and are used in
testing of org-attach to verify its functionality.
2018-11-25 15:38:44 -05:00
|
|
|
|
(file-name-absolute-p org-attach-id-dir)
|
2009-01-19 02:42:38 -05:00
|
|
|
|
(buffer-file-name (buffer-base-buffer))
|
org-attach*, org, org-manual, org-news, ox-html, testing/*
* lisp/org-attach.el
Changed the way attachments deal with property-inheritance. It now
adheres to the =org-use-property-inheritance= setting by default but
it can be customized if needed (I recommend to enable it!).
The property ATTACH_DIR is deprecated in favour of the shorter and simpler
property DIR.
Added an explicit option to =org-attach= for unsetting
attachment-directories (i.e. remove DIR property and deal with the
attachments by interaction).
Added attachment link type with the prefix "attachment:".
Added customizations:
- org-attach-dir-relative
- org-attach-preferred-new-method
- org-attach-use-inheritance
- org-attach-id-to-path-function
Hooks added:
- org-attach-after-change-hook
- org-attach-open-hook
A new linktype "attachment" is added in order to reduce
link-duplication when wanting to link to files in attached folders of
nodes. This works for both ID and DIR properties. The goal is to
make the functionality for attachment links mirror the functionality
for file links.
* lisp/org-attach-git.el
New file, existing functionality. Code here has been factored out
from org-attach.el and if GIT-functionality is to be used this module
needs to be required sepatately. It extends org-attach by use of its
hooks.
Activating git functionality in org-attach is done by loading
org-attach-git from now on, instead of customizing a variable.
Naming of both functions and tests has been modified to match the move
of functionality into its own module.
* lisp/org.el
Inline images are shown also using attachment-links, exactly the same
as it works for file-links today.
Make org-open-at-point respect ARG when opening attachment-dir.
* lisp/org-compat.el
org-attach-directory has been deprecated in favour for
org-attach-id-dir. The new name matches its purpose better.
* lisp/ox-html.el
Export attachment links to images as inline images, in the same way as
file links work today.
* etc/ORG-NEWS
Mention the changes in this patch.
* doc/org-manual.org
The chapter "Refile, Copy, Archive" has been split into two separate
chapters.
- "Refile, Copy and Archiving" for information related to moving
existing data around.
- "Capture, Attachments, RSS Feeds and Protocols" for information
related to working with external data.
The attachment-part has been rewritten and extended to match the
changes in this patch.
The new attachment link type is mentioned both inside the attachments
chapter and in the chapter dealing with links.
Documentation related to external links has been improved.
* testing/lisp/test-org-attach-annex.el
Require org-attach-git instead of org-attach, since this file tests
the GIT-functionality.
* testing/lisp/test-org-attach.el
Add tests for org-attach.
* testing/org-test.el
Define a symbol for a file to test attachments with.
* testing/examples/*
A bunch of new example files and folders are created and are used in
testing of org-attach to verify its functionality.
2018-11-25 15:38:44 -05:00
|
|
|
|
(error "Need absolute `org-attach-id-dir' to attach in buffers without filename")))
|
2009-01-19 02:42:38 -05:00
|
|
|
|
|
org-attach*, org, org-manual, org-news, ox-html, testing/*
* lisp/org-attach.el
Changed the way attachments deal with property-inheritance. It now
adheres to the =org-use-property-inheritance= setting by default but
it can be customized if needed (I recommend to enable it!).
The property ATTACH_DIR is deprecated in favour of the shorter and simpler
property DIR.
Added an explicit option to =org-attach= for unsetting
attachment-directories (i.e. remove DIR property and deal with the
attachments by interaction).
Added attachment link type with the prefix "attachment:".
Added customizations:
- org-attach-dir-relative
- org-attach-preferred-new-method
- org-attach-use-inheritance
- org-attach-id-to-path-function
Hooks added:
- org-attach-after-change-hook
- org-attach-open-hook
A new linktype "attachment" is added in order to reduce
link-duplication when wanting to link to files in attached folders of
nodes. This works for both ID and DIR properties. The goal is to
make the functionality for attachment links mirror the functionality
for file links.
* lisp/org-attach-git.el
New file, existing functionality. Code here has been factored out
from org-attach.el and if GIT-functionality is to be used this module
needs to be required sepatately. It extends org-attach by use of its
hooks.
Activating git functionality in org-attach is done by loading
org-attach-git from now on, instead of customizing a variable.
Naming of both functions and tests has been modified to match the move
of functionality into its own module.
* lisp/org.el
Inline images are shown also using attachment-links, exactly the same
as it works for file-links today.
Make org-open-at-point respect ARG when opening attachment-dir.
* lisp/org-compat.el
org-attach-directory has been deprecated in favour for
org-attach-id-dir. The new name matches its purpose better.
* lisp/ox-html.el
Export attachment links to images as inline images, in the same way as
file links work today.
* etc/ORG-NEWS
Mention the changes in this patch.
* doc/org-manual.org
The chapter "Refile, Copy, Archive" has been split into two separate
chapters.
- "Refile, Copy and Archiving" for information related to moving
existing data around.
- "Capture, Attachments, RSS Feeds and Protocols" for information
related to working with external data.
The attachment-part has been rewritten and extended to match the
changes in this patch.
The new attachment link type is mentioned both inside the attachments
chapter and in the chapter dealing with links.
Documentation related to external links has been improved.
* testing/lisp/test-org-attach-annex.el
Require org-attach-git instead of org-attach, since this file tests
the GIT-functionality.
* testing/lisp/test-org-attach.el
Add tests for org-attach.
* testing/org-test.el
Define a symbol for a file to test attachments with.
* testing/examples/*
A bunch of new example files and folders are created and are used in
testing of org-attach to verify its functionality.
2018-11-25 15:38:44 -05:00
|
|
|
|
(defun org-attach-set-directory ()
|
|
|
|
|
"Set the DIR node property and ask to move files there.
|
2009-01-19 02:42:38 -05:00
|
|
|
|
The property defines the directory that is used for attachments
|
org-attach*, org, org-manual, org-news, ox-html, testing/*
* lisp/org-attach.el
Changed the way attachments deal with property-inheritance. It now
adheres to the =org-use-property-inheritance= setting by default but
it can be customized if needed (I recommend to enable it!).
The property ATTACH_DIR is deprecated in favour of the shorter and simpler
property DIR.
Added an explicit option to =org-attach= for unsetting
attachment-directories (i.e. remove DIR property and deal with the
attachments by interaction).
Added attachment link type with the prefix "attachment:".
Added customizations:
- org-attach-dir-relative
- org-attach-preferred-new-method
- org-attach-use-inheritance
- org-attach-id-to-path-function
Hooks added:
- org-attach-after-change-hook
- org-attach-open-hook
A new linktype "attachment" is added in order to reduce
link-duplication when wanting to link to files in attached folders of
nodes. This works for both ID and DIR properties. The goal is to
make the functionality for attachment links mirror the functionality
for file links.
* lisp/org-attach-git.el
New file, existing functionality. Code here has been factored out
from org-attach.el and if GIT-functionality is to be used this module
needs to be required sepatately. It extends org-attach by use of its
hooks.
Activating git functionality in org-attach is done by loading
org-attach-git from now on, instead of customizing a variable.
Naming of both functions and tests has been modified to match the move
of functionality into its own module.
* lisp/org.el
Inline images are shown also using attachment-links, exactly the same
as it works for file-links today.
Make org-open-at-point respect ARG when opening attachment-dir.
* lisp/org-compat.el
org-attach-directory has been deprecated in favour for
org-attach-id-dir. The new name matches its purpose better.
* lisp/ox-html.el
Export attachment links to images as inline images, in the same way as
file links work today.
* etc/ORG-NEWS
Mention the changes in this patch.
* doc/org-manual.org
The chapter "Refile, Copy, Archive" has been split into two separate
chapters.
- "Refile, Copy and Archiving" for information related to moving
existing data around.
- "Capture, Attachments, RSS Feeds and Protocols" for information
related to working with external data.
The attachment-part has been rewritten and extended to match the
changes in this patch.
The new attachment link type is mentioned both inside the attachments
chapter and in the chapter dealing with links.
Documentation related to external links has been improved.
* testing/lisp/test-org-attach-annex.el
Require org-attach-git instead of org-attach, since this file tests
the GIT-functionality.
* testing/lisp/test-org-attach.el
Add tests for org-attach.
* testing/org-test.el
Define a symbol for a file to test attachments with.
* testing/examples/*
A bunch of new example files and folders are created and are used in
testing of org-attach to verify its functionality.
2018-11-25 15:38:44 -05:00
|
|
|
|
of the entry. Creates relative links if `org-attach-dir-relative'
|
|
|
|
|
is non-nil.
|
|
|
|
|
|
|
|
|
|
Return the directory."
|
|
|
|
|
(interactive)
|
2017-07-09 11:16:24 -04:00
|
|
|
|
(let ((old (org-attach-dir))
|
org-attach*, org, org-manual, org-news, ox-html, testing/*
* lisp/org-attach.el
Changed the way attachments deal with property-inheritance. It now
adheres to the =org-use-property-inheritance= setting by default but
it can be customized if needed (I recommend to enable it!).
The property ATTACH_DIR is deprecated in favour of the shorter and simpler
property DIR.
Added an explicit option to =org-attach= for unsetting
attachment-directories (i.e. remove DIR property and deal with the
attachments by interaction).
Added attachment link type with the prefix "attachment:".
Added customizations:
- org-attach-dir-relative
- org-attach-preferred-new-method
- org-attach-use-inheritance
- org-attach-id-to-path-function
Hooks added:
- org-attach-after-change-hook
- org-attach-open-hook
A new linktype "attachment" is added in order to reduce
link-duplication when wanting to link to files in attached folders of
nodes. This works for both ID and DIR properties. The goal is to
make the functionality for attachment links mirror the functionality
for file links.
* lisp/org-attach-git.el
New file, existing functionality. Code here has been factored out
from org-attach.el and if GIT-functionality is to be used this module
needs to be required sepatately. It extends org-attach by use of its
hooks.
Activating git functionality in org-attach is done by loading
org-attach-git from now on, instead of customizing a variable.
Naming of both functions and tests has been modified to match the move
of functionality into its own module.
* lisp/org.el
Inline images are shown also using attachment-links, exactly the same
as it works for file-links today.
Make org-open-at-point respect ARG when opening attachment-dir.
* lisp/org-compat.el
org-attach-directory has been deprecated in favour for
org-attach-id-dir. The new name matches its purpose better.
* lisp/ox-html.el
Export attachment links to images as inline images, in the same way as
file links work today.
* etc/ORG-NEWS
Mention the changes in this patch.
* doc/org-manual.org
The chapter "Refile, Copy, Archive" has been split into two separate
chapters.
- "Refile, Copy and Archiving" for information related to moving
existing data around.
- "Capture, Attachments, RSS Feeds and Protocols" for information
related to working with external data.
The attachment-part has been rewritten and extended to match the
changes in this patch.
The new attachment link type is mentioned both inside the attachments
chapter and in the chapter dealing with links.
Documentation related to external links has been improved.
* testing/lisp/test-org-attach-annex.el
Require org-attach-git instead of org-attach, since this file tests
the GIT-functionality.
* testing/lisp/test-org-attach.el
Add tests for org-attach.
* testing/org-test.el
Define a symbol for a file to test attachments with.
* testing/examples/*
A bunch of new example files and folders are created and are used in
testing of org-attach to verify its functionality.
2018-11-25 15:38:44 -05:00
|
|
|
|
(new
|
|
|
|
|
(let* ((attach-dir (read-directory-name
|
|
|
|
|
"Attachment directory: "
|
|
|
|
|
(org-entry-get nil "DIR")))
|
|
|
|
|
(current-dir (file-name-directory (or default-directory
|
|
|
|
|
buffer-file-name)))
|
|
|
|
|
(attach-dir-relative (file-relative-name attach-dir current-dir)))
|
|
|
|
|
(org-entry-put nil "DIR" (if org-attach-dir-relative
|
|
|
|
|
attach-dir-relative
|
|
|
|
|
attach-dir))
|
|
|
|
|
attach-dir)))
|
2017-07-09 11:16:24 -04:00
|
|
|
|
(unless (or (string= old new)
|
|
|
|
|
(not old))
|
|
|
|
|
(when (yes-or-no-p "Copy over attachments from old directory? ")
|
org-attach*, org, org-manual, org-news, ox-html, testing/*
* lisp/org-attach.el
Changed the way attachments deal with property-inheritance. It now
adheres to the =org-use-property-inheritance= setting by default but
it can be customized if needed (I recommend to enable it!).
The property ATTACH_DIR is deprecated in favour of the shorter and simpler
property DIR.
Added an explicit option to =org-attach= for unsetting
attachment-directories (i.e. remove DIR property and deal with the
attachments by interaction).
Added attachment link type with the prefix "attachment:".
Added customizations:
- org-attach-dir-relative
- org-attach-preferred-new-method
- org-attach-use-inheritance
- org-attach-id-to-path-function
Hooks added:
- org-attach-after-change-hook
- org-attach-open-hook
A new linktype "attachment" is added in order to reduce
link-duplication when wanting to link to files in attached folders of
nodes. This works for both ID and DIR properties. The goal is to
make the functionality for attachment links mirror the functionality
for file links.
* lisp/org-attach-git.el
New file, existing functionality. Code here has been factored out
from org-attach.el and if GIT-functionality is to be used this module
needs to be required sepatately. It extends org-attach by use of its
hooks.
Activating git functionality in org-attach is done by loading
org-attach-git from now on, instead of customizing a variable.
Naming of both functions and tests has been modified to match the move
of functionality into its own module.
* lisp/org.el
Inline images are shown also using attachment-links, exactly the same
as it works for file-links today.
Make org-open-at-point respect ARG when opening attachment-dir.
* lisp/org-compat.el
org-attach-directory has been deprecated in favour for
org-attach-id-dir. The new name matches its purpose better.
* lisp/ox-html.el
Export attachment links to images as inline images, in the same way as
file links work today.
* etc/ORG-NEWS
Mention the changes in this patch.
* doc/org-manual.org
The chapter "Refile, Copy, Archive" has been split into two separate
chapters.
- "Refile, Copy and Archiving" for information related to moving
existing data around.
- "Capture, Attachments, RSS Feeds and Protocols" for information
related to working with external data.
The attachment-part has been rewritten and extended to match the
changes in this patch.
The new attachment link type is mentioned both inside the attachments
chapter and in the chapter dealing with links.
Documentation related to external links has been improved.
* testing/lisp/test-org-attach-annex.el
Require org-attach-git instead of org-attach, since this file tests
the GIT-functionality.
* testing/lisp/test-org-attach.el
Add tests for org-attach.
* testing/org-test.el
Define a symbol for a file to test attachments with.
* testing/examples/*
A bunch of new example files and folders are created and are used in
testing of org-attach to verify its functionality.
2018-11-25 15:38:44 -05:00
|
|
|
|
(copy-directory old new t t t))
|
|
|
|
|
(when (yes-or-no-p (concat "Delete " old))
|
|
|
|
|
(delete-directory old t)))
|
|
|
|
|
new))
|
|
|
|
|
|
|
|
|
|
(defun org-attach-unset-directory ()
|
2021-09-16 06:32:43 -04:00
|
|
|
|
"Remove DIR node property.
|
org-attach*, org, org-manual, org-news, ox-html, testing/*
* lisp/org-attach.el
Changed the way attachments deal with property-inheritance. It now
adheres to the =org-use-property-inheritance= setting by default but
it can be customized if needed (I recommend to enable it!).
The property ATTACH_DIR is deprecated in favour of the shorter and simpler
property DIR.
Added an explicit option to =org-attach= for unsetting
attachment-directories (i.e. remove DIR property and deal with the
attachments by interaction).
Added attachment link type with the prefix "attachment:".
Added customizations:
- org-attach-dir-relative
- org-attach-preferred-new-method
- org-attach-use-inheritance
- org-attach-id-to-path-function
Hooks added:
- org-attach-after-change-hook
- org-attach-open-hook
A new linktype "attachment" is added in order to reduce
link-duplication when wanting to link to files in attached folders of
nodes. This works for both ID and DIR properties. The goal is to
make the functionality for attachment links mirror the functionality
for file links.
* lisp/org-attach-git.el
New file, existing functionality. Code here has been factored out
from org-attach.el and if GIT-functionality is to be used this module
needs to be required sepatately. It extends org-attach by use of its
hooks.
Activating git functionality in org-attach is done by loading
org-attach-git from now on, instead of customizing a variable.
Naming of both functions and tests has been modified to match the move
of functionality into its own module.
* lisp/org.el
Inline images are shown also using attachment-links, exactly the same
as it works for file-links today.
Make org-open-at-point respect ARG when opening attachment-dir.
* lisp/org-compat.el
org-attach-directory has been deprecated in favour for
org-attach-id-dir. The new name matches its purpose better.
* lisp/ox-html.el
Export attachment links to images as inline images, in the same way as
file links work today.
* etc/ORG-NEWS
Mention the changes in this patch.
* doc/org-manual.org
The chapter "Refile, Copy, Archive" has been split into two separate
chapters.
- "Refile, Copy and Archiving" for information related to moving
existing data around.
- "Capture, Attachments, RSS Feeds and Protocols" for information
related to working with external data.
The attachment-part has been rewritten and extended to match the
changes in this patch.
The new attachment link type is mentioned both inside the attachments
chapter and in the chapter dealing with links.
Documentation related to external links has been improved.
* testing/lisp/test-org-attach-annex.el
Require org-attach-git instead of org-attach, since this file tests
the GIT-functionality.
* testing/lisp/test-org-attach.el
Add tests for org-attach.
* testing/org-test.el
Define a symbol for a file to test attachments with.
* testing/examples/*
A bunch of new example files and folders are created and are used in
testing of org-attach to verify its functionality.
2018-11-25 15:38:44 -05:00
|
|
|
|
If attachment folder is changed due to removal of DIR-property
|
|
|
|
|
ask to move attachments to new location and ask to delete old
|
|
|
|
|
attachment-folder.
|
|
|
|
|
|
|
|
|
|
Change of attachment-folder due to unset might be if an ID
|
|
|
|
|
property is set on the node, or if a separate inherited
|
2020-02-09 09:33:14 -05:00
|
|
|
|
DIR-property exists (that is different from the unset one)."
|
org-attach*, org, org-manual, org-news, ox-html, testing/*
* lisp/org-attach.el
Changed the way attachments deal with property-inheritance. It now
adheres to the =org-use-property-inheritance= setting by default but
it can be customized if needed (I recommend to enable it!).
The property ATTACH_DIR is deprecated in favour of the shorter and simpler
property DIR.
Added an explicit option to =org-attach= for unsetting
attachment-directories (i.e. remove DIR property and deal with the
attachments by interaction).
Added attachment link type with the prefix "attachment:".
Added customizations:
- org-attach-dir-relative
- org-attach-preferred-new-method
- org-attach-use-inheritance
- org-attach-id-to-path-function
Hooks added:
- org-attach-after-change-hook
- org-attach-open-hook
A new linktype "attachment" is added in order to reduce
link-duplication when wanting to link to files in attached folders of
nodes. This works for both ID and DIR properties. The goal is to
make the functionality for attachment links mirror the functionality
for file links.
* lisp/org-attach-git.el
New file, existing functionality. Code here has been factored out
from org-attach.el and if GIT-functionality is to be used this module
needs to be required sepatately. It extends org-attach by use of its
hooks.
Activating git functionality in org-attach is done by loading
org-attach-git from now on, instead of customizing a variable.
Naming of both functions and tests has been modified to match the move
of functionality into its own module.
* lisp/org.el
Inline images are shown also using attachment-links, exactly the same
as it works for file-links today.
Make org-open-at-point respect ARG when opening attachment-dir.
* lisp/org-compat.el
org-attach-directory has been deprecated in favour for
org-attach-id-dir. The new name matches its purpose better.
* lisp/ox-html.el
Export attachment links to images as inline images, in the same way as
file links work today.
* etc/ORG-NEWS
Mention the changes in this patch.
* doc/org-manual.org
The chapter "Refile, Copy, Archive" has been split into two separate
chapters.
- "Refile, Copy and Archiving" for information related to moving
existing data around.
- "Capture, Attachments, RSS Feeds and Protocols" for information
related to working with external data.
The attachment-part has been rewritten and extended to match the
changes in this patch.
The new attachment link type is mentioned both inside the attachments
chapter and in the chapter dealing with links.
Documentation related to external links has been improved.
* testing/lisp/test-org-attach-annex.el
Require org-attach-git instead of org-attach, since this file tests
the GIT-functionality.
* testing/lisp/test-org-attach.el
Add tests for org-attach.
* testing/org-test.el
Define a symbol for a file to test attachments with.
* testing/examples/*
A bunch of new example files and folders are created and are used in
testing of org-attach to verify its functionality.
2018-11-25 15:38:44 -05:00
|
|
|
|
(interactive)
|
|
|
|
|
(let ((old (org-attach-dir))
|
|
|
|
|
(new
|
|
|
|
|
(progn
|
|
|
|
|
(org-entry-delete nil "DIR")
|
|
|
|
|
;; ATTACH-DIR is deprecated and removed from documentation,
|
|
|
|
|
;; but still works. Remove code for it after major nr change.
|
|
|
|
|
(org-entry-delete nil "ATTACH_DIR")
|
|
|
|
|
(org-attach-dir))))
|
|
|
|
|
(unless (or (string= old new)
|
|
|
|
|
(not old))
|
|
|
|
|
(when (and new (yes-or-no-p "Copy over attachments from old directory? "))
|
2017-07-09 11:16:24 -04:00
|
|
|
|
(copy-directory old new t nil t))
|
|
|
|
|
(when (yes-or-no-p (concat "Delete " old))
|
|
|
|
|
(delete-directory old t)))))
|
2009-01-19 02:42:38 -05:00
|
|
|
|
|
2008-10-06 03:38:50 -04:00
|
|
|
|
(defun org-attach-tag (&optional off)
|
2008-10-09 06:19:43 -04:00
|
|
|
|
"Turn the autotag on or (if OFF is set) off."
|
2008-10-06 03:38:50 -04:00
|
|
|
|
(when org-attach-auto-tag
|
2023-04-28 06:52:09 -04:00
|
|
|
|
;; FIXME: There is currently no way to set #+FILETAGS
|
|
|
|
|
;; programatically. Do nothing when before first heading
|
|
|
|
|
;; (attaching to file) to avoid blocking error.
|
|
|
|
|
(unless (org-before-first-heading-p)
|
|
|
|
|
(save-excursion
|
|
|
|
|
(org-back-to-heading t)
|
|
|
|
|
(org-toggle-tag org-attach-auto-tag (if off 'off 'on))))))
|
2008-10-06 03:38:50 -04:00
|
|
|
|
|
|
|
|
|
(defun org-attach-untag ()
|
|
|
|
|
"Turn the autotag off."
|
|
|
|
|
(org-attach-tag 'off))
|
|
|
|
|
|
2017-03-10 19:54:05 -05:00
|
|
|
|
(defun org-attach-url (url)
|
2021-09-30 16:07:15 -04:00
|
|
|
|
"Attach URL."
|
2017-03-10 19:54:05 -05:00
|
|
|
|
(interactive "MURL of the file to attach: \n")
|
2022-06-12 10:37:42 -04:00
|
|
|
|
(let ((org-attach-method 'url)
|
2022-11-30 10:59:41 -05:00
|
|
|
|
(org-safe-remote-resources ; Assume safety if in an interactive session.
|
2022-06-12 10:37:42 -04:00
|
|
|
|
(if noninteractive org-safe-remote-resources '(""))))
|
2019-06-21 18:14:49 -04:00
|
|
|
|
(org-attach-attach url)))
|
2017-03-10 19:54:05 -05:00
|
|
|
|
|
2018-11-01 21:04:38 -04:00
|
|
|
|
(defun org-attach-buffer (buffer-name)
|
org-attach*, org, org-manual, org-news, ox-html, testing/*
* lisp/org-attach.el
Changed the way attachments deal with property-inheritance. It now
adheres to the =org-use-property-inheritance= setting by default but
it can be customized if needed (I recommend to enable it!).
The property ATTACH_DIR is deprecated in favour of the shorter and simpler
property DIR.
Added an explicit option to =org-attach= for unsetting
attachment-directories (i.e. remove DIR property and deal with the
attachments by interaction).
Added attachment link type with the prefix "attachment:".
Added customizations:
- org-attach-dir-relative
- org-attach-preferred-new-method
- org-attach-use-inheritance
- org-attach-id-to-path-function
Hooks added:
- org-attach-after-change-hook
- org-attach-open-hook
A new linktype "attachment" is added in order to reduce
link-duplication when wanting to link to files in attached folders of
nodes. This works for both ID and DIR properties. The goal is to
make the functionality for attachment links mirror the functionality
for file links.
* lisp/org-attach-git.el
New file, existing functionality. Code here has been factored out
from org-attach.el and if GIT-functionality is to be used this module
needs to be required sepatately. It extends org-attach by use of its
hooks.
Activating git functionality in org-attach is done by loading
org-attach-git from now on, instead of customizing a variable.
Naming of both functions and tests has been modified to match the move
of functionality into its own module.
* lisp/org.el
Inline images are shown also using attachment-links, exactly the same
as it works for file-links today.
Make org-open-at-point respect ARG when opening attachment-dir.
* lisp/org-compat.el
org-attach-directory has been deprecated in favour for
org-attach-id-dir. The new name matches its purpose better.
* lisp/ox-html.el
Export attachment links to images as inline images, in the same way as
file links work today.
* etc/ORG-NEWS
Mention the changes in this patch.
* doc/org-manual.org
The chapter "Refile, Copy, Archive" has been split into two separate
chapters.
- "Refile, Copy and Archiving" for information related to moving
existing data around.
- "Capture, Attachments, RSS Feeds and Protocols" for information
related to working with external data.
The attachment-part has been rewritten and extended to match the
changes in this patch.
The new attachment link type is mentioned both inside the attachments
chapter and in the chapter dealing with links.
Documentation related to external links has been improved.
* testing/lisp/test-org-attach-annex.el
Require org-attach-git instead of org-attach, since this file tests
the GIT-functionality.
* testing/lisp/test-org-attach.el
Add tests for org-attach.
* testing/org-test.el
Define a symbol for a file to test attachments with.
* testing/examples/*
A bunch of new example files and folders are created and are used in
testing of org-attach to verify its functionality.
2018-11-25 15:38:44 -05:00
|
|
|
|
"Attach BUFFER-NAME's contents to current outline node.
|
2018-11-01 21:04:38 -04:00
|
|
|
|
BUFFER-NAME is a string. Signals a `file-already-exists' error
|
|
|
|
|
if it would overwrite an existing filename."
|
|
|
|
|
(interactive "bBuffer whose contents should be attached: ")
|
org-attach*, org, org-manual, org-news, ox-html, testing/*
* lisp/org-attach.el
Changed the way attachments deal with property-inheritance. It now
adheres to the =org-use-property-inheritance= setting by default but
it can be customized if needed (I recommend to enable it!).
The property ATTACH_DIR is deprecated in favour of the shorter and simpler
property DIR.
Added an explicit option to =org-attach= for unsetting
attachment-directories (i.e. remove DIR property and deal with the
attachments by interaction).
Added attachment link type with the prefix "attachment:".
Added customizations:
- org-attach-dir-relative
- org-attach-preferred-new-method
- org-attach-use-inheritance
- org-attach-id-to-path-function
Hooks added:
- org-attach-after-change-hook
- org-attach-open-hook
A new linktype "attachment" is added in order to reduce
link-duplication when wanting to link to files in attached folders of
nodes. This works for both ID and DIR properties. The goal is to
make the functionality for attachment links mirror the functionality
for file links.
* lisp/org-attach-git.el
New file, existing functionality. Code here has been factored out
from org-attach.el and if GIT-functionality is to be used this module
needs to be required sepatately. It extends org-attach by use of its
hooks.
Activating git functionality in org-attach is done by loading
org-attach-git from now on, instead of customizing a variable.
Naming of both functions and tests has been modified to match the move
of functionality into its own module.
* lisp/org.el
Inline images are shown also using attachment-links, exactly the same
as it works for file-links today.
Make org-open-at-point respect ARG when opening attachment-dir.
* lisp/org-compat.el
org-attach-directory has been deprecated in favour for
org-attach-id-dir. The new name matches its purpose better.
* lisp/ox-html.el
Export attachment links to images as inline images, in the same way as
file links work today.
* etc/ORG-NEWS
Mention the changes in this patch.
* doc/org-manual.org
The chapter "Refile, Copy, Archive" has been split into two separate
chapters.
- "Refile, Copy and Archiving" for information related to moving
existing data around.
- "Capture, Attachments, RSS Feeds and Protocols" for information
related to working with external data.
The attachment-part has been rewritten and extended to match the
changes in this patch.
The new attachment link type is mentioned both inside the attachments
chapter and in the chapter dealing with links.
Documentation related to external links has been improved.
* testing/lisp/test-org-attach-annex.el
Require org-attach-git instead of org-attach, since this file tests
the GIT-functionality.
* testing/lisp/test-org-attach.el
Add tests for org-attach.
* testing/org-test.el
Define a symbol for a file to test attachments with.
* testing/examples/*
A bunch of new example files and folders are created and are used in
testing of org-attach to verify its functionality.
2018-11-25 15:38:44 -05:00
|
|
|
|
(let* ((attach-dir (org-attach-dir 'get-create))
|
|
|
|
|
(output (expand-file-name buffer-name attach-dir)))
|
2018-11-01 21:04:38 -04:00
|
|
|
|
(when (file-exists-p output)
|
|
|
|
|
(signal 'file-already-exists (list "File exists" output)))
|
org-attach*, org, org-manual, org-news, ox-html, testing/*
* lisp/org-attach.el
Changed the way attachments deal with property-inheritance. It now
adheres to the =org-use-property-inheritance= setting by default but
it can be customized if needed (I recommend to enable it!).
The property ATTACH_DIR is deprecated in favour of the shorter and simpler
property DIR.
Added an explicit option to =org-attach= for unsetting
attachment-directories (i.e. remove DIR property and deal with the
attachments by interaction).
Added attachment link type with the prefix "attachment:".
Added customizations:
- org-attach-dir-relative
- org-attach-preferred-new-method
- org-attach-use-inheritance
- org-attach-id-to-path-function
Hooks added:
- org-attach-after-change-hook
- org-attach-open-hook
A new linktype "attachment" is added in order to reduce
link-duplication when wanting to link to files in attached folders of
nodes. This works for both ID and DIR properties. The goal is to
make the functionality for attachment links mirror the functionality
for file links.
* lisp/org-attach-git.el
New file, existing functionality. Code here has been factored out
from org-attach.el and if GIT-functionality is to be used this module
needs to be required sepatately. It extends org-attach by use of its
hooks.
Activating git functionality in org-attach is done by loading
org-attach-git from now on, instead of customizing a variable.
Naming of both functions and tests has been modified to match the move
of functionality into its own module.
* lisp/org.el
Inline images are shown also using attachment-links, exactly the same
as it works for file-links today.
Make org-open-at-point respect ARG when opening attachment-dir.
* lisp/org-compat.el
org-attach-directory has been deprecated in favour for
org-attach-id-dir. The new name matches its purpose better.
* lisp/ox-html.el
Export attachment links to images as inline images, in the same way as
file links work today.
* etc/ORG-NEWS
Mention the changes in this patch.
* doc/org-manual.org
The chapter "Refile, Copy, Archive" has been split into two separate
chapters.
- "Refile, Copy and Archiving" for information related to moving
existing data around.
- "Capture, Attachments, RSS Feeds and Protocols" for information
related to working with external data.
The attachment-part has been rewritten and extended to match the
changes in this patch.
The new attachment link type is mentioned both inside the attachments
chapter and in the chapter dealing with links.
Documentation related to external links has been improved.
* testing/lisp/test-org-attach-annex.el
Require org-attach-git instead of org-attach, since this file tests
the GIT-functionality.
* testing/lisp/test-org-attach.el
Add tests for org-attach.
* testing/org-test.el
Define a symbol for a file to test attachments with.
* testing/examples/*
A bunch of new example files and folders are created and are used in
testing of org-attach to verify its functionality.
2018-11-25 15:38:44 -05:00
|
|
|
|
(run-hook-with-args 'org-attach-after-change-hook attach-dir)
|
2018-11-01 21:04:38 -04:00
|
|
|
|
(org-attach-tag)
|
|
|
|
|
(with-temp-file output
|
|
|
|
|
(insert-buffer-substring buffer-name))))
|
|
|
|
|
|
2008-10-07 08:28:21 -04:00
|
|
|
|
(defun org-attach-attach (file &optional visit-dir method)
|
org-attach*, org, org-manual, org-news, ox-html, testing/*
* lisp/org-attach.el
Changed the way attachments deal with property-inheritance. It now
adheres to the =org-use-property-inheritance= setting by default but
it can be customized if needed (I recommend to enable it!).
The property ATTACH_DIR is deprecated in favour of the shorter and simpler
property DIR.
Added an explicit option to =org-attach= for unsetting
attachment-directories (i.e. remove DIR property and deal with the
attachments by interaction).
Added attachment link type with the prefix "attachment:".
Added customizations:
- org-attach-dir-relative
- org-attach-preferred-new-method
- org-attach-use-inheritance
- org-attach-id-to-path-function
Hooks added:
- org-attach-after-change-hook
- org-attach-open-hook
A new linktype "attachment" is added in order to reduce
link-duplication when wanting to link to files in attached folders of
nodes. This works for both ID and DIR properties. The goal is to
make the functionality for attachment links mirror the functionality
for file links.
* lisp/org-attach-git.el
New file, existing functionality. Code here has been factored out
from org-attach.el and if GIT-functionality is to be used this module
needs to be required sepatately. It extends org-attach by use of its
hooks.
Activating git functionality in org-attach is done by loading
org-attach-git from now on, instead of customizing a variable.
Naming of both functions and tests has been modified to match the move
of functionality into its own module.
* lisp/org.el
Inline images are shown also using attachment-links, exactly the same
as it works for file-links today.
Make org-open-at-point respect ARG when opening attachment-dir.
* lisp/org-compat.el
org-attach-directory has been deprecated in favour for
org-attach-id-dir. The new name matches its purpose better.
* lisp/ox-html.el
Export attachment links to images as inline images, in the same way as
file links work today.
* etc/ORG-NEWS
Mention the changes in this patch.
* doc/org-manual.org
The chapter "Refile, Copy, Archive" has been split into two separate
chapters.
- "Refile, Copy and Archiving" for information related to moving
existing data around.
- "Capture, Attachments, RSS Feeds and Protocols" for information
related to working with external data.
The attachment-part has been rewritten and extended to match the
changes in this patch.
The new attachment link type is mentioned both inside the attachments
chapter and in the chapter dealing with links.
Documentation related to external links has been improved.
* testing/lisp/test-org-attach-annex.el
Require org-attach-git instead of org-attach, since this file tests
the GIT-functionality.
* testing/lisp/test-org-attach.el
Add tests for org-attach.
* testing/org-test.el
Define a symbol for a file to test attachments with.
* testing/examples/*
A bunch of new example files and folders are created and are used in
testing of org-attach to verify its functionality.
2018-11-25 15:38:44 -05:00
|
|
|
|
"Move/copy/link FILE into the attachment directory of the current outline node.
|
2021-09-30 16:07:15 -04:00
|
|
|
|
If VISIT-DIR is non-nil, visit the directory with `dired'.
|
2017-03-10 19:54:05 -05:00
|
|
|
|
METHOD may be `cp', `mv', `ln', `lns' or `url' default taken from
|
2012-04-12 14:20:39 -04:00
|
|
|
|
`org-attach-method'."
|
2017-05-09 11:30:18 -04:00
|
|
|
|
(interactive
|
|
|
|
|
(list
|
2020-01-26 13:16:01 -05:00
|
|
|
|
(read-file-name "File to keep as an attachment: "
|
2017-05-09 11:30:18 -04:00
|
|
|
|
(or (progn
|
|
|
|
|
(require 'dired-aux)
|
|
|
|
|
(dired-dwim-target-directory))
|
|
|
|
|
default-directory))
|
|
|
|
|
current-prefix-arg
|
|
|
|
|
nil))
|
2008-10-07 08:28:21 -04:00
|
|
|
|
(setq method (or method org-attach-method))
|
2022-06-09 05:33:49 -04:00
|
|
|
|
(when (file-directory-p file)
|
|
|
|
|
(setq file (directory-file-name file)))
|
2008-10-01 03:25:18 -04:00
|
|
|
|
(let ((basename (file-name-nondirectory file)))
|
org-attach*, org, org-manual, org-news, ox-html, testing/*
* lisp/org-attach.el
Changed the way attachments deal with property-inheritance. It now
adheres to the =org-use-property-inheritance= setting by default but
it can be customized if needed (I recommend to enable it!).
The property ATTACH_DIR is deprecated in favour of the shorter and simpler
property DIR.
Added an explicit option to =org-attach= for unsetting
attachment-directories (i.e. remove DIR property and deal with the
attachments by interaction).
Added attachment link type with the prefix "attachment:".
Added customizations:
- org-attach-dir-relative
- org-attach-preferred-new-method
- org-attach-use-inheritance
- org-attach-id-to-path-function
Hooks added:
- org-attach-after-change-hook
- org-attach-open-hook
A new linktype "attachment" is added in order to reduce
link-duplication when wanting to link to files in attached folders of
nodes. This works for both ID and DIR properties. The goal is to
make the functionality for attachment links mirror the functionality
for file links.
* lisp/org-attach-git.el
New file, existing functionality. Code here has been factored out
from org-attach.el and if GIT-functionality is to be used this module
needs to be required sepatately. It extends org-attach by use of its
hooks.
Activating git functionality in org-attach is done by loading
org-attach-git from now on, instead of customizing a variable.
Naming of both functions and tests has been modified to match the move
of functionality into its own module.
* lisp/org.el
Inline images are shown also using attachment-links, exactly the same
as it works for file-links today.
Make org-open-at-point respect ARG when opening attachment-dir.
* lisp/org-compat.el
org-attach-directory has been deprecated in favour for
org-attach-id-dir. The new name matches its purpose better.
* lisp/ox-html.el
Export attachment links to images as inline images, in the same way as
file links work today.
* etc/ORG-NEWS
Mention the changes in this patch.
* doc/org-manual.org
The chapter "Refile, Copy, Archive" has been split into two separate
chapters.
- "Refile, Copy and Archiving" for information related to moving
existing data around.
- "Capture, Attachments, RSS Feeds and Protocols" for information
related to working with external data.
The attachment-part has been rewritten and extended to match the
changes in this patch.
The new attachment link type is mentioned both inside the attachments
chapter and in the chapter dealing with links.
Documentation related to external links has been improved.
* testing/lisp/test-org-attach-annex.el
Require org-attach-git instead of org-attach, since this file tests
the GIT-functionality.
* testing/lisp/test-org-attach.el
Add tests for org-attach.
* testing/org-test.el
Define a symbol for a file to test attachments with.
* testing/examples/*
A bunch of new example files and folders are created and are used in
testing of org-attach to verify its functionality.
2018-11-25 15:38:44 -05:00
|
|
|
|
(let* ((attach-dir (org-attach-dir 'get-create))
|
2020-01-19 04:22:44 -05:00
|
|
|
|
(attach-file (expand-file-name basename attach-dir)))
|
2008-10-07 08:28:21 -04:00
|
|
|
|
(cond
|
2020-01-19 04:22:44 -05:00
|
|
|
|
((eq method 'mv) (rename-file file attach-file))
|
2022-06-09 05:33:49 -04:00
|
|
|
|
((eq method 'cp)
|
|
|
|
|
(if (file-directory-p file)
|
|
|
|
|
(copy-directory file attach-file nil nil t)
|
|
|
|
|
(copy-file file attach-file)))
|
2020-01-19 04:22:44 -05:00
|
|
|
|
((eq method 'ln) (add-name-to-file file attach-file))
|
2022-04-29 23:27:30 -04:00
|
|
|
|
((eq method 'lns) (make-symbolic-link file attach-file 1))
|
2022-06-12 10:37:42 -04:00
|
|
|
|
((eq method 'url)
|
|
|
|
|
(if (org--should-fetch-remote-resource-p file)
|
|
|
|
|
(url-copy-file file attach-file)
|
2023-10-13 08:34:39 -04:00
|
|
|
|
(error "The remote resource %S is considered unsafe, and will not be downloaded"
|
2022-06-12 10:37:42 -04:00
|
|
|
|
file))))
|
org-attach*, org, org-manual, org-news, ox-html, testing/*
* lisp/org-attach.el
Changed the way attachments deal with property-inheritance. It now
adheres to the =org-use-property-inheritance= setting by default but
it can be customized if needed (I recommend to enable it!).
The property ATTACH_DIR is deprecated in favour of the shorter and simpler
property DIR.
Added an explicit option to =org-attach= for unsetting
attachment-directories (i.e. remove DIR property and deal with the
attachments by interaction).
Added attachment link type with the prefix "attachment:".
Added customizations:
- org-attach-dir-relative
- org-attach-preferred-new-method
- org-attach-use-inheritance
- org-attach-id-to-path-function
Hooks added:
- org-attach-after-change-hook
- org-attach-open-hook
A new linktype "attachment" is added in order to reduce
link-duplication when wanting to link to files in attached folders of
nodes. This works for both ID and DIR properties. The goal is to
make the functionality for attachment links mirror the functionality
for file links.
* lisp/org-attach-git.el
New file, existing functionality. Code here has been factored out
from org-attach.el and if GIT-functionality is to be used this module
needs to be required sepatately. It extends org-attach by use of its
hooks.
Activating git functionality in org-attach is done by loading
org-attach-git from now on, instead of customizing a variable.
Naming of both functions and tests has been modified to match the move
of functionality into its own module.
* lisp/org.el
Inline images are shown also using attachment-links, exactly the same
as it works for file-links today.
Make org-open-at-point respect ARG when opening attachment-dir.
* lisp/org-compat.el
org-attach-directory has been deprecated in favour for
org-attach-id-dir. The new name matches its purpose better.
* lisp/ox-html.el
Export attachment links to images as inline images, in the same way as
file links work today.
* etc/ORG-NEWS
Mention the changes in this patch.
* doc/org-manual.org
The chapter "Refile, Copy, Archive" has been split into two separate
chapters.
- "Refile, Copy and Archiving" for information related to moving
existing data around.
- "Capture, Attachments, RSS Feeds and Protocols" for information
related to working with external data.
The attachment-part has been rewritten and extended to match the
changes in this patch.
The new attachment link type is mentioned both inside the attachments
chapter and in the chapter dealing with links.
Documentation related to external links has been improved.
* testing/lisp/test-org-attach-annex.el
Require org-attach-git instead of org-attach, since this file tests
the GIT-functionality.
* testing/lisp/test-org-attach.el
Add tests for org-attach.
* testing/org-test.el
Define a symbol for a file to test attachments with.
* testing/examples/*
A bunch of new example files and folders are created and are used in
testing of org-attach to verify its functionality.
2018-11-25 15:38:44 -05:00
|
|
|
|
(run-hook-with-args 'org-attach-after-change-hook attach-dir)
|
2008-10-06 03:38:50 -04:00
|
|
|
|
(org-attach-tag)
|
2011-03-10 05:25:17 -05:00
|
|
|
|
(cond ((eq org-attach-store-link-p 'attached)
|
2020-01-19 04:22:44 -05:00
|
|
|
|
(push (list (concat "attachment:" (file-name-nondirectory attach-file))
|
|
|
|
|
(file-name-nondirectory attach-file))
|
2019-12-13 17:01:10 -05:00
|
|
|
|
org-stored-links))
|
2017-05-09 11:30:18 -04:00
|
|
|
|
((eq org-attach-store-link-p t)
|
2022-11-04 22:54:17 -04:00
|
|
|
|
(push (list (concat "file:" file)
|
|
|
|
|
(file-name-nondirectory file))
|
2020-01-19 04:29:36 -05:00
|
|
|
|
org-stored-links))
|
|
|
|
|
((eq org-attach-store-link-p 'file)
|
|
|
|
|
(push (list (concat "file:" attach-file)
|
|
|
|
|
(file-name-nondirectory attach-file))
|
2019-12-13 17:01:10 -05:00
|
|
|
|
org-stored-links)))
|
2008-10-01 03:25:18 -04:00
|
|
|
|
(if visit-dir
|
2017-05-09 11:30:18 -04:00
|
|
|
|
(dired attach-dir)
|
2020-01-26 13:16:01 -05:00
|
|
|
|
(message "File %S is now an attachment" basename)))))
|
2008-10-01 03:25:18 -04:00
|
|
|
|
|
2008-10-07 08:28:21 -04:00
|
|
|
|
(defun org-attach-attach-cp ()
|
2008-10-09 06:19:43 -04:00
|
|
|
|
"Attach a file by copying it."
|
2008-10-07 08:28:21 -04:00
|
|
|
|
(interactive)
|
|
|
|
|
(let ((org-attach-method 'cp)) (call-interactively 'org-attach-attach)))
|
|
|
|
|
(defun org-attach-attach-mv ()
|
2008-10-09 06:19:43 -04:00
|
|
|
|
"Attach a file by moving (renaming) it."
|
2008-10-07 08:28:21 -04:00
|
|
|
|
(interactive)
|
|
|
|
|
(let ((org-attach-method 'mv)) (call-interactively 'org-attach-attach)))
|
|
|
|
|
(defun org-attach-attach-ln ()
|
2008-10-09 06:19:43 -04:00
|
|
|
|
"Attach a file by creating a hard link to it.
|
|
|
|
|
Beware that this does not work on systems that do not support hard links.
|
|
|
|
|
On some systems, this apparently does copy the file instead."
|
|
|
|
|
(interactive)
|
2008-10-07 08:28:21 -04:00
|
|
|
|
(let ((org-attach-method 'ln)) (call-interactively 'org-attach-attach)))
|
2012-04-12 14:20:39 -04:00
|
|
|
|
(defun org-attach-attach-lns ()
|
|
|
|
|
"Attach a file by creating a symbolic link to it.
|
|
|
|
|
|
|
|
|
|
Beware that this does not work on systems that do not support symbolic links.
|
|
|
|
|
On some systems, this apparently does copy the file instead."
|
|
|
|
|
(interactive)
|
|
|
|
|
(let ((org-attach-method 'lns)) (call-interactively 'org-attach-attach)))
|
2008-10-07 08:28:21 -04:00
|
|
|
|
|
2008-10-01 03:25:18 -04:00
|
|
|
|
(defun org-attach-new (file)
|
org-attach*, org, org-manual, org-news, ox-html, testing/*
* lisp/org-attach.el
Changed the way attachments deal with property-inheritance. It now
adheres to the =org-use-property-inheritance= setting by default but
it can be customized if needed (I recommend to enable it!).
The property ATTACH_DIR is deprecated in favour of the shorter and simpler
property DIR.
Added an explicit option to =org-attach= for unsetting
attachment-directories (i.e. remove DIR property and deal with the
attachments by interaction).
Added attachment link type with the prefix "attachment:".
Added customizations:
- org-attach-dir-relative
- org-attach-preferred-new-method
- org-attach-use-inheritance
- org-attach-id-to-path-function
Hooks added:
- org-attach-after-change-hook
- org-attach-open-hook
A new linktype "attachment" is added in order to reduce
link-duplication when wanting to link to files in attached folders of
nodes. This works for both ID and DIR properties. The goal is to
make the functionality for attachment links mirror the functionality
for file links.
* lisp/org-attach-git.el
New file, existing functionality. Code here has been factored out
from org-attach.el and if GIT-functionality is to be used this module
needs to be required sepatately. It extends org-attach by use of its
hooks.
Activating git functionality in org-attach is done by loading
org-attach-git from now on, instead of customizing a variable.
Naming of both functions and tests has been modified to match the move
of functionality into its own module.
* lisp/org.el
Inline images are shown also using attachment-links, exactly the same
as it works for file-links today.
Make org-open-at-point respect ARG when opening attachment-dir.
* lisp/org-compat.el
org-attach-directory has been deprecated in favour for
org-attach-id-dir. The new name matches its purpose better.
* lisp/ox-html.el
Export attachment links to images as inline images, in the same way as
file links work today.
* etc/ORG-NEWS
Mention the changes in this patch.
* doc/org-manual.org
The chapter "Refile, Copy, Archive" has been split into two separate
chapters.
- "Refile, Copy and Archiving" for information related to moving
existing data around.
- "Capture, Attachments, RSS Feeds and Protocols" for information
related to working with external data.
The attachment-part has been rewritten and extended to match the
changes in this patch.
The new attachment link type is mentioned both inside the attachments
chapter and in the chapter dealing with links.
Documentation related to external links has been improved.
* testing/lisp/test-org-attach-annex.el
Require org-attach-git instead of org-attach, since this file tests
the GIT-functionality.
* testing/lisp/test-org-attach.el
Add tests for org-attach.
* testing/org-test.el
Define a symbol for a file to test attachments with.
* testing/examples/*
A bunch of new example files and folders are created and are used in
testing of org-attach to verify its functionality.
2018-11-25 15:38:44 -05:00
|
|
|
|
"Create a new attachment FILE for the current outline node.
|
2008-10-01 03:25:18 -04:00
|
|
|
|
The attachment is created as an Emacs buffer."
|
|
|
|
|
(interactive "sCreate attachment named: ")
|
org-attach*, org, org-manual, org-news, ox-html, testing/*
* lisp/org-attach.el
Changed the way attachments deal with property-inheritance. It now
adheres to the =org-use-property-inheritance= setting by default but
it can be customized if needed (I recommend to enable it!).
The property ATTACH_DIR is deprecated in favour of the shorter and simpler
property DIR.
Added an explicit option to =org-attach= for unsetting
attachment-directories (i.e. remove DIR property and deal with the
attachments by interaction).
Added attachment link type with the prefix "attachment:".
Added customizations:
- org-attach-dir-relative
- org-attach-preferred-new-method
- org-attach-use-inheritance
- org-attach-id-to-path-function
Hooks added:
- org-attach-after-change-hook
- org-attach-open-hook
A new linktype "attachment" is added in order to reduce
link-duplication when wanting to link to files in attached folders of
nodes. This works for both ID and DIR properties. The goal is to
make the functionality for attachment links mirror the functionality
for file links.
* lisp/org-attach-git.el
New file, existing functionality. Code here has been factored out
from org-attach.el and if GIT-functionality is to be used this module
needs to be required sepatately. It extends org-attach by use of its
hooks.
Activating git functionality in org-attach is done by loading
org-attach-git from now on, instead of customizing a variable.
Naming of both functions and tests has been modified to match the move
of functionality into its own module.
* lisp/org.el
Inline images are shown also using attachment-links, exactly the same
as it works for file-links today.
Make org-open-at-point respect ARG when opening attachment-dir.
* lisp/org-compat.el
org-attach-directory has been deprecated in favour for
org-attach-id-dir. The new name matches its purpose better.
* lisp/ox-html.el
Export attachment links to images as inline images, in the same way as
file links work today.
* etc/ORG-NEWS
Mention the changes in this patch.
* doc/org-manual.org
The chapter "Refile, Copy, Archive" has been split into two separate
chapters.
- "Refile, Copy and Archiving" for information related to moving
existing data around.
- "Capture, Attachments, RSS Feeds and Protocols" for information
related to working with external data.
The attachment-part has been rewritten and extended to match the
changes in this patch.
The new attachment link type is mentioned both inside the attachments
chapter and in the chapter dealing with links.
Documentation related to external links has been improved.
* testing/lisp/test-org-attach-annex.el
Require org-attach-git instead of org-attach, since this file tests
the GIT-functionality.
* testing/lisp/test-org-attach.el
Add tests for org-attach.
* testing/org-test.el
Define a symbol for a file to test attachments with.
* testing/examples/*
A bunch of new example files and folders are created and are used in
testing of org-attach to verify its functionality.
2018-11-25 15:38:44 -05:00
|
|
|
|
(let ((attach-dir (org-attach-dir 'get-create)))
|
2008-10-06 03:38:50 -04:00
|
|
|
|
(org-attach-tag)
|
2008-10-01 03:25:18 -04:00
|
|
|
|
(find-file (expand-file-name file attach-dir))
|
|
|
|
|
(message "New attachment %s" file)))
|
|
|
|
|
|
2021-09-30 16:07:15 -04:00
|
|
|
|
(defun org-attach-delete-one (&optional attachment)
|
|
|
|
|
"Delete a single ATTACHMENT."
|
2008-10-09 06:19:43 -04:00
|
|
|
|
(interactive)
|
org-attach*, org, org-manual, org-news, ox-html, testing/*
* lisp/org-attach.el
Changed the way attachments deal with property-inheritance. It now
adheres to the =org-use-property-inheritance= setting by default but
it can be customized if needed (I recommend to enable it!).
The property ATTACH_DIR is deprecated in favour of the shorter and simpler
property DIR.
Added an explicit option to =org-attach= for unsetting
attachment-directories (i.e. remove DIR property and deal with the
attachments by interaction).
Added attachment link type with the prefix "attachment:".
Added customizations:
- org-attach-dir-relative
- org-attach-preferred-new-method
- org-attach-use-inheritance
- org-attach-id-to-path-function
Hooks added:
- org-attach-after-change-hook
- org-attach-open-hook
A new linktype "attachment" is added in order to reduce
link-duplication when wanting to link to files in attached folders of
nodes. This works for both ID and DIR properties. The goal is to
make the functionality for attachment links mirror the functionality
for file links.
* lisp/org-attach-git.el
New file, existing functionality. Code here has been factored out
from org-attach.el and if GIT-functionality is to be used this module
needs to be required sepatately. It extends org-attach by use of its
hooks.
Activating git functionality in org-attach is done by loading
org-attach-git from now on, instead of customizing a variable.
Naming of both functions and tests has been modified to match the move
of functionality into its own module.
* lisp/org.el
Inline images are shown also using attachment-links, exactly the same
as it works for file-links today.
Make org-open-at-point respect ARG when opening attachment-dir.
* lisp/org-compat.el
org-attach-directory has been deprecated in favour for
org-attach-id-dir. The new name matches its purpose better.
* lisp/ox-html.el
Export attachment links to images as inline images, in the same way as
file links work today.
* etc/ORG-NEWS
Mention the changes in this patch.
* doc/org-manual.org
The chapter "Refile, Copy, Archive" has been split into two separate
chapters.
- "Refile, Copy and Archiving" for information related to moving
existing data around.
- "Capture, Attachments, RSS Feeds and Protocols" for information
related to working with external data.
The attachment-part has been rewritten and extended to match the
changes in this patch.
The new attachment link type is mentioned both inside the attachments
chapter and in the chapter dealing with links.
Documentation related to external links has been improved.
* testing/lisp/test-org-attach-annex.el
Require org-attach-git instead of org-attach, since this file tests
the GIT-functionality.
* testing/lisp/test-org-attach.el
Add tests for org-attach.
* testing/org-test.el
Define a symbol for a file to test attachments with.
* testing/examples/*
A bunch of new example files and folders are created and are used in
testing of org-attach to verify its functionality.
2018-11-25 15:38:44 -05:00
|
|
|
|
(let* ((attach-dir (org-attach-dir))
|
2008-10-09 06:19:43 -04:00
|
|
|
|
(files (org-attach-file-list attach-dir))
|
2021-09-30 16:07:15 -04:00
|
|
|
|
(attachment (or attachment
|
2015-12-22 08:49:23 -05:00
|
|
|
|
(completing-read
|
2008-10-09 06:19:43 -04:00
|
|
|
|
"Delete attachment: "
|
|
|
|
|
(mapcar (lambda (f)
|
|
|
|
|
(list (file-name-nondirectory f)))
|
|
|
|
|
files)))))
|
2021-09-30 16:07:15 -04:00
|
|
|
|
(setq attachment (expand-file-name attachment attach-dir))
|
|
|
|
|
(unless (file-exists-p attachment)
|
|
|
|
|
(error "No such attachment: %s" attachment))
|
|
|
|
|
(delete-file attachment)
|
org-attach*, org, org-manual, org-news, ox-html, testing/*
* lisp/org-attach.el
Changed the way attachments deal with property-inheritance. It now
adheres to the =org-use-property-inheritance= setting by default but
it can be customized if needed (I recommend to enable it!).
The property ATTACH_DIR is deprecated in favour of the shorter and simpler
property DIR.
Added an explicit option to =org-attach= for unsetting
attachment-directories (i.e. remove DIR property and deal with the
attachments by interaction).
Added attachment link type with the prefix "attachment:".
Added customizations:
- org-attach-dir-relative
- org-attach-preferred-new-method
- org-attach-use-inheritance
- org-attach-id-to-path-function
Hooks added:
- org-attach-after-change-hook
- org-attach-open-hook
A new linktype "attachment" is added in order to reduce
link-duplication when wanting to link to files in attached folders of
nodes. This works for both ID and DIR properties. The goal is to
make the functionality for attachment links mirror the functionality
for file links.
* lisp/org-attach-git.el
New file, existing functionality. Code here has been factored out
from org-attach.el and if GIT-functionality is to be used this module
needs to be required sepatately. It extends org-attach by use of its
hooks.
Activating git functionality in org-attach is done by loading
org-attach-git from now on, instead of customizing a variable.
Naming of both functions and tests has been modified to match the move
of functionality into its own module.
* lisp/org.el
Inline images are shown also using attachment-links, exactly the same
as it works for file-links today.
Make org-open-at-point respect ARG when opening attachment-dir.
* lisp/org-compat.el
org-attach-directory has been deprecated in favour for
org-attach-id-dir. The new name matches its purpose better.
* lisp/ox-html.el
Export attachment links to images as inline images, in the same way as
file links work today.
* etc/ORG-NEWS
Mention the changes in this patch.
* doc/org-manual.org
The chapter "Refile, Copy, Archive" has been split into two separate
chapters.
- "Refile, Copy and Archiving" for information related to moving
existing data around.
- "Capture, Attachments, RSS Feeds and Protocols" for information
related to working with external data.
The attachment-part has been rewritten and extended to match the
changes in this patch.
The new attachment link type is mentioned both inside the attachments
chapter and in the chapter dealing with links.
Documentation related to external links has been improved.
* testing/lisp/test-org-attach-annex.el
Require org-attach-git instead of org-attach, since this file tests
the GIT-functionality.
* testing/lisp/test-org-attach.el
Add tests for org-attach.
* testing/org-test.el
Define a symbol for a file to test attachments with.
* testing/examples/*
A bunch of new example files and folders are created and are used in
testing of org-attach to verify its functionality.
2018-11-25 15:38:44 -05:00
|
|
|
|
(run-hook-with-args 'org-attach-after-change-hook attach-dir)))
|
2008-10-09 06:19:43 -04:00
|
|
|
|
|
|
|
|
|
(defun org-attach-delete-all (&optional force)
|
org-attach*, org, org-manual, org-news, ox-html, testing/*
* lisp/org-attach.el
Changed the way attachments deal with property-inheritance. It now
adheres to the =org-use-property-inheritance= setting by default but
it can be customized if needed (I recommend to enable it!).
The property ATTACH_DIR is deprecated in favour of the shorter and simpler
property DIR.
Added an explicit option to =org-attach= for unsetting
attachment-directories (i.e. remove DIR property and deal with the
attachments by interaction).
Added attachment link type with the prefix "attachment:".
Added customizations:
- org-attach-dir-relative
- org-attach-preferred-new-method
- org-attach-use-inheritance
- org-attach-id-to-path-function
Hooks added:
- org-attach-after-change-hook
- org-attach-open-hook
A new linktype "attachment" is added in order to reduce
link-duplication when wanting to link to files in attached folders of
nodes. This works for both ID and DIR properties. The goal is to
make the functionality for attachment links mirror the functionality
for file links.
* lisp/org-attach-git.el
New file, existing functionality. Code here has been factored out
from org-attach.el and if GIT-functionality is to be used this module
needs to be required sepatately. It extends org-attach by use of its
hooks.
Activating git functionality in org-attach is done by loading
org-attach-git from now on, instead of customizing a variable.
Naming of both functions and tests has been modified to match the move
of functionality into its own module.
* lisp/org.el
Inline images are shown also using attachment-links, exactly the same
as it works for file-links today.
Make org-open-at-point respect ARG when opening attachment-dir.
* lisp/org-compat.el
org-attach-directory has been deprecated in favour for
org-attach-id-dir. The new name matches its purpose better.
* lisp/ox-html.el
Export attachment links to images as inline images, in the same way as
file links work today.
* etc/ORG-NEWS
Mention the changes in this patch.
* doc/org-manual.org
The chapter "Refile, Copy, Archive" has been split into two separate
chapters.
- "Refile, Copy and Archiving" for information related to moving
existing data around.
- "Capture, Attachments, RSS Feeds and Protocols" for information
related to working with external data.
The attachment-part has been rewritten and extended to match the
changes in this patch.
The new attachment link type is mentioned both inside the attachments
chapter and in the chapter dealing with links.
Documentation related to external links has been improved.
* testing/lisp/test-org-attach-annex.el
Require org-attach-git instead of org-attach, since this file tests
the GIT-functionality.
* testing/lisp/test-org-attach.el
Add tests for org-attach.
* testing/org-test.el
Define a symbol for a file to test attachments with.
* testing/examples/*
A bunch of new example files and folders are created and are used in
testing of org-attach to verify its functionality.
2018-11-25 15:38:44 -05:00
|
|
|
|
"Delete all attachments from the current outline node.
|
2008-10-09 06:19:43 -04:00
|
|
|
|
This actually deletes the entire attachment directory.
|
2021-09-30 16:07:15 -04:00
|
|
|
|
A safer way is to open the directory in `dired' and delete from there.
|
2020-03-03 09:14:44 -05:00
|
|
|
|
|
|
|
|
|
With prefix argument FORCE, directory will be recursively deleted
|
|
|
|
|
with no prompts."
|
2008-10-09 06:19:43 -04:00
|
|
|
|
(interactive "P")
|
2008-10-01 03:25:18 -04:00
|
|
|
|
(let ((attach-dir (org-attach-dir)))
|
org-attach*, org, org-manual, org-news, ox-html, testing/*
* lisp/org-attach.el
Changed the way attachments deal with property-inheritance. It now
adheres to the =org-use-property-inheritance= setting by default but
it can be customized if needed (I recommend to enable it!).
The property ATTACH_DIR is deprecated in favour of the shorter and simpler
property DIR.
Added an explicit option to =org-attach= for unsetting
attachment-directories (i.e. remove DIR property and deal with the
attachments by interaction).
Added attachment link type with the prefix "attachment:".
Added customizations:
- org-attach-dir-relative
- org-attach-preferred-new-method
- org-attach-use-inheritance
- org-attach-id-to-path-function
Hooks added:
- org-attach-after-change-hook
- org-attach-open-hook
A new linktype "attachment" is added in order to reduce
link-duplication when wanting to link to files in attached folders of
nodes. This works for both ID and DIR properties. The goal is to
make the functionality for attachment links mirror the functionality
for file links.
* lisp/org-attach-git.el
New file, existing functionality. Code here has been factored out
from org-attach.el and if GIT-functionality is to be used this module
needs to be required sepatately. It extends org-attach by use of its
hooks.
Activating git functionality in org-attach is done by loading
org-attach-git from now on, instead of customizing a variable.
Naming of both functions and tests has been modified to match the move
of functionality into its own module.
* lisp/org.el
Inline images are shown also using attachment-links, exactly the same
as it works for file-links today.
Make org-open-at-point respect ARG when opening attachment-dir.
* lisp/org-compat.el
org-attach-directory has been deprecated in favour for
org-attach-id-dir. The new name matches its purpose better.
* lisp/ox-html.el
Export attachment links to images as inline images, in the same way as
file links work today.
* etc/ORG-NEWS
Mention the changes in this patch.
* doc/org-manual.org
The chapter "Refile, Copy, Archive" has been split into two separate
chapters.
- "Refile, Copy and Archiving" for information related to moving
existing data around.
- "Capture, Attachments, RSS Feeds and Protocols" for information
related to working with external data.
The attachment-part has been rewritten and extended to match the
changes in this patch.
The new attachment link type is mentioned both inside the attachments
chapter and in the chapter dealing with links.
Documentation related to external links has been improved.
* testing/lisp/test-org-attach-annex.el
Require org-attach-git instead of org-attach, since this file tests
the GIT-functionality.
* testing/lisp/test-org-attach.el
Add tests for org-attach.
* testing/org-test.el
Define a symbol for a file to test attachments with.
* testing/examples/*
A bunch of new example files and folders are created and are used in
testing of org-attach to verify its functionality.
2018-11-25 15:38:44 -05:00
|
|
|
|
(when (and attach-dir
|
|
|
|
|
(or force
|
|
|
|
|
(yes-or-no-p "Really remove all attachments of this entry? ")))
|
2020-03-03 09:14:44 -05:00
|
|
|
|
(delete-directory attach-dir
|
|
|
|
|
(or force (yes-or-no-p "Recursive?"))
|
|
|
|
|
t)
|
2008-10-09 06:19:43 -04:00
|
|
|
|
(message "Attachment directory removed")
|
org-attach*, org, org-manual, org-news, ox-html, testing/*
* lisp/org-attach.el
Changed the way attachments deal with property-inheritance. It now
adheres to the =org-use-property-inheritance= setting by default but
it can be customized if needed (I recommend to enable it!).
The property ATTACH_DIR is deprecated in favour of the shorter and simpler
property DIR.
Added an explicit option to =org-attach= for unsetting
attachment-directories (i.e. remove DIR property and deal with the
attachments by interaction).
Added attachment link type with the prefix "attachment:".
Added customizations:
- org-attach-dir-relative
- org-attach-preferred-new-method
- org-attach-use-inheritance
- org-attach-id-to-path-function
Hooks added:
- org-attach-after-change-hook
- org-attach-open-hook
A new linktype "attachment" is added in order to reduce
link-duplication when wanting to link to files in attached folders of
nodes. This works for both ID and DIR properties. The goal is to
make the functionality for attachment links mirror the functionality
for file links.
* lisp/org-attach-git.el
New file, existing functionality. Code here has been factored out
from org-attach.el and if GIT-functionality is to be used this module
needs to be required sepatately. It extends org-attach by use of its
hooks.
Activating git functionality in org-attach is done by loading
org-attach-git from now on, instead of customizing a variable.
Naming of both functions and tests has been modified to match the move
of functionality into its own module.
* lisp/org.el
Inline images are shown also using attachment-links, exactly the same
as it works for file-links today.
Make org-open-at-point respect ARG when opening attachment-dir.
* lisp/org-compat.el
org-attach-directory has been deprecated in favour for
org-attach-id-dir. The new name matches its purpose better.
* lisp/ox-html.el
Export attachment links to images as inline images, in the same way as
file links work today.
* etc/ORG-NEWS
Mention the changes in this patch.
* doc/org-manual.org
The chapter "Refile, Copy, Archive" has been split into two separate
chapters.
- "Refile, Copy and Archiving" for information related to moving
existing data around.
- "Capture, Attachments, RSS Feeds and Protocols" for information
related to working with external data.
The attachment-part has been rewritten and extended to match the
changes in this patch.
The new attachment link type is mentioned both inside the attachments
chapter and in the chapter dealing with links.
Documentation related to external links has been improved.
* testing/lisp/test-org-attach-annex.el
Require org-attach-git instead of org-attach, since this file tests
the GIT-functionality.
* testing/lisp/test-org-attach.el
Add tests for org-attach.
* testing/org-test.el
Define a symbol for a file to test attachments with.
* testing/examples/*
A bunch of new example files and folders are created and are used in
testing of org-attach to verify its functionality.
2018-11-25 15:38:44 -05:00
|
|
|
|
(run-hook-with-args 'org-attach-after-change-hook attach-dir)
|
2008-10-09 06:19:43 -04:00
|
|
|
|
(org-attach-untag))))
|
2008-10-01 03:25:18 -04:00
|
|
|
|
|
|
|
|
|
(defun org-attach-sync ()
|
org-attach*, org, org-manual, org-news, ox-html, testing/*
* lisp/org-attach.el
Changed the way attachments deal with property-inheritance. It now
adheres to the =org-use-property-inheritance= setting by default but
it can be customized if needed (I recommend to enable it!).
The property ATTACH_DIR is deprecated in favour of the shorter and simpler
property DIR.
Added an explicit option to =org-attach= for unsetting
attachment-directories (i.e. remove DIR property and deal with the
attachments by interaction).
Added attachment link type with the prefix "attachment:".
Added customizations:
- org-attach-dir-relative
- org-attach-preferred-new-method
- org-attach-use-inheritance
- org-attach-id-to-path-function
Hooks added:
- org-attach-after-change-hook
- org-attach-open-hook
A new linktype "attachment" is added in order to reduce
link-duplication when wanting to link to files in attached folders of
nodes. This works for both ID and DIR properties. The goal is to
make the functionality for attachment links mirror the functionality
for file links.
* lisp/org-attach-git.el
New file, existing functionality. Code here has been factored out
from org-attach.el and if GIT-functionality is to be used this module
needs to be required sepatately. It extends org-attach by use of its
hooks.
Activating git functionality in org-attach is done by loading
org-attach-git from now on, instead of customizing a variable.
Naming of both functions and tests has been modified to match the move
of functionality into its own module.
* lisp/org.el
Inline images are shown also using attachment-links, exactly the same
as it works for file-links today.
Make org-open-at-point respect ARG when opening attachment-dir.
* lisp/org-compat.el
org-attach-directory has been deprecated in favour for
org-attach-id-dir. The new name matches its purpose better.
* lisp/ox-html.el
Export attachment links to images as inline images, in the same way as
file links work today.
* etc/ORG-NEWS
Mention the changes in this patch.
* doc/org-manual.org
The chapter "Refile, Copy, Archive" has been split into two separate
chapters.
- "Refile, Copy and Archiving" for information related to moving
existing data around.
- "Capture, Attachments, RSS Feeds and Protocols" for information
related to working with external data.
The attachment-part has been rewritten and extended to match the
changes in this patch.
The new attachment link type is mentioned both inside the attachments
chapter and in the chapter dealing with links.
Documentation related to external links has been improved.
* testing/lisp/test-org-attach-annex.el
Require org-attach-git instead of org-attach, since this file tests
the GIT-functionality.
* testing/lisp/test-org-attach.el
Add tests for org-attach.
* testing/org-test.el
Define a symbol for a file to test attachments with.
* testing/examples/*
A bunch of new example files and folders are created and are used in
testing of org-attach to verify its functionality.
2018-11-25 15:38:44 -05:00
|
|
|
|
"Synchronize the current outline node with its attachments.
|
2021-07-09 15:03:44 -04:00
|
|
|
|
Useful after files have been added/removed externally. Option
|
|
|
|
|
`org-attach-sync-delete-empty-dir' controls the behavior for
|
|
|
|
|
empty attachment directories."
|
2008-10-01 03:25:18 -04:00
|
|
|
|
(interactive)
|
|
|
|
|
(let ((attach-dir (org-attach-dir)))
|
2021-07-09 15:03:44 -04:00
|
|
|
|
(if (not attach-dir)
|
|
|
|
|
(org-attach-tag 'off)
|
org-attach*, org, org-manual, org-news, ox-html, testing/*
* lisp/org-attach.el
Changed the way attachments deal with property-inheritance. It now
adheres to the =org-use-property-inheritance= setting by default but
it can be customized if needed (I recommend to enable it!).
The property ATTACH_DIR is deprecated in favour of the shorter and simpler
property DIR.
Added an explicit option to =org-attach= for unsetting
attachment-directories (i.e. remove DIR property and deal with the
attachments by interaction).
Added attachment link type with the prefix "attachment:".
Added customizations:
- org-attach-dir-relative
- org-attach-preferred-new-method
- org-attach-use-inheritance
- org-attach-id-to-path-function
Hooks added:
- org-attach-after-change-hook
- org-attach-open-hook
A new linktype "attachment" is added in order to reduce
link-duplication when wanting to link to files in attached folders of
nodes. This works for both ID and DIR properties. The goal is to
make the functionality for attachment links mirror the functionality
for file links.
* lisp/org-attach-git.el
New file, existing functionality. Code here has been factored out
from org-attach.el and if GIT-functionality is to be used this module
needs to be required sepatately. It extends org-attach by use of its
hooks.
Activating git functionality in org-attach is done by loading
org-attach-git from now on, instead of customizing a variable.
Naming of both functions and tests has been modified to match the move
of functionality into its own module.
* lisp/org.el
Inline images are shown also using attachment-links, exactly the same
as it works for file-links today.
Make org-open-at-point respect ARG when opening attachment-dir.
* lisp/org-compat.el
org-attach-directory has been deprecated in favour for
org-attach-id-dir. The new name matches its purpose better.
* lisp/ox-html.el
Export attachment links to images as inline images, in the same way as
file links work today.
* etc/ORG-NEWS
Mention the changes in this patch.
* doc/org-manual.org
The chapter "Refile, Copy, Archive" has been split into two separate
chapters.
- "Refile, Copy and Archiving" for information related to moving
existing data around.
- "Capture, Attachments, RSS Feeds and Protocols" for information
related to working with external data.
The attachment-part has been rewritten and extended to match the
changes in this patch.
The new attachment link type is mentioned both inside the attachments
chapter and in the chapter dealing with links.
Documentation related to external links has been improved.
* testing/lisp/test-org-attach-annex.el
Require org-attach-git instead of org-attach, since this file tests
the GIT-functionality.
* testing/lisp/test-org-attach.el
Add tests for org-attach.
* testing/org-test.el
Define a symbol for a file to test attachments with.
* testing/examples/*
A bunch of new example files and folders are created and are used in
testing of org-attach to verify its functionality.
2018-11-25 15:38:44 -05:00
|
|
|
|
(run-hook-with-args 'org-attach-after-change-hook attach-dir)
|
2008-10-08 06:46:40 -04:00
|
|
|
|
(let ((files (org-attach-file-list attach-dir)))
|
2021-07-09 15:03:44 -04:00
|
|
|
|
(org-attach-tag (not files)))
|
|
|
|
|
(when org-attach-sync-delete-empty-dir
|
2021-08-10 16:02:40 -04:00
|
|
|
|
(when (and (org-directory-empty-p attach-dir)
|
2021-07-09 15:03:44 -04:00
|
|
|
|
(if (eq 'query org-attach-sync-delete-empty-dir)
|
|
|
|
|
(yes-or-no-p "Attachment directory is empty. Delete?")
|
|
|
|
|
t))
|
|
|
|
|
(delete-directory attach-dir))))))
|
2008-10-08 06:46:40 -04:00
|
|
|
|
|
2021-09-30 16:07:15 -04:00
|
|
|
|
(defun org-attach-file-list (directory)
|
|
|
|
|
"Return a list of files in the attachment DIRECTORY.
|
2014-03-18 12:17:41 -04:00
|
|
|
|
This ignores files ending in \"~\"."
|
2008-10-08 06:46:40 -04:00
|
|
|
|
(delq nil
|
2014-03-18 12:17:41 -04:00
|
|
|
|
(mapcar (lambda (x) (if (string-match "^\\.\\.?\\'" x) nil x))
|
2021-09-30 16:07:15 -04:00
|
|
|
|
(directory-files directory nil "[^~]\\'"))))
|
2008-10-01 03:25:18 -04:00
|
|
|
|
|
org-attach*, org, org-manual, org-news, ox-html, testing/*
* lisp/org-attach.el
Changed the way attachments deal with property-inheritance. It now
adheres to the =org-use-property-inheritance= setting by default but
it can be customized if needed (I recommend to enable it!).
The property ATTACH_DIR is deprecated in favour of the shorter and simpler
property DIR.
Added an explicit option to =org-attach= for unsetting
attachment-directories (i.e. remove DIR property and deal with the
attachments by interaction).
Added attachment link type with the prefix "attachment:".
Added customizations:
- org-attach-dir-relative
- org-attach-preferred-new-method
- org-attach-use-inheritance
- org-attach-id-to-path-function
Hooks added:
- org-attach-after-change-hook
- org-attach-open-hook
A new linktype "attachment" is added in order to reduce
link-duplication when wanting to link to files in attached folders of
nodes. This works for both ID and DIR properties. The goal is to
make the functionality for attachment links mirror the functionality
for file links.
* lisp/org-attach-git.el
New file, existing functionality. Code here has been factored out
from org-attach.el and if GIT-functionality is to be used this module
needs to be required sepatately. It extends org-attach by use of its
hooks.
Activating git functionality in org-attach is done by loading
org-attach-git from now on, instead of customizing a variable.
Naming of both functions and tests has been modified to match the move
of functionality into its own module.
* lisp/org.el
Inline images are shown also using attachment-links, exactly the same
as it works for file-links today.
Make org-open-at-point respect ARG when opening attachment-dir.
* lisp/org-compat.el
org-attach-directory has been deprecated in favour for
org-attach-id-dir. The new name matches its purpose better.
* lisp/ox-html.el
Export attachment links to images as inline images, in the same way as
file links work today.
* etc/ORG-NEWS
Mention the changes in this patch.
* doc/org-manual.org
The chapter "Refile, Copy, Archive" has been split into two separate
chapters.
- "Refile, Copy and Archiving" for information related to moving
existing data around.
- "Capture, Attachments, RSS Feeds and Protocols" for information
related to working with external data.
The attachment-part has been rewritten and extended to match the
changes in this patch.
The new attachment link type is mentioned both inside the attachments
chapter and in the chapter dealing with links.
Documentation related to external links has been improved.
* testing/lisp/test-org-attach-annex.el
Require org-attach-git instead of org-attach, since this file tests
the GIT-functionality.
* testing/lisp/test-org-attach.el
Add tests for org-attach.
* testing/org-test.el
Define a symbol for a file to test attachments with.
* testing/examples/*
A bunch of new example files and folders are created and are used in
testing of org-attach to verify its functionality.
2018-11-25 15:38:44 -05:00
|
|
|
|
(defun org-attach-reveal ()
|
|
|
|
|
"Show the attachment directory of the current outline node.
|
2019-09-01 08:43:54 -04:00
|
|
|
|
This will attempt to use an external program to show the
|
|
|
|
|
directory. Will create an attachment and folder if it doesn't
|
|
|
|
|
exist yet. Respects `org-attach-preferred-new-method'."
|
org-attach*, org, org-manual, org-news, ox-html, testing/*
* lisp/org-attach.el
Changed the way attachments deal with property-inheritance. It now
adheres to the =org-use-property-inheritance= setting by default but
it can be customized if needed (I recommend to enable it!).
The property ATTACH_DIR is deprecated in favour of the shorter and simpler
property DIR.
Added an explicit option to =org-attach= for unsetting
attachment-directories (i.e. remove DIR property and deal with the
attachments by interaction).
Added attachment link type with the prefix "attachment:".
Added customizations:
- org-attach-dir-relative
- org-attach-preferred-new-method
- org-attach-use-inheritance
- org-attach-id-to-path-function
Hooks added:
- org-attach-after-change-hook
- org-attach-open-hook
A new linktype "attachment" is added in order to reduce
link-duplication when wanting to link to files in attached folders of
nodes. This works for both ID and DIR properties. The goal is to
make the functionality for attachment links mirror the functionality
for file links.
* lisp/org-attach-git.el
New file, existing functionality. Code here has been factored out
from org-attach.el and if GIT-functionality is to be used this module
needs to be required sepatately. It extends org-attach by use of its
hooks.
Activating git functionality in org-attach is done by loading
org-attach-git from now on, instead of customizing a variable.
Naming of both functions and tests has been modified to match the move
of functionality into its own module.
* lisp/org.el
Inline images are shown also using attachment-links, exactly the same
as it works for file-links today.
Make org-open-at-point respect ARG when opening attachment-dir.
* lisp/org-compat.el
org-attach-directory has been deprecated in favour for
org-attach-id-dir. The new name matches its purpose better.
* lisp/ox-html.el
Export attachment links to images as inline images, in the same way as
file links work today.
* etc/ORG-NEWS
Mention the changes in this patch.
* doc/org-manual.org
The chapter "Refile, Copy, Archive" has been split into two separate
chapters.
- "Refile, Copy and Archiving" for information related to moving
existing data around.
- "Capture, Attachments, RSS Feeds and Protocols" for information
related to working with external data.
The attachment-part has been rewritten and extended to match the
changes in this patch.
The new attachment link type is mentioned both inside the attachments
chapter and in the chapter dealing with links.
Documentation related to external links has been improved.
* testing/lisp/test-org-attach-annex.el
Require org-attach-git instead of org-attach, since this file tests
the GIT-functionality.
* testing/lisp/test-org-attach.el
Add tests for org-attach.
* testing/org-test.el
Define a symbol for a file to test attachments with.
* testing/examples/*
A bunch of new example files and folders are created and are used in
testing of org-attach to verify its functionality.
2018-11-25 15:38:44 -05:00
|
|
|
|
(interactive)
|
2019-09-01 08:43:54 -04:00
|
|
|
|
(org-open-file (org-attach-dir-get-create)))
|
2008-10-01 03:25:18 -04:00
|
|
|
|
|
|
|
|
|
(defun org-attach-reveal-in-emacs ()
|
2021-09-30 16:07:15 -04:00
|
|
|
|
"Show the attachment directory of the current outline node in `dired'.
|
2019-09-01 08:43:54 -04:00
|
|
|
|
Will create an attachment and folder if it doesn't exist yet.
|
|
|
|
|
Respects `org-attach-preferred-new-method'."
|
2008-10-01 03:25:18 -04:00
|
|
|
|
(interactive)
|
2019-09-01 08:43:54 -04:00
|
|
|
|
(dired (org-attach-dir-get-create)))
|
2008-10-01 03:25:18 -04:00
|
|
|
|
|
|
|
|
|
(defun org-attach-open (&optional in-emacs)
|
org-attach*, org, org-manual, org-news, ox-html, testing/*
* lisp/org-attach.el
Changed the way attachments deal with property-inheritance. It now
adheres to the =org-use-property-inheritance= setting by default but
it can be customized if needed (I recommend to enable it!).
The property ATTACH_DIR is deprecated in favour of the shorter and simpler
property DIR.
Added an explicit option to =org-attach= for unsetting
attachment-directories (i.e. remove DIR property and deal with the
attachments by interaction).
Added attachment link type with the prefix "attachment:".
Added customizations:
- org-attach-dir-relative
- org-attach-preferred-new-method
- org-attach-use-inheritance
- org-attach-id-to-path-function
Hooks added:
- org-attach-after-change-hook
- org-attach-open-hook
A new linktype "attachment" is added in order to reduce
link-duplication when wanting to link to files in attached folders of
nodes. This works for both ID and DIR properties. The goal is to
make the functionality for attachment links mirror the functionality
for file links.
* lisp/org-attach-git.el
New file, existing functionality. Code here has been factored out
from org-attach.el and if GIT-functionality is to be used this module
needs to be required sepatately. It extends org-attach by use of its
hooks.
Activating git functionality in org-attach is done by loading
org-attach-git from now on, instead of customizing a variable.
Naming of both functions and tests has been modified to match the move
of functionality into its own module.
* lisp/org.el
Inline images are shown also using attachment-links, exactly the same
as it works for file-links today.
Make org-open-at-point respect ARG when opening attachment-dir.
* lisp/org-compat.el
org-attach-directory has been deprecated in favour for
org-attach-id-dir. The new name matches its purpose better.
* lisp/ox-html.el
Export attachment links to images as inline images, in the same way as
file links work today.
* etc/ORG-NEWS
Mention the changes in this patch.
* doc/org-manual.org
The chapter "Refile, Copy, Archive" has been split into two separate
chapters.
- "Refile, Copy and Archiving" for information related to moving
existing data around.
- "Capture, Attachments, RSS Feeds and Protocols" for information
related to working with external data.
The attachment-part has been rewritten and extended to match the
changes in this patch.
The new attachment link type is mentioned both inside the attachments
chapter and in the chapter dealing with links.
Documentation related to external links has been improved.
* testing/lisp/test-org-attach-annex.el
Require org-attach-git instead of org-attach, since this file tests
the GIT-functionality.
* testing/lisp/test-org-attach.el
Add tests for org-attach.
* testing/org-test.el
Define a symbol for a file to test attachments with.
* testing/examples/*
A bunch of new example files and folders are created and are used in
testing of org-attach to verify its functionality.
2018-11-25 15:38:44 -05:00
|
|
|
|
"Open an attachment of the current outline node.
|
2008-10-01 03:25:18 -04:00
|
|
|
|
If there are more than one attachment, you will be prompted for the file name.
|
|
|
|
|
This command will open the file using the settings in `org-file-apps'
|
|
|
|
|
and in the system-specific variants of this variable.
|
|
|
|
|
If IN-EMACS is non-nil, force opening in Emacs."
|
|
|
|
|
(interactive "P")
|
org-attach*, org, org-manual, org-news, ox-html, testing/*
* lisp/org-attach.el
Changed the way attachments deal with property-inheritance. It now
adheres to the =org-use-property-inheritance= setting by default but
it can be customized if needed (I recommend to enable it!).
The property ATTACH_DIR is deprecated in favour of the shorter and simpler
property DIR.
Added an explicit option to =org-attach= for unsetting
attachment-directories (i.e. remove DIR property and deal with the
attachments by interaction).
Added attachment link type with the prefix "attachment:".
Added customizations:
- org-attach-dir-relative
- org-attach-preferred-new-method
- org-attach-use-inheritance
- org-attach-id-to-path-function
Hooks added:
- org-attach-after-change-hook
- org-attach-open-hook
A new linktype "attachment" is added in order to reduce
link-duplication when wanting to link to files in attached folders of
nodes. This works for both ID and DIR properties. The goal is to
make the functionality for attachment links mirror the functionality
for file links.
* lisp/org-attach-git.el
New file, existing functionality. Code here has been factored out
from org-attach.el and if GIT-functionality is to be used this module
needs to be required sepatately. It extends org-attach by use of its
hooks.
Activating git functionality in org-attach is done by loading
org-attach-git from now on, instead of customizing a variable.
Naming of both functions and tests has been modified to match the move
of functionality into its own module.
* lisp/org.el
Inline images are shown also using attachment-links, exactly the same
as it works for file-links today.
Make org-open-at-point respect ARG when opening attachment-dir.
* lisp/org-compat.el
org-attach-directory has been deprecated in favour for
org-attach-id-dir. The new name matches its purpose better.
* lisp/ox-html.el
Export attachment links to images as inline images, in the same way as
file links work today.
* etc/ORG-NEWS
Mention the changes in this patch.
* doc/org-manual.org
The chapter "Refile, Copy, Archive" has been split into two separate
chapters.
- "Refile, Copy and Archiving" for information related to moving
existing data around.
- "Capture, Attachments, RSS Feeds and Protocols" for information
related to working with external data.
The attachment-part has been rewritten and extended to match the
changes in this patch.
The new attachment link type is mentioned both inside the attachments
chapter and in the chapter dealing with links.
Documentation related to external links has been improved.
* testing/lisp/test-org-attach-annex.el
Require org-attach-git instead of org-attach, since this file tests
the GIT-functionality.
* testing/lisp/test-org-attach.el
Add tests for org-attach.
* testing/org-test.el
Define a symbol for a file to test attachments with.
* testing/examples/*
A bunch of new example files and folders are created and are used in
testing of org-attach to verify its functionality.
2018-11-25 15:38:44 -05:00
|
|
|
|
(let ((attach-dir (org-attach-dir)))
|
|
|
|
|
(if attach-dir
|
|
|
|
|
(let* ((file (pcase (org-attach-file-list attach-dir)
|
|
|
|
|
(`(,file) file)
|
|
|
|
|
(files (completing-read "Open attachment: "
|
|
|
|
|
(mapcar #'list files) nil t))))
|
|
|
|
|
(path (expand-file-name file attach-dir)))
|
|
|
|
|
(run-hook-with-args 'org-attach-open-hook path)
|
|
|
|
|
(org-open-file path in-emacs))
|
|
|
|
|
(error "No attachment directory exist"))))
|
2008-10-01 03:25:18 -04:00
|
|
|
|
|
|
|
|
|
(defun org-attach-open-in-emacs ()
|
|
|
|
|
"Open attachment, force opening in Emacs.
|
|
|
|
|
See `org-attach-open'."
|
2008-10-07 08:28:21 -04:00
|
|
|
|
(interactive)
|
2008-10-01 03:25:18 -04:00
|
|
|
|
(org-attach-open 'in-emacs))
|
|
|
|
|
|
2008-11-05 11:54:59 -05:00
|
|
|
|
(defun org-attach-expand (file)
|
|
|
|
|
"Return the full path to the current entry's attachment file FILE.
|
|
|
|
|
Basically, this adds the path to the attachment directory."
|
|
|
|
|
(expand-file-name file (org-attach-dir)))
|
|
|
|
|
|
2020-02-20 03:29:21 -05:00
|
|
|
|
(defun org-attach-expand-links (_)
|
|
|
|
|
"Expand links in current buffer.
|
|
|
|
|
It is meant to be added to `org-export-before-parsing-hook'."
|
|
|
|
|
(save-excursion
|
|
|
|
|
(while (re-search-forward "attachment:" nil t)
|
|
|
|
|
(let ((link (org-element-context)))
|
2023-05-16 06:41:53 -04:00
|
|
|
|
(when (and (org-element-type-p link 'link)
|
2020-02-20 03:29:21 -05:00
|
|
|
|
(string-equal "attachment"
|
|
|
|
|
(org-element-property :type link)))
|
2023-05-03 10:26:41 -04:00
|
|
|
|
(let* ((description (and (org-element-contents-begin link)
|
2020-02-20 03:29:21 -05:00
|
|
|
|
(buffer-substring-no-properties
|
2023-05-03 10:26:41 -04:00
|
|
|
|
(org-element-contents-begin link)
|
|
|
|
|
(org-element-contents-end link))))
|
2020-02-20 03:29:21 -05:00
|
|
|
|
(file (org-element-property :path link))
|
|
|
|
|
(new-link (org-link-make-string
|
2020-02-27 19:27:47 -05:00
|
|
|
|
(concat "file:" (org-attach-expand file))
|
2020-02-20 03:29:21 -05:00
|
|
|
|
description)))
|
2023-05-03 10:26:41 -04:00
|
|
|
|
(goto-char (org-element-end link))
|
2020-02-20 03:29:21 -05:00
|
|
|
|
(skip-chars-backward " \t")
|
2023-05-03 10:26:41 -04:00
|
|
|
|
(delete-region (org-element-begin link) (point))
|
2020-02-20 03:29:21 -05:00
|
|
|
|
(insert new-link)))))))
|
|
|
|
|
|
|
|
|
|
(defun org-attach-follow (file arg)
|
|
|
|
|
"Open FILE attachment.
|
|
|
|
|
See `org-open-file' for details about ARG."
|
|
|
|
|
(org-link-open-as-file (org-attach-expand file) arg))
|
2020-02-06 16:01:08 -05:00
|
|
|
|
|
org-attach*, org, org-manual, org-news, ox-html, testing/*
* lisp/org-attach.el
Changed the way attachments deal with property-inheritance. It now
adheres to the =org-use-property-inheritance= setting by default but
it can be customized if needed (I recommend to enable it!).
The property ATTACH_DIR is deprecated in favour of the shorter and simpler
property DIR.
Added an explicit option to =org-attach= for unsetting
attachment-directories (i.e. remove DIR property and deal with the
attachments by interaction).
Added attachment link type with the prefix "attachment:".
Added customizations:
- org-attach-dir-relative
- org-attach-preferred-new-method
- org-attach-use-inheritance
- org-attach-id-to-path-function
Hooks added:
- org-attach-after-change-hook
- org-attach-open-hook
A new linktype "attachment" is added in order to reduce
link-duplication when wanting to link to files in attached folders of
nodes. This works for both ID and DIR properties. The goal is to
make the functionality for attachment links mirror the functionality
for file links.
* lisp/org-attach-git.el
New file, existing functionality. Code here has been factored out
from org-attach.el and if GIT-functionality is to be used this module
needs to be required sepatately. It extends org-attach by use of its
hooks.
Activating git functionality in org-attach is done by loading
org-attach-git from now on, instead of customizing a variable.
Naming of both functions and tests has been modified to match the move
of functionality into its own module.
* lisp/org.el
Inline images are shown also using attachment-links, exactly the same
as it works for file-links today.
Make org-open-at-point respect ARG when opening attachment-dir.
* lisp/org-compat.el
org-attach-directory has been deprecated in favour for
org-attach-id-dir. The new name matches its purpose better.
* lisp/ox-html.el
Export attachment links to images as inline images, in the same way as
file links work today.
* etc/ORG-NEWS
Mention the changes in this patch.
* doc/org-manual.org
The chapter "Refile, Copy, Archive" has been split into two separate
chapters.
- "Refile, Copy and Archiving" for information related to moving
existing data around.
- "Capture, Attachments, RSS Feeds and Protocols" for information
related to working with external data.
The attachment-part has been rewritten and extended to match the
changes in this patch.
The new attachment link type is mentioned both inside the attachments
chapter and in the chapter dealing with links.
Documentation related to external links has been improved.
* testing/lisp/test-org-attach-annex.el
Require org-attach-git instead of org-attach, since this file tests
the GIT-functionality.
* testing/lisp/test-org-attach.el
Add tests for org-attach.
* testing/org-test.el
Define a symbol for a file to test attachments with.
* testing/examples/*
A bunch of new example files and folders are created and are used in
testing of org-attach to verify its functionality.
2018-11-25 15:38:44 -05:00
|
|
|
|
(org-link-set-parameters "attachment"
|
2020-02-20 03:29:21 -05:00
|
|
|
|
:follow #'org-attach-follow
|
org-attach*, org, org-manual, org-news, ox-html, testing/*
* lisp/org-attach.el
Changed the way attachments deal with property-inheritance. It now
adheres to the =org-use-property-inheritance= setting by default but
it can be customized if needed (I recommend to enable it!).
The property ATTACH_DIR is deprecated in favour of the shorter and simpler
property DIR.
Added an explicit option to =org-attach= for unsetting
attachment-directories (i.e. remove DIR property and deal with the
attachments by interaction).
Added attachment link type with the prefix "attachment:".
Added customizations:
- org-attach-dir-relative
- org-attach-preferred-new-method
- org-attach-use-inheritance
- org-attach-id-to-path-function
Hooks added:
- org-attach-after-change-hook
- org-attach-open-hook
A new linktype "attachment" is added in order to reduce
link-duplication when wanting to link to files in attached folders of
nodes. This works for both ID and DIR properties. The goal is to
make the functionality for attachment links mirror the functionality
for file links.
* lisp/org-attach-git.el
New file, existing functionality. Code here has been factored out
from org-attach.el and if GIT-functionality is to be used this module
needs to be required sepatately. It extends org-attach by use of its
hooks.
Activating git functionality in org-attach is done by loading
org-attach-git from now on, instead of customizing a variable.
Naming of both functions and tests has been modified to match the move
of functionality into its own module.
* lisp/org.el
Inline images are shown also using attachment-links, exactly the same
as it works for file-links today.
Make org-open-at-point respect ARG when opening attachment-dir.
* lisp/org-compat.el
org-attach-directory has been deprecated in favour for
org-attach-id-dir. The new name matches its purpose better.
* lisp/ox-html.el
Export attachment links to images as inline images, in the same way as
file links work today.
* etc/ORG-NEWS
Mention the changes in this patch.
* doc/org-manual.org
The chapter "Refile, Copy, Archive" has been split into two separate
chapters.
- "Refile, Copy and Archiving" for information related to moving
existing data around.
- "Capture, Attachments, RSS Feeds and Protocols" for information
related to working with external data.
The attachment-part has been rewritten and extended to match the
changes in this patch.
The new attachment link type is mentioned both inside the attachments
chapter and in the chapter dealing with links.
Documentation related to external links has been improved.
* testing/lisp/test-org-attach-annex.el
Require org-attach-git instead of org-attach, since this file tests
the GIT-functionality.
* testing/lisp/test-org-attach.el
Add tests for org-attach.
* testing/org-test.el
Define a symbol for a file to test attachments with.
* testing/examples/*
A bunch of new example files and folders are created and are used in
testing of org-attach to verify its functionality.
2018-11-25 15:38:44 -05:00
|
|
|
|
:complete #'org-attach-complete-link)
|
|
|
|
|
|
|
|
|
|
(defun org-attach-complete-link ()
|
|
|
|
|
"Advise the user with the available files in the attachment directory."
|
|
|
|
|
(let ((attach-dir (org-attach-dir)))
|
|
|
|
|
(if attach-dir
|
|
|
|
|
(let* ((attached-dir (expand-file-name attach-dir))
|
|
|
|
|
(file (read-file-name "File: " attached-dir))
|
|
|
|
|
(pwd (file-name-as-directory attached-dir))
|
|
|
|
|
(pwd-relative (file-name-as-directory
|
|
|
|
|
(abbreviate-file-name attached-dir))))
|
|
|
|
|
(cond
|
|
|
|
|
((string-match (concat "^" (regexp-quote pwd-relative) "\\(.+\\)") file)
|
|
|
|
|
(concat "attachment:" (match-string 1 file)))
|
|
|
|
|
((string-match (concat "^" (regexp-quote pwd) "\\(.+\\)")
|
|
|
|
|
(expand-file-name file))
|
|
|
|
|
(concat "attachment:" (match-string 1 (expand-file-name file))))
|
|
|
|
|
(t (concat "attachment:" file))))
|
|
|
|
|
(error "No attachment directory exist"))))
|
|
|
|
|
|
2014-10-13 21:51:01 -04:00
|
|
|
|
(defun org-attach-archive-delete-maybe ()
|
|
|
|
|
"Maybe delete subtree attachments when archiving.
|
|
|
|
|
This function is called by `org-archive-hook'. The option
|
|
|
|
|
`org-attach-archive-delete' controls its behavior."
|
2018-08-10 21:22:10 -04:00
|
|
|
|
(when org-attach-archive-delete
|
|
|
|
|
(org-attach-delete-all (not (eq org-attach-archive-delete 'query)))))
|
2014-10-13 21:51:01 -04:00
|
|
|
|
|
2017-11-15 05:25:51 -05:00
|
|
|
|
|
|
|
|
|
;; Attach from dired.
|
|
|
|
|
|
2017-11-15 08:39:26 -05:00
|
|
|
|
;; Add the following lines to the config file to get a binding for
|
|
|
|
|
;; dired-mode.
|
2017-11-15 05:25:51 -05:00
|
|
|
|
|
|
|
|
|
;; (add-hook
|
|
|
|
|
;; 'dired-mode-hook
|
|
|
|
|
;; (lambda ()
|
2017-11-15 08:39:26 -05:00
|
|
|
|
;; (define-key dired-mode-map (kbd "C-c C-x a") #'org-attach-dired-to-subtree))))
|
2017-11-15 05:25:51 -05:00
|
|
|
|
|
2019-02-03 12:00:21 -05:00
|
|
|
|
;;;###autoload
|
2017-11-15 08:39:26 -05:00
|
|
|
|
(defun org-attach-dired-to-subtree (files)
|
2021-09-30 16:07:15 -04:00
|
|
|
|
"Attach FILES marked or current file in `dired' to subtree in other window.
|
2017-11-15 08:39:26 -05:00
|
|
|
|
Takes the method given in `org-attach-method' for the attach action.
|
2021-09-30 16:07:15 -04:00
|
|
|
|
Precondition: Point must be in a `dired' buffer.
|
2017-11-15 05:25:51 -05:00
|
|
|
|
Idea taken from `gnus-dired-attach'."
|
|
|
|
|
(interactive
|
2017-11-15 06:21:18 -05:00
|
|
|
|
(list (dired-get-marked-files)))
|
2017-11-15 05:25:51 -05:00
|
|
|
|
(unless (eq major-mode 'dired-mode)
|
2021-09-30 16:07:15 -04:00
|
|
|
|
(user-error "This command must be triggered in a `dired' buffer"))
|
2017-11-15 05:25:51 -05:00
|
|
|
|
(let ((start-win (selected-window))
|
|
|
|
|
(other-win
|
|
|
|
|
(get-window-with-predicate
|
|
|
|
|
(lambda (window)
|
|
|
|
|
(with-current-buffer (window-buffer window)
|
|
|
|
|
(eq major-mode 'org-mode))))))
|
|
|
|
|
(unless other-win
|
|
|
|
|
(user-error
|
2017-11-15 08:39:26 -05:00
|
|
|
|
"Can't attach to subtree. No window displaying an Org buffer"))
|
2017-11-15 05:25:51 -05:00
|
|
|
|
(select-window other-win)
|
2017-11-15 08:39:26 -05:00
|
|
|
|
(dolist (file files)
|
|
|
|
|
(org-attach-attach file))
|
2019-01-28 03:26:18 -05:00
|
|
|
|
(select-window start-win)
|
|
|
|
|
(when (eq 'mv org-attach-method)
|
|
|
|
|
(revert-buffer))))
|
2017-11-15 05:25:51 -05:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2014-10-13 21:51:01 -04:00
|
|
|
|
(add-hook 'org-archive-hook 'org-attach-archive-delete-maybe)
|
2022-09-06 09:42:11 -04:00
|
|
|
|
(add-hook 'org-export-before-parsing-functions 'org-attach-expand-links)
|
2014-10-13 21:51:01 -04:00
|
|
|
|
|
2008-10-01 03:25:18 -04:00
|
|
|
|
(provide 'org-attach)
|
|
|
|
|
|
2012-10-02 02:50:46 -04:00
|
|
|
|
;; Local variables:
|
|
|
|
|
;; generated-autoload-file: "org-loaddefs.el"
|
|
|
|
|
;; End:
|
|
|
|
|
|
2008-10-01 03:25:18 -04:00
|
|
|
|
;;; org-attach.el ends here
|