Re: [PATCH] Re: Any reason not to generate my own custom ID value (NOT CUSTOM_ID)?
Hi Ihor, Ihor Radchenko writes: >> Thanks, but you forgot the note to etc/ORG-NEWS announcing the new >> option la mission. > > Do I miss something or the need to add ORG-NEWS entry is not mentioned > in the contribution page? I updated https://orgmode.org/worg/org-contribute.html to mention etc/ORG-NEWS, thanks.
Re: [PATCH] Re: Any reason not to generate my own custom ID value (NOT CUSTOM_ID)?
Ihor Radchenko writes: >> Thanks, but you forgot the note to etc/ORG-NEWS announcing the new >> option la mission. > > Do I miss something or the need to add ORG-NEWS entry is not mentioned > in the contribution page? If you can, please go ahead and fix this. Thanks, -- Bastien
Re: [PATCH] Re: Any reason not to generate my own custom ID value (NOT CUSTOM_ID)?
> Thanks, but you forgot the note to etc/ORG-NEWS announcing the new > option la mission. Do I miss something or the need to add ORG-NEWS entry is not mentioned in the contribution page? Best, Ihor Bastien writes: > Ihor Radchenko writes: > >> See the attached. > > Thanks, but you forgot the note to etc/ORG-NEWS announcing the new > option la mission. Can you add it in the same patch? > > -- > Bastien
Re: [PATCH] Re: Any reason not to generate my own custom ID value (NOT CUSTOM_ID)?
Ihor Radchenko writes: > Done. Applied as 6c75b0021, thanks! -- Bastien
Re: [PATCH] Re: Any reason not to generate my own custom ID value (NOT CUSTOM_ID)?
Done. >From c479d8b229140029a3a8454dd933dab7322fafc4 Mon Sep 17 00:00:00 2001 From: Ihor Radchenko Date: Fri, 11 Sep 2020 15:42:53 +0800 Subject: [PATCH] Allow customised ID format for `ts' `org-id-method' * lisp/org-id.el (org-id-new): Use `org-id-ts-format' as ID format for `ts' ID generation method. (org-id-ts-format): New custom variable for `ts' ID format. The default value is the same as old hard-coded ID format string. * etc/ORG-NEWS (New option ~org-id-ts-format~): Announce the new custom variable. --- etc/ORG-NEWS | 6 ++ lisp/org-id.el | 6 +- 2 files changed, 11 insertions(+), 1 deletion(-) diff --git a/etc/ORG-NEWS b/etc/ORG-NEWS index 87c5696d8..7e3957c10 100644 --- a/etc/ORG-NEWS +++ b/etc/ORG-NEWS @@ -363,6 +363,12 @@ HTML. Functions in this hook are run after ~org-agenda-filter~ is called. +*** New option ~org-id-ts-format~ + +Earlier, IDs generated using =ts= method had a hard-coded format (i.e. =20200923T160237.891616=). +The new option allows user to customise the format. +Defaults are unchanged. + ** Removed or renamed functions and variables *** Deprecated ~org-flag-drawer~ function diff --git a/lisp/org-id.el b/lisp/org-id.el index f8af52964..512703269 100644 --- a/lisp/org-id.el +++ b/lisp/org-id.el @@ -128,6 +128,10 @@ nil Never use an ID to make a link, instead link using a text search for :group 'org-id :type 'string) +(defcustom org-id-ts-format "%Y%m%dT%H%M%S.%6N" + "Default format for IDs generated using `ts' `org-id-method'. +The format should be suitable to pass as an argument to `format-time-string'.") + (defcustom org-id-method 'uuid "The method that should be used to create new IDs. @@ -380,7 +384,7 @@ So a typical ID could look like \"Org:4nd91V40HI\"." (concat "@" (message-make-fqdn)) (setq unique (concat etime postfix ((eq org-id-method 'ts) - (let ((ts (format-time-string "%Y%m%dT%H%M%S.%6N")) + (let ((ts (format-time-string org-id-ts-format)) (postfix (if org-id-include-domain (progn (require 'message) -- 2.26.2 Bastien writes: > Ihor Radchenko writes: > >> See the attached. > > Thanks, but you forgot the note to etc/ORG-NEWS announcing the new > option la mission. Can you add it in the same patch? > > -- > Bastien
Re: [PATCH] Re: Any reason not to generate my own custom ID value (NOT CUSTOM_ID)?
Ihor Radchenko writes: > See the attached. Thanks, but you forgot the note to etc/ORG-NEWS announcing the new option la mission. Can you add it in the same patch? -- Bastien
[PATCH] Re: Any reason not to generate my own custom ID value (NOT CUSTOM_ID)?
See the attached. >From bc492bd2fb87912289c135006b6fbeaca93ba181 Mon Sep 17 00:00:00 2001 From: Ihor Radchenko Date: Fri, 11 Sep 2020 15:42:53 +0800 Subject: [PATCH] Allow customised ID format for `ts' `org-id-method' * lisp/org-id.el (org-id-new): Use `org-id-ts-format' as ID format for `ts' ID generation method. (org-id-ts-format): New custom variable for `ts' ID format. The default value is the same as old hard-coded ID format string. --- lisp/org-id.el | 6 +- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/lisp/org-id.el b/lisp/org-id.el index f8af52964..512703269 100644 --- a/lisp/org-id.el +++ b/lisp/org-id.el @@ -128,6 +128,10 @@ nil Never use an ID to make a link, instead link using a text search for :group 'org-id :type 'string) +(defcustom org-id-ts-format "%Y%m%dT%H%M%S.%6N" + "Default format for IDs generated using `ts' `org-id-method'. +The format should be suitable to pass as an argument to `format-time-string'.") + (defcustom org-id-method 'uuid "The method that should be used to create new IDs. @@ -380,7 +384,7 @@ So a typical ID could look like \"Org:4nd91V40HI\"." (concat "@" (message-make-fqdn)) (setq unique (concat etime postfix ((eq org-id-method 'ts) - (let ((ts (format-time-string "%Y%m%dT%H%M%S.%6N")) + (let ((ts (format-time-string org-id-ts-format)) (postfix (if org-id-include-domain (progn (require 'message) -- 2.26.2 Bastien writes: > Hi Ihor, > > Ihor Radchenko writes: > >>> However, I just (strongly) prefer the shorter "ISO-like" ID for many >>> reasons, as already mentioned (shorter, meaningful, etc.). I just find >>> that style much, much more elegant. >> >> I guess it does not take much to add this functionality. >> >> Patch attached. > > Thanks. Can you update the patch with a correct Changelog entry and a > note to etc/ORG-NEWS announcing the new option? > > See https://orgmode.org/worg/org-contribute.html#commit-messages if it > helps. > > -- > Bastien