dotfiles/emacs-lisp/ement_el.org
Magic_RB cec40531ea
Add a ement send-anyways function.
Signed-off-by: Magic_RB <magic_rb@redalder.org>
2022-10-31 00:52:06 +01:00

1.6 KiB

ement.el

  (use-package password-store
    :straight t)
  (use-package ement
    :straight '(ement :type git :host github :repo "alphapapa/ement.el")
    :after (password-store)
    :config
    (setq ement-save-sessions t)
    (ement-connect
     :uri-prefix "http://localhost:8008"
     :password (password-store-get "Matrix/@magic_rb:matrix.redalder.org")
     :user-id "@magic_rb:matrix.redalder.org"))
  (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))))