From 35254abfb89ed1275f28555e5d1f80b3db168aa7 Mon Sep 17 00:00:00 2001 From: Tim Vaughan Date: Sat, 25 May 2019 13:45:05 +0200 Subject: [PATCH] Another minor termination period improvement. --- elpher.el | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/elpher.el b/elpher.el index ff69c93..c6e3cdf 100644 --- a/elpher.el +++ b/elpher.el @@ -290,10 +290,11 @@ content and cursor position fields of the node." "Insert the index corresponding to STRING into the current buffer." ;; Should be able to split directly on CRLF, but some non-conformant ;; LF-only servers sadly exist, hence the following. - (dolist (line (split-string (replace-regexp-in-string "\r" "" string) "\n")) - (unless (or (= (length line) 0) - (string-equal line ".")) - (elpher-insert-index-record line)))) + (let* ((str-no-period (replace-regexp-in-string "\r\n\.\r\n$" "\r\n" string)) + (str-no-cr (replace-regexp-in-string "\r" "" str-no-period))) + (dolist (line (split-string str-no-cr "\n")) + (unless (= (length line) 0) + (elpher-insert-index-record line))))) (defun elpher-insert-margin (&optional type-name) "Insert index margin, optionally containing the TYPE-NAME, into the current buffer." -- 2.20.1