Skip to content

Commit

Permalink
Provide proper-list-p compat code for Emacs 26
Browse files Browse the repository at this point in the history
  • Loading branch information
mattiase committed Sep 9, 2023
1 parent f403808 commit 7c99ab9
Showing 1 changed file with 7 additions and 2 deletions.
9 changes: 7 additions & 2 deletions relint.el
Original file line number Diff line number Diff line change
Expand Up @@ -656,9 +656,14 @@ into something that can be called safely."
(if (fboundp 'take)
#'take
(lambda (n list)
"The N first elements of LIST."
(cl-loop repeat n for x in list collect x))))

(defalias 'relint--proper-list-p
(if (fboundp 'proper-list-p)
#'proper-list-p
(lambda (x)
(and (listp x) (ignore-errors (length x))))))

(defun relint--eval (form)
"Evaluate a form. Throw `relint-eval' `no-value' if something could
not be evaluated safely."
Expand Down Expand Up @@ -1987,7 +1992,7 @@ directly."
(let ((head (car form))
(args (cdr form)))
(cond
((not (proper-list-p args))
((not (relint--proper-list-p args))
;; Dotted list: just recurse.
(let ((index 0))
(while (consp form)
Expand Down

0 comments on commit 7c99ab9

Please sign in to comment.