From 17119c5df71db0bc5255f7fa38b48828ed801f2f Mon Sep 17 00:00:00 2001 From: Henrik Lissner Date: Sat, 22 Jun 2024 18:01:11 -0400 Subject: [PATCH] refactor(lib): tweak user-error messages To make these errors more consistent with similar commands/operations, as well as rely less on cl-check-type (cl-lib's understanding of the `font` type is a bit odd; they'd emit warnings/errors about this, but still perform the checks -- I opted to check more explicitly instead). --- lisp/lib/files.el | 2 +- lisp/lib/fonts.el | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/lisp/lib/files.el b/lisp/lib/files.el index 6690820dc..5a9d37d83 100644 --- a/lisp/lib/files.el +++ b/lisp/lib/files.el @@ -538,7 +538,7 @@ which case it will save it without prompting." (when (or (derived-mode-p 'dired-mode) (derived-mode-p 'wdired-mode)) default-directory) - (user-error "Cannot determine the file path of the current buffer")))) + (user-error "Current buffer isn't visiting a file")))) ;;;###autoload (defun doom/sudo-save-buffer () diff --git a/lisp/lib/fonts.el b/lisp/lib/fonts.el index 0855bec5d..04f289f12 100644 --- a/lisp/lib/fonts.el +++ b/lisp/lib/fonts.el @@ -29,7 +29,6 @@ The font will be normalized (i.e. :weight, :slant, and :width will set to FONT can be a `font-spec', a font object, an XFT font string, or an XLFD font string." - (cl-check-type font (or font string vector)) (when (and (stringp font) (string-prefix-p "-" font)) (setq font (x-decompose-font-name font))) @@ -45,7 +44,8 @@ string." ((vectorp font) (dolist (i '(1 2 3) (x-compose-font-name font)) (unless (aref font i) - (aset font i "normal")))))) + (aset font i "normal")))) + ((signal 'wrong-type-of-argument (list '(font string vectorp) font))))) (font (x-resolve-font-name font)) (font (font-spec :name font))) (unless (font-get font :size)