diff options
Diffstat (limited to 'lisp')
-rw-r--r-- | lisp/mastodon-media.el | 3 | ||||
-rw-r--r-- | lisp/mastodon-tl.el | 19 | ||||
-rw-r--r-- | lisp/mastodon-toot.el | 7 |
3 files changed, 22 insertions, 7 deletions
diff --git a/lisp/mastodon-media.el b/lisp/mastodon-media.el index 561327c..894a21a 100644 --- a/lisp/mastodon-media.el +++ b/lisp/mastodon-media.el @@ -321,7 +321,8 @@ CAPTION is the image caption if provided." (concat (mastodon-tl--propertize-img-str-or-url "[img]" media-url full-remote-url type help-echo - (create-image mastodon-media--generic-broken-image-data nil t)) + (create-image mastodon-media--generic-broken-image-data nil t) + nil caption) " "))) (provide 'mastodon-media) diff --git a/lisp/mastodon-tl.el b/lisp/mastodon-tl.el index 8e3ce4a..ca09a0f 100644 --- a/lisp/mastodon-tl.el +++ b/lisp/mastodon-tl.el @@ -263,6 +263,7 @@ types of mastodon links and not just shr.el-generated ones.") (define-key map (kbd "u") #'mastodon-tl--update) ;; keep new my-profile binding; shr 'O' doesn't work here anyway (define-key map (kbd "O") #'mastodon-profile--my-profile) + (define-key map (kbd "C") #'mastodon-tl--copy-image-caption) (define-key map (kbd "<C-return>") #'mastodon-tl--mpv-play-video-at-point) (define-key map (kbd "<mouse-2>") #'mastodon-tl--click-image-or-video) map) @@ -1053,16 +1054,18 @@ message is a link which unhides/hides the main body." (concat "Media:: " .preview_url) ; string .preview_url .remote_url .type .description display-str ; display - 'shr-link) + 'shr-link .description) "\n"))))) (defun mastodon-tl--propertize-img-str-or-url - (str media-url full-remote-url type help-echo &optional display face) + (str media-url full-remote-url type help-echo + &optional display face caption) "Propertize an media placeholder string \"[img]\" or media URL. STR is the string to propertize, MEDIA-URL is the preview link, FULL-REMOTE-URL is the link to the full resolution image on the server, TYPE is the media type. -HELP-ECHO, DISPLAY, and FACE are the text properties to add." +HELP-ECHO, DISPLAY, and FACE are the text properties to add. +CAPTION is the image caption, added as a text property." (propertize str 'media-url media-url 'media-state (when (string= str "[img]") 'needs-loading) @@ -1074,6 +1077,7 @@ HELP-ECHO, DISPLAY, and FACE are the text properties to add." 'mastodon-tab-stop 'image ; for do-link-action-at-point 'image-url full-remote-url ; for shr-browse-image 'keymap mastodon-tl--shr-image-map-replacement + 'image-description caption 'help-echo (if (or (string= type "image") (string= type nil) (string= type "unknown")) ; handle borked images @@ -1288,6 +1292,15 @@ in which case play first video or gif from current toot." (message "no moving image here?")) (message "no moving image here?")))) +(defun mastodon-tl--copy-image-caption () + "Copy the caption of the image at point." + (interactive) + (if-let ((desc (get-text-property (point) 'image-description))) + (progn + (kill-new desc) + (message "Image caption copied.")) + (message "No image caption."))) + ;;; INSERT TOOTS diff --git a/lisp/mastodon-toot.el b/lisp/mastodon-toot.el index 0d7e932..c96ee5b 100644 --- a/lisp/mastodon-toot.el +++ b/lisp/mastodon-toot.el @@ -850,20 +850,20 @@ instance to edit a toot." ;; Pleroma instances can't handle null-valued ;; scheduled_at args, so only add if non-nil (when scheduled `(("scheduled_at" . ,scheduled))))) - (args-media (when mastodon-toot--media-attachments + (args-media (when mastodon-toot--media-attachment-ids (mastodon-http--build-array-params-alist "media_ids[]" mastodon-toot--media-attachment-ids))) (args-poll (when mastodon-toot-poll (mastodon-toot--build-poll-params))) ;; media || polls: - (args (if mastodon-toot--media-attachments + (args (if mastodon-toot--media-attachment-ids (append args-media args-no-media) (if mastodon-toot-poll (append args-no-media args-poll) args-no-media))) (prev-window-config mastodon-toot-previous-window-config)) - (cond ((and mastodon-toot--media-attachments + (cond ((and mastodon-toot--media-attachment-ids ;; make sure we have media args ;; and the same num of ids as attachments (or (not args-media) @@ -1830,6 +1830,7 @@ EDIT means we are editing an existing toot, not composing a new one." ;; `mastodon-toot--max-toot-chars' is set when we set it (mastodon-toot--get-max-toot-chars)) ;; set up completion: + (setq-local completion-ignore-case t) (when mastodon-toot--enable-completion (set (make-local-variable 'completion-at-point-functions) (add-to-list 'completion-at-point-functions |