diff options
author | Yoni Rabkin <yonirabkin@member.fsf.org> | 2014-03-27 11:37:48 -0400 |
---|---|---|
committer | Yoni Rabkin <yonirabkin@member.fsf.org> | 2014-03-27 11:37:48 -0400 |
commit | 4dd2f8273ca9d1e1e1469c4618b0140dee721c14 (patch) | |
tree | 17639c34221c6481cf07e8a2f1e66067f54fc793 | |
parent | 2c9b35702806d7a307bde2fe7e4d191a53c474ed (diff) |
* rt-liberation-gnus.el: Fix single line and leading space bugs.
-rw-r--r-- | rt-liberation-gnus.el | 26 |
1 files 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 |