mirror of
https://git.sr.ht/~magic_rb/dotfiles
synced 2024-11-30 12:06:13 +01:00
931b5aa764
Signed-off-by: Magic_RB <magic_rb@redalder.org>
2.3 KiB
2.3 KiB
ement.el
(use-package password-store
:straight t)
(defun ement-connect-sentinel (process msg)
(when (memq (process-status process) '(exit signal))
(with-current-buffer " *ement-pass*"
(ement-connect
:uri-prefix "http://localhost:8008"
:password (let ((password (string-trim (substring-no-properties (buffer-string)))))
(if (not (equal (process-exit-status process) 0))
(read-passwd "Ement password: ")
password))
:user-id "@magic_rb:matrix.redalder.org")
(kill-buffer))))
(defun after-init-ement-connect ()
(interactive)
(set-process-sentinel (start-process "ement-pass" " *ement-pass*" "pass" "Matrix/@magic_rb:matrix.redalder.org") #'ement-connect-sentinel))
(use-package ement
:straight '(ement :type git :host github :repo "alphapapa/ement.el")
:after (password-store)
:custom
(ement-save-sessions t)
:config
(remove-hook 'ement-after-initial-sync-hook #'ement-room-list--after-initial-sync)
(setf ement-sessions (ement--read-sessions)))
(defun ement-send-anyways ()
(interactive)
(when (ement-room-p ement-room)
(let ((ement-room- ement-room)
(ement-session- ement-session))
(save-excursion
(panctl "*panctl-temp-send-anyway*")
(vterm-insert "send-anyways " (ement-user-id (ement-session-user ement-session-)) " " (ement-room-id ement-room-))
(vterm-send-return)
(vterm-send-C-c)))))
Enable message composition in Org Mode by default.
(setq ement-room-send-message-filter #'ement-room-send-org-filter)
Define an interactive command to open pantalaimon in Emacs.
(defun panctl (&optional name)
(interactive)
(let* ((name- (or name "panctl"))
(buffer (get-buffer name-))
(vterm-shell "panctl"))
(if buffer
(switch-to-buffer buffer)
(vterm name-)
(whitespace-mode -1))))