From 931b5aa76481c3e557fcb88afaddf9c1a354c188 Mon Sep 17 00:00:00 2001 From: Magic_RB Date: Sat, 16 Sep 2023 19:33:46 +0200 Subject: [PATCH] Improve ement password handling Signed-off-by: Magic_RB --- emacs-lisp/ement_el.org | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/emacs-lisp/ement_el.org b/emacs-lisp/ement_el.org index 217e6f5..6258dc2 100644 --- a/emacs-lisp/ement_el.org +++ b/emacs-lisp/ement_el.org @@ -13,11 +13,15 @@ (with-current-buffer " *ement-pass*" (ement-connect :uri-prefix "http://localhost:8008" - :password (string-trim (substring-no-properties (buffer-string))) + :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 @@ -27,7 +31,7 @@ (ement-save-sessions t) :config (remove-hook 'ement-after-initial-sync-hook #'ement-room-list--after-initial-sync) - (add-hook 'after-init-hook #'after-init-ement-connect)) + (setf ement-sessions (ement--read-sessions))) #+end_src #+begin_src emacs-lisp