From f8e68356d1a7084782e6434b963931f4d2e4715a Mon Sep 17 00:00:00 2001 From: Lucien Cartier-Tilet Date: Thu, 1 Sep 2022 16:26:30 +0200 Subject: [PATCH] Rename option `auto-id' to `unique-id' --- README.org | 14 ++++++++++---- org-unique-id.el | 8 ++++---- 2 files changed, 14 insertions(+), 8 deletions(-) diff --git a/README.org b/README.org index 9957c55..c0e3f26 100644 --- a/README.org +++ b/README.org @@ -14,6 +14,8 @@ user modifies them manually. - [[#introduction][Introduction]] - [[#installation][Installation]] - [[#usage][Usage]] +- [[#breaking-changes][Breaking changes]] + - [[#040][~0.4.0~]] - [[#contributing][Contributing]] - [[#license][License]] @@ -49,12 +51,12 @@ While ~org-unique-id~ may be installed on your Emacs instance, it is not active by default. This is because it can take some time to generate all the required IDs in your org file which may hang your Emacs instance for a bit. Therefore, automatic IDs are enabled on a per-file -basis with the option ~auto-id~. +basis with the option ~unique-id~. Here is an example of an org buffer with ~org-unique-id~ enabled: #+begin_src org ,#+title: Test file -,#+options: auto-id:t +,#+options: unique-id:t ,* Test level 1 :PROPERTIES: @@ -77,7 +79,7 @@ the ~CUSTOM_ID~ and let ~org-unique-id~ regenerate it. If you don’t like the ~CUSTOM_ID~ generated by ~org-unique-id~, you can overwrite it yourself and ~org-unique-id~ will not modify it. -Note that ~auto-id:t~ is absolutely required in order to get these +Note that ~unique-id:t~ is absolutely required in order to get these ~CUSTOM_ID~. Here is the same buffer after save without this option: #+begin_src org ,#+title: Test file @@ -88,7 +90,11 @@ Note that ~auto-id:t~ is absolutely required in order to get these It is also possible to manually call ~org-unique-id~ (interactively or not) on the current buffer. This will not check the value of the -~auto-id~ option. +~unique-id~ option. + +* Breaking changes +** ~0.4.0~ +The option ~auto-id~ is renamed to ~unique-id~. * Contributing See [[file:CONTRIBUTING.org]]. diff --git a/org-unique-id.el b/org-unique-id.el index 6dcd8ee..1a6d6f8 100644 --- a/org-unique-id.el +++ b/org-unique-id.el @@ -112,8 +112,8 @@ case, the CUSTOM_ID of the entry is returned." (defun org-unique-id () "Add a CUSTOM_ID to all headers missing one. -Only adds ids if the `auto-id' option is set to t in the file -somewhere, i.e. #+OPTIONS: auto-id:t" +Only adds ids if the \\='unique-id\\=' option is set to t in the +file somewhere, i.e. #+OPTIONS: unique-id:t" (interactive) (save-excursion (widen) @@ -126,14 +126,14 @@ somewhere, i.e. #+OPTIONS: auto-id:t" This function executes `org-unique-id' when the buffer’s major mode is `org-mode', when the buffer is not read-only, and if -\\='auto-id:t\\' is found in an #+OPTIONS line." +\\='unique-id:t\\' is found in an #+OPTIONS line." (interactive) (when (and (eq major-mode 'org-mode) (not buffer-read-only) (save-excursion (goto-char (point-min)) (let ((case-fold-search t)) - (re-search-forward "^#\\+OPTIONS:.*auto-id:t" (point-max) t)))) + (re-search-forward "^#\\+OPTIONS:.*unique-id:t" (point-max) t)))) (org-unique-id))) (provide 'org-unique-id)