[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
master 7466b10: Improve wrong number of args error message in propertize
From: |
Stefan Kangas |
Subject: |
master 7466b10: Improve wrong number of args error message in propertize |
Date: |
Mon, 22 Feb 2021 05:56:21 -0500 (EST) |
branch: master
commit 7466b10346a3fdde2d3735d6ac09556569c24e5a
Author: Stefan Kangas <stefan@marxist.se>
Commit: Stefan Kangas <stefan@marxist.se>
Improve wrong number of args error message in propertize
* src/editfns.c (Fpropertize): Improve error message.
(syms_of_editfns) <Qpropertize>: New DEFSYM.
* test/src/editfns-tests.el
(propertize/error-wrong-number-of-args): New test.
---
src/editfns.c | 3 ++-
test/src/editfns-tests.el | 4 ++++
2 files changed, 6 insertions(+), 1 deletion(-)
diff --git a/src/editfns.c b/src/editfns.c
index 991f79a..fb20fc9 100644
--- a/src/editfns.c
+++ b/src/editfns.c
@@ -2945,7 +2945,7 @@ usage: (propertize STRING &rest PROPERTIES) */)
/* Number of args must be odd. */
if ((nargs & 1) == 0)
- error ("Wrong number of arguments");
+ xsignal2 (Qwrong_number_of_arguments, Qpropertize, make_fixnum (nargs));
properties = string = Qnil;
@@ -4448,6 +4448,7 @@ syms_of_editfns (void)
{
DEFSYM (Qbuffer_access_fontify_functions, "buffer-access-fontify-functions");
DEFSYM (Qwall, "wall");
+ DEFSYM (Qpropertize, "propertize");
DEFVAR_LISP ("inhibit-field-text-motion", Vinhibit_field_text_motion,
doc: /* Non-nil means text motion commands don't notice fields.
*/);
diff --git a/test/src/editfns-tests.el b/test/src/editfns-tests.el
index dcec971..ea80da4 100644
--- a/test/src/editfns-tests.el
+++ b/test/src/editfns-tests.el
@@ -128,6 +128,10 @@
(format (concat "%-3d/" s) 12)
#("12 /X" 4 5 (prop "val"))))))
+(ert-deftest propertize/error-even-number-of-args ()
+ "Number of args for `propertize' must be odd."
+ (should-error (propertize "foo" 'bar) :type 'wrong-number-of-arguments))
+
;; Tests for bug#5131.
(defun transpose-test-reverse-word (start end)
"Reverse characters in a word by transposing pairs of characters."
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- master 7466b10: Improve wrong number of args error message in propertize,
Stefan Kangas <=