branch: externals/xr commit 51ce3792c2f32e415298df8f073743a10ea63f57 Author: Mattias EngdegÄrd <matti...@acm.org> Commit: Mattias EngdegÄrd <matti...@acm.org>
Use `take` when available --- xr.el | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/xr.el b/xr.el index ea1854a817..13044c4c35 100644 --- a/xr.el +++ b/xr.el @@ -1786,9 +1786,12 @@ If ESCAPE-PRINTABLE, also escape \\ and \", otherwise don't." xdigit))) string 'fixedcase 'literal)) -(defun xr--take (n list) - "The N first elements of LIST." - (butlast list (- (length list) n))) +(defalias 'xr--take + (if (fboundp 'take) + #'take + (lambda (n list) + "The N first elements of LIST." + (cl-loop repeat n for x in list collect x)))) (defun xr--rx-list-to-string (rx plain-prefix) "Print the list `rx' to a string, unformatted.