Rename option auto-id' to unique-id'

This commit is contained in:
Lucien Cartier-Tilet 2022-09-01 16:26:30 +02:00
parent 8633b3b83b
commit f8e68356d1
Signed by: phundrak
GPG Key ID: BD7789E705CB8DCA
2 changed files with 14 additions and 8 deletions

View File

@ -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 dont 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]].

View File

@ -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 buffers 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)