From 00cb8cad3add551679c9cbb60af3edfb2159cdf6 Mon Sep 17 00:00:00 2001 From: dickmao Date: Sun, 1 Mar 2020 13:59:09 -0500 Subject: [PATCH 1/2] do not attempt to encode >1M articles --- README.in.rst | 1 - README.rst | 1 - nnhackernews.el | 5 ++++- 3 files changed, 4 insertions(+), 3 deletions(-) diff --git a/README.in.rst b/README.in.rst index 89f7eac..748c2e2 100644 --- a/README.in.rst +++ b/README.in.rst @@ -30,7 +30,6 @@ Then :: M-x package-refresh-contents RET - M-x package-initialize RET M-x package-install RET nnhackernews RET Alternatively, copy ``nnhackernews.el`` to a directory among ``C-h v RET load-path`` and add ``(require 'nnhackernews)`` to ``.emacs``. diff --git a/README.rst b/README.rst index ccc9a5f..4ded675 100644 --- a/README.rst +++ b/README.rst @@ -30,7 +30,6 @@ Then :: M-x package-refresh-contents RET - M-x package-initialize RET M-x package-install RET nnhackernews RET Alternatively, copy ``nnhackernews.el`` to a directory among ``C-h v RET load-path`` and add ``(require 'nnhackernews)`` to ``.emacs``. diff --git a/nnhackernews.el b/nnhackernews.el index c1f84b3..e0ed7d3 100644 --- a/nnhackernews.el +++ b/nnhackernews.el @@ -1172,13 +1172,16 @@ Optionally provide STATIC-MAX-ITEM and STATIC-NEWSTORIES to prevent querying out "nnhackernews-request-article" it :success (cl-function (lambda (&key data &allow-other-keys) - (insert data)))) + (if (> (length data) 1e6) + (insert body) + (insert data))))) (error (gnus-message 5 "nnhackernews-request-article: %s" (error-message-string err)) (insert body))) (insert body)) (insert "\n") (if (mml-validate) + (message-encode-message-body) (gnus-message 2 "nnhackernews-request-article: Invalid mml:\n%s" (buffer-string))) -- 2.34.1 From 79228eda1ce2bb1487d850a914854de2c25046ee Mon Sep 17 00:00:00 2001 From: dickmao Date: Sun, 1 Mar 2020 14:14:01 -0500 Subject: [PATCH 2/2] 1e6 was too large. Try 300e3 and put it in a defcustom --- nnhackernews.el | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/nnhackernews.el b/nnhackernews.el index e0ed7d3..2ebb213 100644 --- a/nnhackernews.el +++ b/nnhackernews.el @@ -81,6 +81,11 @@ Do not set this to \"localhost\" as a numeric IP is required for the oauth hands :type 'integer :group 'nnhackernews) +(defcustom nnhackernews-max-render-bytes 300e3 + "`quoted-printable-encode-region' bogs when the javascript spyware gets out of hand." + :type 'integer + :group 'nnhackernews) + (defvoo nnhackernews-status-string "") (defvar nnhackernews--mutex-display-article (when (fboundp 'make-mutex) @@ -1172,7 +1177,7 @@ Optionally provide STATIC-MAX-ITEM and STATIC-NEWSTORIES to prevent querying out "nnhackernews-request-article" it :success (cl-function (lambda (&key data &allow-other-keys) - (if (> (length data) 1e6) + (if (> (length data) nnhackernews-max-render-bytes) (insert body) (insert data))))) (error (gnus-message 5 "nnhackernews-request-article: %s" -- 2.34.1