diff options
author | Alexander Griffith <griffitaj@gmail.com> | 2018-03-10 06:01:17 -0500 |
---|---|---|
committer | Johnson Denen <johnson.denen@gmail.com> | 2018-08-10 22:20:04 -0400 |
commit | ae32d2f725dc90e3acb70a03d0a6fd2e4e660ccf (patch) | |
tree | ff400201cb529fbfc5d5bfb75b5570bf45fbef53 /lisp/mastodon-tl.el | |
parent | 2e383b9718a84949218e6cfdf62c1030e310144c (diff) |
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
Diffstat (limited to 'lisp/mastodon-tl.el')
-rw-r--r-- | lisp/mastodon-tl.el | 11 |
1 files changed, 7 insertions, 4 deletions
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))) |