From ae32d2f725dc90e3acb70a03d0a6fd2e4e660ccf Mon Sep 17 00:00:00 2001 From: Alexander Griffith Date: Sat, 10 Mar 2018 06:01:17 -0500 Subject: Adds the notification timeline to mastodon.el closing #34. (#178) - Can now handle notifications (follow reblog favourite and mention) - Tests for each of the rendering functions are included - Added keybinding N to mastodon.el for mastodon-notifications-get - added mastodon-notifications to ert-helper.el --- lisp/mastodon-tl.el | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) (limited to 'lisp/mastodon-tl.el') diff --git a/lisp/mastodon-tl.el b/lisp/mastodon-tl.el index de65344..b873991 100644 --- a/lisp/mastodon-tl.el +++ b/lisp/mastodon-tl.el @@ -507,6 +507,10 @@ LINK-TYPE is the type of link to produce." (let ((spoiler (mastodon-tl--field 'spoiler_text toot))) (and spoiler (> (length spoiler) 0)))) +(defun mastodon-tl--clean-tabs-and-nl (string) + (replace-regexp-in-string + "[\t\n ]*\\'" "" string)) + (defun mastodon-tl--spoiler (toot) "Render TOOT with spoiler message. @@ -517,8 +521,8 @@ message is a link which unhides/hides the main body." (let* ((spoiler (mastodon-tl--field 'spoiler_text toot)) (string (mastodon-tl--set-face ;; remove trailing whitespace - (replace-regexp-in-string "[\t\n ]*\\'" "" - (mastodon-tl--render-text spoiler toot)) + (mastodon-tl--clean-tabs-and-nl + (mastodon-tl--render-text spoiler toot)) 'default)) (message (concat "\n" " ---------------\n" @@ -580,8 +584,7 @@ it is `mastodon-tl--byline-boosted'" "Formats TOOT and insertes it into the buffer." (mastodon-tl--insert-status toot - (replace-regexp-in-string - "[\t\n ]*\\'" "" + (mastodon-tl--clean-tabs-and-nl (if (mastodon-tl--has-spoiler toot) (mastodon-tl--spoiler toot) (mastodon-tl--content toot))) -- cgit v1.2.3