Change to when-let* and if-let*
This commit is contained in:
@ -36,8 +36,8 @@ This exists so that Emacs doesn't slow down while running
|
||||
|
||||
(defun khard--prompt-contact (&optional prompt)
|
||||
"Prompt user for a contact, optionally make the prompt text PROMPT."
|
||||
(if-let ((uid-list (khard--build-uid-email-phone-list))
|
||||
(resp (completing-read (or prompt "Contact ") uid-list)))
|
||||
(if-let* ((uid-list (khard--build-uid-email-phone-list))
|
||||
(resp (completing-read (or prompt "Contact ") uid-list)))
|
||||
(assoc resp uid-list)))
|
||||
|
||||
(defun khard--process-sentinel (proc status)
|
||||
@ -110,9 +110,9 @@ When called interactively, prompt the user."
|
||||
|
||||
(defun khard--parse-email-list (list-str)
|
||||
"Parse LIST-STR, a python dictionary and array string of emails."
|
||||
(if-let ((length (length list-str))
|
||||
((>= length 2))
|
||||
(no-braces (substring list-str 1 -1)))
|
||||
(if-let* ((length (length list-str))
|
||||
((>= length 2))
|
||||
(no-braces (substring list-str 1 -1)))
|
||||
(let ((output nil)
|
||||
(in-quote nil)
|
||||
(backslash nil)
|
||||
@ -167,8 +167,8 @@ With FORCE, rebuild the cache no matter what."
|
||||
(defun khard-insert-email-contact ()
|
||||
"Use `completing-read' to prompt for and insert a khard contact."
|
||||
(interactive)
|
||||
(if-let (contact (completing-read "Insert Contact "
|
||||
(khard--contacts-cache t)))
|
||||
(if-let* ((contact (completing-read "Insert Contact "
|
||||
(khard--contacts-cache t))))
|
||||
(insert contact)))
|
||||
|
||||
(defun khard--message-in-header-p (name &optional testfn)
|
||||
@ -185,7 +185,7 @@ The name is compared with the field name using TESTFN (defaults to `equal')."
|
||||
(defun khard-message-mode-capf ()
|
||||
"Completion at point function for khard contacts in message mode."
|
||||
(interactive)
|
||||
(when-let ((field-start (khard--message-in-header-p "To")))
|
||||
(when-let* ((field-start (khard--message-in-header-p "To")))
|
||||
(save-excursion
|
||||
(let ((end (point)))
|
||||
(re-search-backward (rx (any "\n" "," ":") (* whitespace))
|
||||
|
||||
Reference in New Issue
Block a user