Add custom function to start ement.el without prompts

Inspired by https://github.com/alphapapa/ement.el/issues/32#issuecomment-902539093.
This commit is contained in:
Daniel Borchmann 2024-10-20 19:11:19 +02:00
parent 441db75ae2
commit 0f43b7303f
No known key found for this signature in database
GPG Key ID: 784AA8DF0CCDF625
3 changed files with 21 additions and 0 deletions

View File

@ -358,6 +358,7 @@
db/scratch
db/find-user-init-file
db/run-or-hide-ansi-term
db/ement-connect
db/hex-to-ascii
db/text-to-hex
turn-on-lispy-when-available

View File

@ -20,6 +20,16 @@
:group 'personal-settings
:type 'string)
(defcustom db/matrix-user-id ""
"Main Matrix User ID."
:group 'personal-settings
:type 'string)
(defcustom db/matrix-password-store-entry ""
"Password Store entry for Matrix User ID in `db/matrix-user-id'."
:group 'personal-settings
:type 'string)
(defcustom db/important-documents-path "~/Documents/library/"
"Path to look for documents that can be listed in extended
search commands like `db/helm-shortcuts."

View File

@ -105,6 +105,16 @@ With ARG, switch to `default-directory' of the current buffer first."
(insert (format "cd '%s'" current-dir))
(comint-send-input)))))
(defun db/ement-connect ()
"Connect to my matrix account."
(interactive)
(require 'ement)
(let ((password (password-store-get db/matrix-password-store-entry)))
(unless password
(user-error "No pass entry for Matrix password at “%s”" db/matrix-password-store-entry))
(ement-connect :user-id db/matrix-user-id
:password password)))
;;; General Utilities