From: Ihor Radchenko <yantar92@gmail.com>
To: Bastien <bzg@gnu.org>
Cc: TRS-80 <trs-80@isnotmyreal.name>, emacs-orgmode@gnu.org
Subject: Re: [PATCH] Re: Any reason not to generate my own custom ID value (NOT CUSTOM_ID)?
Date: Wed, 23 Sep 2020 16:08:16 +0800 [thread overview]
Message-ID: <873638ncen.fsf@localhost> (raw)
In-Reply-To: <8736399bn8.fsf@gnu.org>
[-- Attachment #1: Type: text/plain, Size: 7 bytes --]
Done.
[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: 0001-Allow-customised-ID-format-for-ts-org-id-method.patch --]
[-- Type: text/x-diff, Size: 2093 bytes --]
From c479d8b229140029a3a8454dd933dab7322fafc4 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'
* 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
[-- Attachment #3: Type: text/plain, Size: 248 bytes --]
Bastien <bzg@gnu.org> writes:
> Ihor Radchenko <yantar92@gmail.com> 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
next prev parent reply other threads:[~2020-09-23 8:10 UTC|newest]
Thread overview: 18+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-09-10 20:02 Any reason not to generate my own custom ID value (NOT CUSTOM_ID)? TRS-80
2020-09-10 22:00 ` Gustav Wikström
2020-09-10 22:16 ` TRS-80
2020-09-13 20:18 ` Bastien
2020-09-10 22:20 ` Samuel Wales
2020-09-10 23:33 ` TRS-80
2020-09-11 1:06 ` Ihor Radchenko
2020-09-11 1:31 ` TRS-80
2020-09-11 7:51 ` Ihor Radchenko
2020-09-13 20:19 ` Bastien
2020-09-23 7:19 ` Bastien
2020-09-23 7:43 ` [PATCH] " Ihor Radchenko
2020-09-23 7:48 ` Bastien
2020-09-23 8:08 ` Ihor Radchenko [this message]
2020-09-23 8:30 ` Bastien
2020-09-23 8:40 ` Ihor Radchenko
2020-09-23 8:48 ` Bastien
2021-04-25 14:19 ` Bastien
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
List information: https://www.orgmode.org/
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=873638ncen.fsf@localhost \
--to=yantar92@gmail.com \
--cc=bzg@gnu.org \
--cc=emacs-orgmode@gnu.org \
--cc=trs-80@isnotmyreal.name \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
Code repositories for project(s) associated with this public inbox
https://git.savannah.gnu.org/cgit/emacs/org-mode.git
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).