Fix khard.el

This commit is contained in:
Alexander Rosenberg 2023-10-15 14:22:54 -07:00
parent 6e7c2980a0
commit 73889a69df
Signed by: Zander671
GPG Key ID: 5FD0394ADBD72730

View File

@ -51,19 +51,6 @@ For info on PROC and STATUS, see `set-process-sentinel'."
(shell-command-set-point-after-cmd (process-buffer proc)) (shell-command-set-point-after-cmd (process-buffer proc))
(message "khard: %s." (substring status 0 -1)))) (message "khard: %s." (substring status 0 -1))))
(defun khard-edit (uid)
"Edit the contact with UID.
When called interactively, prompt the user."
(interactive (list (cdr-safe (khard--prompt-contact "Edit Contact "))))
(let ((with-editor-shell-command-use-emacsclient nil))
(make-process :name "khard edit"
:command
`("khard" "edit" "--edit"
,(format "uid:%s" (cdr-safe contact)))
:buffer nil
:filter #'with-editor-process-filter
:sentinel #'khard--process-sentinel)))
(defun khard-delete (contact no-confirm) (defun khard-delete (contact no-confirm)
"Delete CONTACT, which is of the form (name . uid). "Delete CONTACT, which is of the form (name . uid).
When called interactively, prompt the user. When called interactively, prompt the user.
@ -75,7 +62,7 @@ If NO-CONFIRM is nil, do not ask the user."
:command :command
`("khard" "delete" "--force" `("khard" "delete" "--force"
,(format "uid:%s" (cdr-safe contact))) ,(format "uid:%s" (cdr-safe contact)))
:buffer nil :buffer "*khard output*"
:sentinel #'khard--process-sentinel))) :sentinel #'khard--process-sentinel)))
(defun khard--prompt-address-book () (defun khard--prompt-address-book ()
@ -110,10 +97,22 @@ When called interactively, prompt for ABOOK."
:command :command
`("env" ,(concat "EDITOR=" with-editor-sleeping-editor) `("env" ,(concat "EDITOR=" with-editor-sleeping-editor)
"khard" "new" "--edit" "-a" ,abook) "khard" "new" "--edit" "-a" ,abook)
:buffer nil :buffer "*khard output*"
:filter #'khard--new-process-filter :filter #'khard--new-process-filter
:sentinel #'khard--process-sentinel)))) :sentinel #'khard--process-sentinel))))
(defun khard-edit (uid)
"Edit the contact with UID.
When called interactively, prompt the user."
(interactive (list (cdr-safe (khard--prompt-contact "Edit Contact "))))
(make-process :name "khard edit"
:command
`("env" ,(concat "EDITOR=" with-editor-sleeping-editor)
"khard" "edit" "--edit" ,(format "uid:%s" uid))
:buffer "*khard output*"
:filter #'khard--new-process-filter
:sentinel #'khard--process-sentinel))
(defun khard--parse-email-list (list-str) (defun khard--parse-email-list (list-str)
"Parse LIST-STR, a python dictionary and array string of emails." "Parse LIST-STR, a python dictionary and array string of emails."
(if-let ((length (length list-str)) (if-let ((length (length list-str))