From fd9431dde443471f17ffeebf9628fd9aee154e1b Mon Sep 17 00:00:00 2001 From: Lars Ingebrigtsen Date: Mon, 21 Dec 2020 20:42:17 +0100 Subject: Fix shorter-than-length case for string-limit * lisp/emacs-lisp/subr-x.el (string-limit): Fix shorter-than-length case. --- lisp/emacs-lisp/subr-x.el | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'lisp/emacs-lisp/subr-x.el') diff --git a/lisp/emacs-lisp/subr-x.el b/lisp/emacs-lisp/subr-x.el index db7e75dfd2b..05fa16da499 100644 --- a/lisp/emacs-lisp/subr-x.el +++ b/lisp/emacs-lisp/subr-x.el @@ -292,7 +292,7 @@ is a positive number, return a a substring consisting of the first LENGTH characters of STRING. If LENGTH is negative, return a substring consisitng of thelast LENGTH characters of STRING." (cond - ((<= (length string) length) string) + ((<= (length string) (abs length)) string) ((>= length 0) (substring string 0 length)) (t (substring string (+ (length string) length))))) -- cgit v1.2.3