From 1038ecc683545100d0a3df972be1c3e1a8501c4f Mon Sep 17 00:00:00 2001 From: Yoni Rabkin Date: Thu, 3 Dec 2020 14:20:27 -0500 Subject: * rt-liberation.el: fill content --- rt-liberation.el | 17 ++++++++++++----- 1 file changed, 12 insertions(+), 5 deletions(-) diff --git a/rt-liberation.el b/rt-liberation.el index 623c029..bf59ede 100644 --- a/rt-liberation.el +++ b/rt-liberation.el @@ -1347,21 +1347,28 @@ ASSOC-BROWSER if non-nil should be a ticket browser." (goto-char (point-min)) (if (re-search-forward "^This transaction appears to have no content" (point-max) t) "" + ;; remove leading blank lines (save-excursion (goto-char (point-min)) (re-search-forward "[[:graph:]]" (point-max) t) (forward-line -1) (flush-lines "^[[:space:]]+$" (point-min) (point))) - + ;; remove trailing blank lines + (save-excursion + (goto-char (point-max)) + (re-search-backward "[[:graph:]]" (point-min) t) + (forward-line 2) + (flush-lines "^[[:space:]]+$" (point-max) (point))) ;; Convert the 9 leading whitespaces from RT's comment lines. (goto-char (point-min)) (insert " ") (while (re-search-forward "^ " (point-max) t) (replace-match " ")) - - (fill-region (point-min) - (point-max)) - + ;; fill + (let ((paragraph-separate " >[[:space:]]+$")) + (fill-region (point-min) + (point-max))) + ;; finally (buffer-substring (point-min) (point-max))))) -- cgit v1.2.3