diff options
author | Ihor Radchenko <yantar92@gmail.com> | 2020-09-11 15:42:53 +0800 |
---|---|---|
committer | Bastien <bzg@gnu.org> | 2020-09-23 10:29:50 +0200 |
commit | 6c75b002172b26b5592a3076ef0bd3e9a37e73ce (patch) | |
tree | 6427beedf1c41d7958f9684dbd35ca4d1eabbce1 | |
parent | aea1109ef735dd72db97b9255662b9ff5bcecfbc (diff) | |
download | org-mode-6c75b002172b26b5592a3076ef0bd3e9a37e73ce.tar.gz |
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.
-rw-r--r-- | etc/ORG-NEWS | 6 | ||||
-rw-r--r-- | lisp/org-id.el | 6 |
2 files changed, 11 insertions, 1 deletions
diff --git a/etc/ORG-NEWS b/etc/ORG-NEWS index 0ed626f..eed3871 100644 --- a/etc/ORG-NEWS +++ b/etc/ORG-NEWS @@ -404,6 +404,12 @@ The new value uses Emacs as the application for opening directory. 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 f8af529..5127032 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) |