Sync up with Pterodactyl Gnus v0.61.
[elisp/gnus.git-] / lisp / gnus-art.el
index d8395e8..ff364b8 100644 (file)
@@ -912,6 +912,37 @@ always hide."
           (point-max)))
        'boring-headers))))
 
+(defvar gnus-article-normalized-header-length 40
+  "Length of normalized headers.")
+
+(defun article-normalize-headers ()
+  "Make all header lines 40 characters long."
+  (interactive)
+  (let ((buffer-read-only nil)
+       column)
+    (save-excursion
+      (save-restriction
+       (message-narrow-to-head)
+       (while (not (eobp))
+         (cond
+          ((< (setq column (- (gnus-point-at-eol) (point)))
+              gnus-article-normalized-header-length)
+           (end-of-line)
+           (insert (make-string
+                    (- gnus-article-normalized-header-length column)
+                    ? )))
+          ((> column gnus-article-normalized-header-length)
+           (gnus-put-text-property
+            (progn
+              (forward-char gnus-article-normalized-header-length)
+              (point))
+            (gnus-point-at-eol)
+            'invisible t))
+          (t
+           ;; Do nothing.
+           ))
+         (forward-line 1))))))
+
 (defun article-treat-dumbquotes ()
   "Translate M******** sm*rtq**t*s into proper text."
   (interactive)
@@ -1997,6 +2028,7 @@ If variable `gnus-use-long-file-name' is non-nil, it is
      article-date-lapsed
      article-emphasize
      article-treat-dumbquotes
+     article-normalize-headers
      (article-show-all . gnus-article-show-all-headers))))
 \f
 ;;;
@@ -4065,7 +4097,7 @@ forbidden in URL encoding."
 
 (defvar gnus-decode-header-methods
   '(gnus-decode-with-mail-decode-encoded-word-region)
-  "List of methods used to decode headers
+  "List of methods used to decode headers.
 
 This variable is a list of FUNCTION or (REGEXP . FUNCTION). If item is
 FUNCTION, FUNCTION will be apply to all newsgroups. If item is a
@@ -4081,7 +4113,8 @@ For example:
 (defvar gnus-decode-header-methods-cache nil)
 
 (defun gnus-decode-with-mail-decode-encoded-word-region (start end)
-  (let ((rfc2047-default-charset gnus-default-charset))
+  (let ((rfc2047-default-charset gnus-newsgroup-default-charset)
+       (mm-charset-iso-8859-1-forced gnus-newsgroup-iso-8859-1-forced))
     (mail-decode-encoded-word-region start end)))
 
 (defun gnus-multi-decode-header (start end)