From 0906e32b15476e315b21d3e8e35ff4efaf0ad8e2 Mon Sep 17 00:00:00 2001 From: Bastien Guerry Date: Sun, 23 Sep 2012 11:58:49 +0200 Subject: [PATCH 1/2] 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) From 5a297114fabfc06effcec63e767ff4e9d7b46cb9 Mon Sep 17 00:00:00 2001 From: Bastien Guerry Date: Sun, 23 Sep 2012 12:00:44 +0200 Subject: [PATCH 2/2] org-agenda.el: Use `define-obsolete-variable-alias' * org-agenda.el (org-agenda-menu-two-column) (org-finalize-agenda-hook, org-agenda-ndays): Use `define-obsolete-variable-alias' instead of `make-obsolete-variable'. --- lisp/org-agenda.el | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/lisp/org-agenda.el b/lisp/org-agenda.el index 58bc259d2..24e5ebb15 100755 --- a/lisp/org-agenda.el +++ b/lisp/org-agenda.el @@ -889,7 +889,7 @@ you want to use two-columns display (see `org-agenda-menu-two-columns')." :version "24.1" :type 'boolean) -(make-obsolete-variable 'org-agenda-menu-two-column 'org-agenda-menu-two-columns "24.3") +(define-obsolete-variable-alias 'org-agenda-menu-two-column 'org-agenda-menu-two-columns "24.3") (defcustom org-agenda-menu-two-columns nil "Non-nil means, use two columns to show custom commands in the dispatcher. @@ -899,7 +899,7 @@ to nil." :version "24.1" :type 'boolean) -(make-obsolete-variable 'org-finalize-agenda-hook 'org-agenda-finalize-hook "24.3") +(define-obsolete-variable-alias 'org-finalize-agenda-hook 'org-agenda-finalize-hook "24.3") (defcustom org-agenda-finalize-hook nil "Hook run just before displaying an agenda buffer. The buffer is still writable when the hook is called. @@ -1014,7 +1014,7 @@ Obsolete, see `org-agenda-span'." :group 'org-agenda-daily/weekly :type 'integer) -(make-obsolete-variable 'org-agenda-ndays 'org-agenda-span "24.1") +(define-obsolete-variable-alias 'org-agenda-ndays 'org-agenda-span "24.1") (defcustom org-agenda-span 'week "Number of days to include in overview display.