Add option to fill paragraphs
[elpher.git] / elpher.el
index be4a04a..c57b1c2 100644 (file)
--- a/elpher.el
+++ b/elpher.el
@@ -4,7 +4,7 @@
 
 ;; Author: Tim Vaughan <plugd@thelambdalab.xyz>
 ;; Created: 11 April 2019
-;; Version: 2.10.1
+;; Version: 2.10.2
 ;; Keywords: comm gopher
 ;; Homepage: http://thelambdalab.xyz/elpher
 ;; Package-Requires: ((emacs "26.2"))
@@ -71,7 +71,7 @@
 ;;; Global constants
 ;;
 
-(defconst elpher-version "2.10.0"
+(defconst elpher-version "2.10.2"
   "Current version of elpher.")
 
 (defconst elpher-margin-width 6
@@ -547,6 +547,9 @@ If LINE is non-nil, replace that line instead."
 (defvar elpher-user-coding-system nil
   "User-specified coding system to use for decoding text responses.")
 
+(defvar elpher-fill-paragraph nil
+  "Whether to fill text paragraphs using `fill-paragraph`.")
+
 (defun elpher-decode (string)
   "Decode STRING using autodetected or user-specified coding system."
   (decode-coding-string string
@@ -1397,6 +1400,10 @@ width defined by elpher-gemini-max-fill-width."
                           (replace-regexp-in-string "[>\*]" " " (match-string 0 text-line))
                         nil)))
     (insert (elpher-process-text-for-display processed-text-line))
+    (when elpher-fill-paragraph
+      (save-restriction
+        (narrow-to-region (line-beginning-position) (line-end-position))
+        (fill-paragraph)))
     (newline)))
 
 (defun elpher-render-gemini-map (data _parameters)