From 926bffff9d9db22403daee58b05233e7a9001f36 Mon Sep 17 00:00:00 2001 From: marty hiatt Date: Thu, 5 Oct 2023 11:09:29 +0200 Subject: enable-custom-emoji: cl-find predicate for unless --- lisp/mastodon-toot.el | 23 ++++++++++++----------- 1 file changed, 12 insertions(+), 11 deletions(-) diff --git a/lisp/mastodon-toot.el b/lisp/mastodon-toot.el index 4c55412..7478037 100644 --- a/lisp/mastodon-toot.el +++ b/lisp/mastodon-toot.el @@ -758,17 +758,18 @@ to `emojify-user-emojis', and the emoji data is updated." (when (y-or-n-p "Looks like you haven't downloaded your instance's custom emoji yet. Download now? ") (mastodon-toot--download-custom-emoji))) - ;; FIXME this test is awful, only works if we were last to mod the list: - (unless (equal (car (mastodon-toot--collect-custom-emoji)) - (car emojify-user-emojis)) - (setq emojify-user-emojis - (append (mastodon-toot--collect-custom-emoji) - emojify-user-emojis)) - ;; if already loaded, reload - (when (featurep 'emojify) - ;; we now only do this within the unless test above, as it is extremely - ;; slow and runs in `mastodon-mode-hook'. - (emojify-set-emoji-data)))) + (let ((masto-emojis (mastodon-toot--collect-custom-emoji))) + (unless (cl-find (car masto-emojis) + emojify-user-emojis + :test #'equal) + (setq emojify-user-emojis + (append masto-emojis + emojify-user-emojis)) + ;; if already loaded, reload + (when (featurep 'emojify) + ;; we now only do this within the unless test above, as it is extremely + ;; slow and runs in `mastodon-mode-hook'. + (emojify-set-emoji-data))))) (defun mastodon-toot--remove-docs () "Get the body of a toot from the current compose buffer." -- cgit v1.2.3 From d39903ddccdbdc8b6cb66173ab540eb6703e709c Mon Sep 17 00:00:00 2001 From: marty hiatt Date: Thu, 5 Oct 2023 11:10:57 +0200 Subject: bump version --- lisp/mastodon.el | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lisp/mastodon.el b/lisp/mastodon.el index 1ad1b5d..2edfb46 100644 --- a/lisp/mastodon.el +++ b/lisp/mastodon.el @@ -6,7 +6,7 @@ ;; Author: Johnson Denen ;; Marty Hiatt ;; Maintainer: Marty Hiatt -;; Version: 1.0.3 +;; Version: 1.0.4 ;; Package-Requires: ((emacs "27.1") (request "0.3.0") (persist "0.4")) ;; Homepage: https://codeberg.org/martianh/mastodon.el -- cgit v1.2.3 From bf656bd333804622798577c6208c2648bf4ed353 Mon Sep 17 00:00:00 2001 From: marty hiatt Date: Thu, 5 Oct 2023 11:40:22 +0200 Subject: rear-nonsticky only for \n at end of compose header. prevents a bug where header can be edited despite read-only, and if header edited, it will be partially posted as toot text. --- lisp/mastodon-toot.el | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/lisp/mastodon-toot.el b/lisp/mastodon-toot.el index 7478037..62a53cf 100644 --- a/lisp/mastodon-toot.el +++ b/lisp/mastodon-toot.el @@ -1485,11 +1485,13 @@ REPLY-TEXT is the text of the toot being replied to." 'toot-reply t) "") divider - "\n") - 'rear-nonsticky t + ) 'face 'mastodon-toot-docs-face 'read-only "Edit your message below." - 'toot-post-header t)))) + 'toot-post-header t) + ;; allow us to enter text after read-only header: + (propertize "\n" + 'rear-nonsticky t)))) (defun mastodon-toot--most-restrictive-visibility (reply-visibility) "Return REPLY-VISIBILITY or default visibility, whichever is more restrictive. -- cgit v1.2.3 From 5d46e17c0b41874f54b628e090feba7a5a9ac206 Mon Sep 17 00:00:00 2001 From: marty hiatt Date: Thu, 5 Oct 2023 11:41:14 +0200 Subject: indent -toot.el --- lisp/mastodon-toot.el | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/lisp/mastodon-toot.el b/lisp/mastodon-toot.el index 62a53cf..f46fc6d 100644 --- a/lisp/mastodon-toot.el +++ b/lisp/mastodon-toot.el @@ -947,7 +947,7 @@ Buffer-local variable `mastodon-toot-previous-window-config' holds the config." "Apply `mastodon-toot--process-local' function to each mention in MENTIONS. Remove empty string (self) from result and joins the sequence with whitespace." (mapconcat (lambda (mention) mention) - (remove "" (mapcar #'mastodon-toot--process-local mentions)) + (remove "" (mapcar #'mastodon-toot--process-local mentions)) " ")) (defun mastodon-toot--process-local (acct) @@ -1498,16 +1498,16 @@ REPLY-TEXT is the text of the toot being replied to." The default is given by `mastodon-toot--default-reply-visibility'." (unless (null reply-visibility) (let ((less-restrictive (member (intern mastodon-toot--default-reply-visibility) - mastodon-toot-visibility-list))) + mastodon-toot-visibility-list))) (if (member (intern reply-visibility) less-restrictive) - mastodon-toot--default-reply-visibility reply-visibility)))) + mastodon-toot--default-reply-visibility reply-visibility)))) (defun mastodon-toot--setup-as-reply (reply-to-user reply-to-id reply-json) "If REPLY-TO-USER is provided, inject their handle into the message. If REPLY-TO-ID is provided, set `mastodon-toot--reply-to-id'. REPLY-JSON is the full JSON of the toot being replied to." (let ((reply-visibility (mastodon-toot--most-restrictive-visibility - (alist-get 'visibility reply-json))) + (alist-get 'visibility reply-json))) (reply-cw (alist-get 'spoiler_text reply-json))) (when reply-to-user (when (> (length reply-to-user) 0) ; self is "" unforch -- cgit v1.2.3 From 083222c20cd23755ca93fc2a9e320f653cffe9ef Mon Sep 17 00:00:00 2001 From: marty hiatt Date: Thu, 5 Oct 2023 11:42:52 +0200 Subject: bump --- lisp/mastodon.el | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lisp/mastodon.el b/lisp/mastodon.el index 2edfb46..678e8a8 100644 --- a/lisp/mastodon.el +++ b/lisp/mastodon.el @@ -6,7 +6,7 @@ ;; Author: Johnson Denen ;; Marty Hiatt ;; Maintainer: Marty Hiatt -;; Version: 1.0.4 +;; Version: 1.0.5 ;; Package-Requires: ((emacs "27.1") (request "0.3.0") (persist "0.4")) ;; Homepage: https://codeberg.org/martianh/mastodon.el -- cgit v1.2.3