emacs-elpa-diffs
[Top][All Lists]
Advanced

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

[nongnu] elpa/popon ad27d1a581 1/2: Fix #3: Don't use string-trim-right


From: ELPA Syncer
Subject: [nongnu] elpa/popon ad27d1a581 1/2: Fix #3: Don't use string-trim-right on Emacs <26
Date: Fri, 24 Jun 2022 01:59:27 -0400 (EDT)

branch: elpa/popon
commit ad27d1a5817327a8fc4afa4f241afca79ea8a6c1
Author: Akib Azmain Turja <akib@disroot.org>
Commit: Akib Azmain Turja <akib@disroot.org>

    Fix #3: Don't use string-trim-right on Emacs <26
---
 popon.el | 6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)

diff --git a/popon.el b/popon.el
index 564463e4e6..d12ebac556 100644
--- a/popon.el
+++ b/popon.el
@@ -292,7 +292,11 @@ when LINE-BEGINNINGS was calculated.")
               (setq line i)
               (setf (alist-get mark point-to-line) line))
             (let* ((str (buffer-substring mark (point)))
-                   (disp-str (string-trim-right str "\n")))
+                   (disp-str (if (>= emacs-major-version 26)
+                                 (string-trim-right str "\n")
+                               (let ((i (string-match-p
+                                         (concat "\\(?:\n\\)\\'") str)))
+                                 (if i (substring str 0 i) str)))))
               (push (list disp-str nil nil line mark
                           (if (equal str disp-str) (point) (1- (point))))
                     framebuffer)))



reply via email to

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