emacs-diffs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

master 7e86d3b: Make string-chop-newline more efficient


From: Lars Ingebrigtsen
Subject: master 7e86d3b: Make string-chop-newline more efficient
Date: Mon, 21 Dec 2020 17:18:15 -0500 (EST)

branch: master
commit 7e86d3bb9b61e3e2c2389e66370df037bd8a8f43
Author: Lars Ingebrigtsen <larsi@gnus.org>
Commit: Lars Ingebrigtsen <larsi@gnus.org>

    Make string-chop-newline more efficient
    
    * lisp/emacs-lisp/subr-x.el (string-chop-newline): Make more
    efficient.
---
 lisp/emacs-lisp/subr-x.el | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/lisp/emacs-lisp/subr-x.el b/lisp/emacs-lisp/subr-x.el
index 4d1a73a..1c8e1d6 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)



reply via email to

[Prev in Thread] Current Thread [Next in Thread]