dotfiles/emacs-lisp/ement_el.org
main 4fcaf7f9a9
Fix up ement save sessions and disable room list popup
Signed-off-by: main <magic_rb@redalder.org>
2022-11-23 13:35:29 +01:00

1.7 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)
    :custom
    (ement-save-sessions t)
    :config
    (remove-hook 'ement-after-initial-sync-hook #'ement-room-list--after-initial-sync)
    (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))))