From c26beed6e9b05e2b2cbfba1466154f9756b2c12c Mon Sep 17 00:00:00 2001 From: Alexander Rosenberg Date: Sun, 29 Oct 2023 03:03:24 -0700 Subject: [PATCH] Fix khard.el --- elisp/khard.el | 31 +++++++++++++++---------------- 1 file changed, 15 insertions(+), 16 deletions(-) diff --git a/elisp/khard.el b/elisp/khard.el index 4aaedb8..871125c 100644 --- a/elisp/khard.el +++ b/elisp/khard.el @@ -4,7 +4,7 @@ (require 'with-editor) -(add-to-list 'display-buffer-alist '("\\*khard output\\*" . (display-buffer-no-window))) +(add-to-list 'display-buffer-alist '(" \\*khard output\\*" . (display-buffer-no-window))) (defun khard--build-list-entry-detail (&rest items) "Build a detail in the format \" (ITEMS)\", or an empty string." @@ -62,7 +62,7 @@ If NO-CONFIRM is nil, do not ask the user." :command `("khard" "delete" "--force" ,(format "uid:%s" (cdr-safe contact))) - :buffer "*khard output*" + :buffer " *khard output*" :sentinel #'khard--process-sentinel))) (defun khard--prompt-address-book () @@ -72,19 +72,18 @@ If NO-CONFIRM is nil, do not ask the user." (defun khard--new-process-filter (proc str) "Process filter for `khard-new'. PROC and STR are described in `set-process-filter'." - (let ((lines (string-split str "\n"))) + (let ((lines (string-split str "\n")) + (error-msg nil)) (dolist (line lines) - (cond - ((string-prefix-p "Error: " line) - (setq error-msg line)) - ((equal - "Do you want to open the editor again? (y/N) " - line) - (if (y-or-n-p (format "%s! Reopen the editor? " - (or error-msg - "Unknown error"))) - (process-send-string proc "y\n") - (process-send-string proc "n\n")))))) + (if (equal + "Do you want to open the editor again? (y/N) " + line) + (if (y-or-n-p (format "%sReopen the editor? " + (or error-msg + "Unknown error"))) + (process-send-string proc "y\n") + (process-send-string proc "n\n")) + (setq error-msg (concat error-msg "\n" line))))) (with-editor-process-filter proc str t)) (defun khard-new (abook) @@ -97,7 +96,7 @@ When called interactively, prompt for ABOOK." :command `("env" ,(concat "EDITOR=" with-editor-sleeping-editor) "khard" "new" "--edit" "-a" ,abook) - :buffer "*khard output*" + :buffer " *khard output*" :filter #'khard--new-process-filter :sentinel #'khard--process-sentinel)))) @@ -109,7 +108,7 @@ When called interactively, prompt the user." :command `("env" ,(concat "EDITOR=" with-editor-sleeping-editor) "khard" "edit" "--edit" ,(format "uid:%s" uid)) - :buffer "*khard output*" + :buffer " *khard output*" :filter #'khard--new-process-filter :sentinel #'khard--process-sentinel))