[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: Any reason not to generate my own custom ID value (NOT CUSTOM_ID)?
From: |
Ihor Radchenko |
Subject: |
Re: Any reason not to generate my own custom ID value (NOT CUSTOM_ID)? |
Date: |
Fri, 11 Sep 2020 15:51:35 +0800 |
> 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.
Best,
Ihor
>From 6f2fff0cb7ce294d863ee0527463e5713a790078 Mon Sep 17 00:00:00 2001
From: Ihor Radchenko <yantar92@gmail.com>
Date: Fri, 11 Sep 2020 15:42:53 +0800
Subject: [PATCH] Allow customised ID format for `ts' `org-id-method'
Introduce new custom variable `org-id-ts-format' defining the ID
format for `ts' ID generation method. 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
TRS-80 <trs-80@isnotmyreal.name> writes:
> On 2020-09-10 21:06, Ihor Radchenko wrote:
>>> I do appreciate all the replies so far. However as I plan on relying
>>> on this to implement some quite critical functionality for a package I
>>> am working on (a sort of Zettelkasten / TiddlyWiki in Orgmode if you
>>> will) I would feel a lot more comfortable with some additional
>>> reassurences that what I am planning is not some crazy or bad idea.
>>
>> Is there any particular reason why you even need to display :ID: value
>> to
>> the user? If only id: links are concerned, link description can be made
>> short and human-readable.
>>
>> Best,
>> Ihor
>
> Yes, most of the time I expect I will be using Orgmode double bracket
> style
> links which will, as you say, hide the id: from the user, allowing to
> replace it with whatever desired text in the form of the link
> description.
>
> 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.
>
> Besides, as an ID, they are plenty "Unique" for my use case, with the
> default minute resolution (however even that, is configurable in my
> implementation, by way of a time-format variable, should anyone need
> more).
>
> I suppose if we ever get to a world where people start linking to each
> others' individual publicly published zettel, I may regret the decision.
> However Ted Nelson has already been working on such a thing for some
> decades already, and we are still not there yet, so I don't think I will
> need to worry about that any time soon. ;) Even if so, it would be a
> very
> small implementation change anyway.
>
> Cheers,
> TRS-80
- Any reason not to generate my own custom ID value (NOT CUSTOM_ID)?, TRS-80, 2020/09/10
- Re: Any reason not to generate my own custom ID value (NOT CUSTOM_ID)?, Gustav Wikström, 2020/09/10
- Re: Any reason not to generate my own custom ID value (NOT CUSTOM_ID)?, Samuel Wales, 2020/09/10
- Re: Any reason not to generate my own custom ID value (NOT CUSTOM_ID)?, TRS-80, 2020/09/10
- Re: Any reason not to generate my own custom ID value (NOT CUSTOM_ID)?, Ihor Radchenko, 2020/09/10
- Re: Any reason not to generate my own custom ID value (NOT CUSTOM_ID)?, TRS-80, 2020/09/10
- Re: Any reason not to generate my own custom ID value (NOT CUSTOM_ID)?,
Ihor Radchenko <=
- Re: Any reason not to generate my own custom ID value (NOT CUSTOM_ID)?, Bastien, 2020/09/13
- Re: Any reason not to generate my own custom ID value (NOT CUSTOM_ID)?, Bastien, 2020/09/23
- [PATCH] Re: Any reason not to generate my own custom ID value (NOT CUSTOM_ID)?, Ihor Radchenko, 2020/09/23
- Re: [PATCH] Re: Any reason not to generate my own custom ID value (NOT CUSTOM_ID)?, Bastien, 2020/09/23
- Re: [PATCH] Re: Any reason not to generate my own custom ID value (NOT CUSTOM_ID)?, Ihor Radchenko, 2020/09/23
- Re: [PATCH] Re: Any reason not to generate my own custom ID value (NOT CUSTOM_ID)?, Bastien, 2020/09/23
- Re: [PATCH] Re: Any reason not to generate my own custom ID value (NOT CUSTOM_ID)?, Ihor Radchenko, 2020/09/23
- Re: [PATCH] Re: Any reason not to generate my own custom ID value (NOT CUSTOM_ID)?, Bastien, 2020/09/23