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

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

[elpa] externals/rt-liberation 4dd2f82 11/72: * rt-liberation-gnus.el: F


From: Stefan Monnier
Subject: [elpa] externals/rt-liberation 4dd2f82 11/72: * rt-liberation-gnus.el: Fix single line and leading space bugs.
Date: Wed, 5 Aug 2020 11:57:34 -0400 (EDT)

branch: externals/rt-liberation
commit 4dd2f8273ca9d1e1e1469c4618b0140dee721c14
Author: Yoni Rabkin <yonirabkin@member.fsf.org>
Commit: Yoni Rabkin <yonirabkin@member.fsf.org>

    * rt-liberation-gnus.el: Fix single line and leading space bugs.
---
 rt-liberation-gnus.el | 26 +++++++++++++-------------
 1 file changed, 13 insertions(+), 13 deletions(-)

diff --git a/rt-liberation-gnus.el b/rt-liberation-gnus.el
index 80b34b0..f809bea 100644
--- a/rt-liberation-gnus.el
+++ b/rt-liberation-gnus.el
@@ -114,7 +114,6 @@ OPTIONS association list of options.
       (insert rt-liber-gnus-signature)
       (newline))))
 
-;; fixme: test against both versions of the RT CLI
 (defun rt-liber-gnus-content-to-string ()
   "Return the current content section as a string"
   (rt-liber-gnus-with-ticket-buffer
@@ -124,23 +123,24 @@ OPTIONS association list of options.
        (or (re-search-backward rt-liber-content-regexp (point-min) t)
            (re-search-forward rt-liber-content-regexp (point-max) t)))
      (error "no content sections found"))
-   (goto-char (point-at-bol))
-   (re-search-forward "^Content: " (point-at-eol) nil)
-   (let ((start (point))
-        text)
-     (re-search-forward "^[[:alpha:]]+:" (point-max) t)
-     (forward-line -1)
-     (if (= (count-lines start (point)) 1)
-        (error "empty content section")
+   (save-excursion
+     (goto-char (point-at-bol))
+     (re-search-forward "^Content: " (point-at-eol) nil)
+     (let ((start (point))
+          text)
+       (re-search-forward "^[[:alpha:]]+:" (point-max) t)
+       (goto-char (point-at-bol))
+       (when (= 0 (length (buffer-substring-no-properties start (point))))
+        (error "empty content section"))
        (setq text (buffer-substring-no-properties start (point)))
        (with-temp-buffer
         (insert text)
         (goto-char (point-min))
-        (re-search-forward "^[ ]+" (point-max) t)
-        (replace-match "")
+        (while (re-search-forward "^[ ]+" (point-max) t)
+          (replace-match ""))
         (whitespace-cleanup)
-        (setq text (buffer-substring (point-min) (point-max)))))
-     text)))
+        (setq text (buffer-substring (point-min) (point-max))))
+       text))))
 
 (defmacro rt-liber-gnus-with-ticket-buffer (&rest body)
   `(progn



reply via email to

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