Fix error handling in crofu-terminal-popupinfo.el

This commit is contained in:
Alexander Rosenberg 2024-11-05 08:50:06 -08:00
parent ac07328aca
commit 998d5cf3fa
Signed by: Zander671
GPG Key ID: 5FD0394ADBD72730

View File

@ -87,7 +87,9 @@ As this is :around advice, OLDFUN is the real (advised) function to call."
(goto-char (point-min)) (goto-char (point-min))
(put-text-property (point-min) (point-max) 'face 'corfu-popupinfo) (put-text-property (point-min) (point-max) 'face 'corfu-popupinfo)
(when-let ((m (memq 'corfu-default (alist-get 'default face-remapping-alist)))) (when-let ((m (memq 'corfu-default (alist-get 'default face-remapping-alist))))
(setcar m 'corfu-popupinfo))))) (setcar m 'corfu-popupinfo)))
;; We succeeded in loading the data
t))
(defun ctp--popon-position (buffer) (defun ctp--popon-position (buffer)
"Find a good position to open the popon for BUFFER's content. "Find a good position to open the popon for BUFFER's content.
@ -201,10 +203,12 @@ CANDIDATE is the same as for `corfu-popupinfo--show'. As this is meant to be
(not (corfu--equal-including-properties (not (corfu--equal-including-properties
candidate corfu-popupinfo--candidate))) candidate corfu-popupinfo--candidate)))
(let ((buf (ctp--get-buffer))) (let ((buf (ctp--get-buffer)))
(ctp--load-content candidate buf) (if (ctp--load-content candidate buf)
(ctp--display-buffer buf)) (progn
(ctp--display-buffer buf)
(setq corfu-popupinfo--candidate candidate (setq corfu-popupinfo--candidate candidate
corfu-popupinfo--toggle t)))) corfu-popupinfo--toggle t))
(corfu-popupinfo--hide))))))
(defun ctp--move-away-from-eob () (defun ctp--move-away-from-eob ()
"Ensure the point isn't too close to the end of the buffer." "Ensure the point isn't too close to the end of the buffer."