From: Tim Vaughan Date: Sat, 25 May 2019 11:45:05 +0000 (+0200) Subject: Another minor termination period improvement. X-Git-Tag: v1.1.0~3 X-Git-Url: https://thelambdalab.xyz/gitweb/index.cgi?a=commitdiff_plain;h=35254abfb89ed1275f28555e5d1f80b3db168aa7;p=elpher.git Another minor termination period improvement. --- 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."