From: Lars Ingebrigtsen Date: Mon, 21 Dec 2020 22:18:05 +0000 (+0100) Subject: Make string-chop-newline more efficient X-Git-Tag: emacs-28.0.90~4623 X-Git-Url: http://git.eshelyaron.com/gitweb/?a=commitdiff_plain;h=7e86d3bb9b61e3e2c2389e66370df037bd8a8f43;p=emacs.git Make string-chop-newline more efficient * lisp/emacs-lisp/subr-x.el (string-chop-newline): Make more efficient. --- diff --git a/lisp/emacs-lisp/subr-x.el b/lisp/emacs-lisp/subr-x.el index 4d1a73a251a..1c8e1d6293f 100644 --- a/lisp/emacs-lisp/subr-x.el +++ b/lisp/emacs-lisp/subr-x.el @@ -341,7 +341,7 @@ string." (defun string-chop-newline (string) "Remove the final newline (if any) from STRING." - (replace-regexp-in-string "\n\\'" "" string)) + (string-remove-suffix "\n" string)) (defun replace-region-contents (beg end replace-fn &optional max-secs max-costs)