mirror of
https://github.com/SqrtMinusOne/dotfiles.git
synced 2025-12-10 19:23:03 +03:00
feat(emacs): attach files to mastodon
This commit is contained in:
parent
3dc82b4775
commit
f014c4fca0
2 changed files with 37 additions and 2 deletions
|
|
@ -4451,6 +4451,21 @@ With ARG, repeats or can move backward if negative."
|
|||
ement-room
|
||||
ement-session)))))
|
||||
|
||||
(defun my/dired-attach-to-mastodon (files mastodon-buffer)
|
||||
(interactive
|
||||
(list (dired-get-marked-files nil nil #'dired-nondirectory-p)
|
||||
(or (cl-loop for buf being the buffers
|
||||
if (eq (buffer-local-value 'mastodon-toot-mode buf) t)
|
||||
return buf)
|
||||
(user-error "No buffer found!"))))
|
||||
(unless files
|
||||
(user-error "No (non-directory) files selected"))
|
||||
(with-current-buffer mastodon-buffer
|
||||
(dolist (file files)
|
||||
(mastodon-toot--attach-media
|
||||
file
|
||||
(read-from-minibuffer (format "Description for %s: " file))))))
|
||||
|
||||
(with-eval-after-load 'dired
|
||||
(general-define-key
|
||||
:states '(normal)
|
||||
|
|
@ -4458,7 +4473,8 @@ With ARG, repeats or can move backward if negative."
|
|||
"a" nil
|
||||
"at" #'my/dired-attach-to-telega
|
||||
"am" #'my/dired-attach-to-notmuch
|
||||
"ai" #'my/dired-attach-to-ement))
|
||||
"ai" #'my/dired-attach-to-ement
|
||||
"an" #'my/dired-attach-to-mastodon))
|
||||
|
||||
(when my/is-termux
|
||||
(straight-use-package 'vterm))
|
||||
|
|
|
|||
21
Emacs.org
21
Emacs.org
|
|
@ -6335,6 +6335,24 @@ Attach files to ement.
|
|||
ement-session)))))
|
||||
#+end_src
|
||||
|
||||
Attach files to mastodon.
|
||||
#+begin_src emacs-lisp
|
||||
(defun my/dired-attach-to-mastodon (files mastodon-buffer)
|
||||
(interactive
|
||||
(list (dired-get-marked-files nil nil #'dired-nondirectory-p)
|
||||
(or (cl-loop for buf being the buffers
|
||||
if (eq (buffer-local-value 'mastodon-toot-mode buf) t)
|
||||
return buf)
|
||||
(user-error "No buffer found!"))))
|
||||
(unless files
|
||||
(user-error "No (non-directory) files selected"))
|
||||
(with-current-buffer mastodon-buffer
|
||||
(dolist (file files)
|
||||
(mastodon-toot--attach-media
|
||||
file
|
||||
(read-from-minibuffer (format "Description for %s: " file))))))
|
||||
#+end_src
|
||||
|
||||
And the keybindings:
|
||||
#+begin_src emacs-lisp
|
||||
(with-eval-after-load 'dired
|
||||
|
|
@ -6344,7 +6362,8 @@ And the keybindings:
|
|||
"a" nil
|
||||
"at" #'my/dired-attach-to-telega
|
||||
"am" #'my/dired-attach-to-notmuch
|
||||
"ai" #'my/dired-attach-to-ement))
|
||||
"ai" #'my/dired-attach-to-ement
|
||||
"an" #'my/dired-attach-to-mastodon))
|
||||
#+end_src
|
||||
** Shells / Terminals
|
||||
*** vterm
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue