From 2cbb137dd20bc9d57e661af759862f3106f1fa72 Mon Sep 17 00:00:00 2001 From: Tom Willemsen Date: Mon, 30 Dec 2024 14:16:50 -0800 Subject: [PATCH] oni-php: Warn me when I'm trying to use a non-existent class --- oni-php/oni-php.el | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/oni-php/oni-php.el b/oni-php/oni-php.el index 2d10242..9af7e92 100644 --- a/oni-php/oni-php.el +++ b/oni-php/oni-php.el @@ -75,9 +75,12 @@ nil for some reason." (interactive (list (symbol-name (symbol-at-point)))) (let* ((default-directory (project-root (project-current))) (classes (read (shell-command-to-string (concat (expand-file-name "find-php-class" oni-php-scripts-dir) " " class)))) - (class (if (> (length classes) 1) - (completing-read "Use: " classes nil t) - (car classes)))) + (class (cond + ((null classes) + (user-error "Class ā€˜%sā€™ not found" class)) + ((> (length classes) 1) + (completing-read "Use: " classes nil t)) + (t (car classes))))) (save-excursion (goto-char (point-min)) (search-forward "use ")