From 0906e32b15476e315b21d3e8e35ff4efaf0ad8e2 Mon Sep 17 00:00:00 2001 From: Bastien Guerry Date: Sun, 23 Sep 2012 11:58:49 +0200 Subject: [PATCH] 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 --- lisp/org-id.el | 40 ++++++++++++++++++++++++++++++++++++++++ lisp/org.el | 43 ++----------------------------------------- 2 files changed, 42 insertions(+), 41 deletions(-) diff --git a/lisp/org-id.el b/lisp/org-id.el index 359d8233d..14f990db4 100644 --- a/lisp/org-id.el +++ b/lisp/org-id.el @@ -83,6 +83,46 @@ :tag "Org ID" :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" "The uuidgen program." :group 'org-id diff --git a/lisp/org.el b/lisp/org.el index 1e4fbcba6..eadc92dd2 100644 --- a/lisp/org.el +++ b/lisp/org.el @@ -1447,46 +1447,6 @@ It should match if the message is from the user him/herself." :group 'org-link-store :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 "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 @@ -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)) (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 (defun org-store-link (arg)