From 80aa09a9caa52e6ff0ab6765b2a2722f3fc71785 Mon Sep 17 00:00:00 2001 From: Simon Parri Date: Tue, 26 Aug 2025 11:54:02 -0500 Subject: Emacs: Fix mu contact completion when there are no matching contacts --- common/.emacs.d/init.el | 15 +++++++++------ 1 file changed, 9 insertions(+), 6 deletions(-) (limited to 'common/.emacs.d/init.el') diff --git a/common/.emacs.d/init.el b/common/.emacs.d/init.el index 3ec6f05..0a7f33e 100644 --- a/common/.emacs.d/init.el +++ b/common/.emacs.d/init.el @@ -2007,12 +2007,15 @@ buffer's text scale." end (completion-table-dynamic (lambda (string) - (thread-last - (shell-quote-argument string) - (format "mu cfind --format=json %s") - shell-command-to-string - json-parse-string - (mapcar (lambda (h) (gethash "display" h)))))) + (let ((jsonstr + (thread-last + (shell-quote-argument string) + (format "mu cfind --format=json %s 2>/dev/null") + shell-command-to-string))) + (when (not (string-empty-p jsonstr)) + (thread-last + (json-parse-string jsonstr) + (mapcar (lambda (h) (gethash "display" h)))))))) :exclusive 'no)))) (add-hook 'message-mode-hook -- cgit v1.2.3