branch: externals/compat commit a202be76b0e809930bb3b76e426938e79d0c20ad Merge: abe97399f8 cd60f445f3 Author: Daniel Mendler <m...@daniel-mendler.de> Commit: Daniel Mendler <m...@daniel-mendler.de>
Merge branch 'main' into emacs-30 --- compat-25.el | 2 +- compat-28.el | 17 ++++++++--------- compat-tests.el | 14 +++++++------- 3 files changed, 16 insertions(+), 17 deletions(-) diff --git a/compat-25.el b/compat-25.el index b393dc8ea2..7901091b13 100644 --- a/compat-25.el +++ b/compat-25.el @@ -55,7 +55,7 @@ usage: (bool-vector &rest OBJECTS)" (aset seq i (car p)) (setq i (1+ i) p (cdr p))) (apply #'vector list))) - ((signal 'wrong-type-argument 'list-or-vector-p)))) + (t (signal 'wrong-type-argument (list 'list-or-vector-p seq))))) ;;;; Defined in editfns.c diff --git a/compat-28.el b/compat-28.el index b305ab2fff..f9719f34e7 100644 --- a/compat-28.el +++ b/compat-28.el @@ -34,7 +34,7 @@ ;; FIXME Should handle multibyte regular expressions (compat-defun string-search (needle haystack &optional start-pos) ;; <compat-tests:string-search> - "Search for the string NEEDLE in the strign HAYSTACK. + "Search for the string NEEDLE in the string HAYSTACK. The return value is the position of the first occurrence of NEEDLE in HAYSTACK, or nil if no match was found. @@ -65,7 +65,7 @@ issues are inherited." t)) ((arrayp sequence) (= (length sequence) length)) - ((signal 'wrong-type-argument sequence)))) + (t (signal 'wrong-type-argument (list 'sequencep sequence))))) (compat-defun length< (sequence length) ;; [[compat-tests:length<]] "Returns non-nil if SEQUENCE is shorter than LENGTH." @@ -75,7 +75,7 @@ issues are inherited." (null (nthcdr (1- length) sequence))) ((arrayp sequence) (< (length sequence) length)) - ((signal 'wrong-type-argument sequence)))) + (t (signal 'wrong-type-argument (list 'sequencep sequence))))) (compat-defun length> (sequence length) ;; [[compat-tests:length>]] "Returns non-nil if SEQUENCE is longer than LENGTH." @@ -84,7 +84,7 @@ issues are inherited." (and (nthcdr length sequence) t)) ((arrayp sequence) (> (length sequence) length)) - ((signal 'wrong-type-argument sequence)))) + (t (signal 'wrong-type-argument (list 'sequencep sequence))))) ;;;; Defined in fileio.c @@ -354,11 +354,10 @@ REPLACEMENT can use the following special elements: (compat-defun buffer-local-boundp (symbol buffer) ;; <compat-tests:buffer-local-boundp> "Return non-nil if SYMBOL is bound in BUFFER. Also see `local-variable-p'." - (catch 'fail - (condition-case nil - (buffer-local-value symbol buffer) - (void-variable nil (throw 'fail nil))) - t)) + (condition-case nil + (progn (buffer-local-value symbol buffer) + t) + (void-variable nil))) (compat-defmacro with-existing-directory (&rest body) ;; <compat-tests:with-existing-directory> "Execute BODY with `default-directory' bound to an existing directory. diff --git a/compat-tests.el b/compat-tests.el index 98bb0d9028..9f84f6359c 100644 --- a/compat-tests.el +++ b/compat-tests.el @@ -811,15 +811,15 @@ (unwind-protect (progn (use-global-map (make-sparse-keymap)) - (should-not (keymap-global-lookup "s-c")) + (should-not (keymap-global-lookup "H-c")) (should-not (keymap-global-lookup "x")) - (keymap-global-set "s-c" 'test) + (keymap-global-set "H-c" 'test) (keymap-global-set "<t>" 'default) - (should-equal (keymap-global-lookup "s-c") 'test) + (should-equal (keymap-global-lookup "H-c") 'test) (should-equal (keymap-global-lookup "x" t) 'default) (should-not (keymap-global-lookup "x"))) (use-global-map orig)) - (should-not (keymap-global-lookup "s-c")))) + (should-not (keymap-global-lookup "H-c")))) (ert-deftest compat-keymap-global-lookup () (should-equal (keymap-global-lookup "C-x b") #'switch-to-buffer) @@ -1330,10 +1330,10 @@ (list (list) (list) (list) (list))))) (ert-deftest compat-xor () - (should (xor t nil)) - (should (xor nil t)) + (should (equal (xor 'a nil) 'a)) + (should (equal (xor nil 'b) 'b)) (should-not (xor nil nil)) - (should-not (xor t t))) + (should-not (xor 'a 'b))) (ert-deftest compat-length= () (should (length= '() 0)) ;empty list