org.el: Use nil as the default value for `org-link-to-org-use-id'

* org.el (org-link-to-org-use-id): Move to org-id.el.

* org-id.el (org-id-link-to-org-use-id): Rename from
`org-link-to-org-use-id'.  Use `nil' as the default value.
(org-link-to-org-use-id): Alias and define as obsolete.

`org-link-to-org-use-id' was previously defined in org.el but only
active when org-id.el was loaded.  This is wrong.  It now belongs
to org-id.el.

Also, as some libraries require org-id.el on the fly, a non-nil
default value for `org-link-to-org-use-id' had the side-effect of
changing the behavior of `org-store-link' behind the user's back.
Which is wrong too.  The new default value is `nil' so that, even
when a library requires org-id.el without the user noticing it,
the behavior of `org-store-link' will not change.

Users who want to keep the previous behavior can set the variable
to 'create-if-interactive-and-no-custom-id

INCOMPATIBLE
This commit is contained in:
Bastien Guerry 2012-09-23 11:58:49 +02:00
parent b20ef32b9a
commit 0906e32b15
2 changed files with 42 additions and 41 deletions

View File

@ -83,6 +83,46 @@
:tag "Org ID" :tag "Org ID"
:group 'org) :group 'org)
(define-obsolete-variable-alias
'org-link-to-org-use-id 'org-id-link-to-org-use-id "24.3")
(defcustom org-id-link-to-org-use-id nil
"Non-nil means storing a link to an Org file will use entry IDs.
The variable can have the following values:
t Create an ID if needed to make a link to the current entry.
create-if-interactive
If `org-store-link' is called directly (interactively, as a user
command), do create an ID to support the link. But when doing the
job for capture, only use the ID if it already exists. The
purpose of this setting is to avoid proliferation of unwanted
IDs, just because you happen to be in an Org file when you
call `org-capture' that automatically and preemptively creates a
link. If you do want to get an ID link in a capture template to
an entry not having an ID, create it first by explicitly creating
a link to it, using `C-c C-l' first.
create-if-interactive-and-no-custom-id
Like create-if-interactive, but do not create an ID if there is
a CUSTOM_ID property defined in the entry. This is the default.
use-existing
Use existing ID, do not create one.
nil Never use an ID to make a link, instead link using a text search for
the headline text."
:group 'org-link-store
:group 'org-id
:type '(choice
(const :tag "Create ID to make link" t)
(const :tag "Create if storing link interactively"
create-if-interactive)
(const :tag "Create if storing link interactively and no CUSTOM_ID is present"
create-if-interactive-and-no-custom-id)
(const :tag "Only use existing" use-existing)
(const :tag "Do not use ID to create link" nil)))
(defcustom org-id-uuid-program "uuidgen" (defcustom org-id-uuid-program "uuidgen"
"The uuidgen program." "The uuidgen program."
:group 'org-id :group 'org-id

View File

@ -1447,46 +1447,6 @@ It should match if the message is from the user him/herself."
:group 'org-link-store :group 'org-link-store
:type 'regexp) :type 'regexp)
(defcustom org-link-to-org-use-id 'create-if-interactive-and-no-custom-id
"Non-nil means storing a link to an Org file will use entry IDs.
Note that before this variable is even considered, org-id must be loaded,
so please customize `org-modules' and turn it on.
The variable can have the following values:
t Create an ID if needed to make a link to the current entry.
create-if-interactive
If `org-store-link' is called directly (interactively, as a user
command), do create an ID to support the link. But when doing the
job for capture, only use the ID if it already exists. The
purpose of this setting is to avoid proliferation of unwanted
IDs, just because you happen to be in an Org file when you
call `org-capture' that automatically and preemptively creates a
link. If you do want to get an ID link in a capture template to
an entry not having an ID, create it first by explicitly creating
a link to it, using `C-c C-l' first.
create-if-interactive-and-no-custom-id
Like create-if-interactive, but do not create an ID if there is
a CUSTOM_ID property defined in the entry. This is the default.
use-existing
Use existing ID, do not create one.
nil Never use an ID to make a link, instead link using a text search for
the headline text."
:group 'org-link-store
:type '(choice
(const :tag "Create ID to make link" t)
(const :tag "Create if storing link interactively"
create-if-interactive)
(const :tag "Create if storing link interactively and no CUSTOM_ID is present"
create-if-interactive-and-no-custom-id)
(const :tag "Only use existing" use-existing)
(const :tag "Do not use ID to create link" nil)))
(defcustom org-context-in-file-links t (defcustom org-context-in-file-links t
"Non-nil means file links from `org-store-link' contain context. "Non-nil means file links from `org-store-link' contain context.
A search string will be added to the file name with :: as separator and A search string will be added to the file name with :: as separator and
@ -8890,7 +8850,8 @@ type. For a simple example of an export function, see `org-bbdb.el'."
(setcdr (assoc type org-link-protocols) (list follow export)) (setcdr (assoc type org-link-protocols) (list follow export))
(push (list type follow export) org-link-protocols))) (push (list type follow export) org-link-protocols)))
(defvar org-agenda-buffer-name) (defvar org-agenda-buffer-name) ; Defined in org-agenda.el
(defvar org-link-to-org-use-id) ; Defined in org-id.el
;;;###autoload ;;;###autoload
(defun org-store-link (arg) (defun org-store-link (arg)