diff options
author | Holger Dürer <me@hdurer.net> | 2017-04-27 18:35:32 +0100 |
---|---|---|
committer | Johnson Denen <johnson.denen@gmail.com> | 2017-04-28 19:57:23 -0400 |
commit | 773d5b8cad3b029a8c1d230db5715d06df0ad525 (patch) | |
tree | c73944f9215f7940ff5f89991d14a42e26a3bc87 /lisp | |
parent | b185d87fa681bc6e75a3ed230e2794cc3c02fa7d (diff) |
Add the time of posting to the byline.
Diffstat (limited to 'lisp')
-rw-r--r-- | lisp/mastodon-tl.el | 4 | ||||
-rw-r--r-- | lisp/mastodon.el | 9 |
2 files changed, 13 insertions, 0 deletions
diff --git a/lisp/mastodon-tl.el b/lisp/mastodon-tl.el index a1535b9..5c31dc9 100644 --- a/lisp/mastodon-tl.el +++ b/lisp/mastodon-tl.el @@ -31,6 +31,7 @@ (require 'mastodon-http) (require 'mastodon-toot) (require 'mastodon-media) +(require 'time-date) (defgroup mastodon-tl nil "Timelines in Mastodon." @@ -130,6 +131,7 @@ Return value from boosted content if available." (defun mastodon-tl--byline (toot) "Generate byline for TOOT." (let ((id (cdr (assoc 'id toot))) + (timestamp (mastodon-tl--field 'created_at toot)) (faved (mastodon-tl--field 'favourited toot)) (boosted (mastodon-tl--field 'reblogged toot))) (propertize @@ -140,6 +142,8 @@ Return value from boosted content if available." (format "(%s) " (propertize "F" 'face 'success))) (mastodon-tl--byline-author toot) (mastodon-tl--byline-boosted toot) + " " + (format-time-string mastodon-toot-timestamp-format (date-to-time timestamp)) (propertize "\n ------------" 'face 'default)) 'favourited-p faved 'boosted-p boosted diff --git a/lisp/mastodon.el b/lisp/mastodon.el index 2926d08..7fb5c9a 100644 --- a/lisp/mastodon.el +++ b/lisp/mastodon.el @@ -51,6 +51,15 @@ :group 'mastodon :type 'file) +(defcustom mastodon-toot-timestamp-format "%F %T" + "Format to use for timestamps. + +For valid formatting options see `format-time-string`. +The default value \"%F %T\" prints ISO8601-style YYYY-mm-dd HH:MM:SS. +Use. e.g. \"%c\" for your locale's date and time format." + :group 'mastodon + :type 'string) + (defvar mastodon-mode-map (make-sparse-keymap) "Keymap for `mastodon-mode'.") |