diff --git a/lisp/gnus-logic.el b/lisp/gnus-logic.el index 954295438c953c2500b9c1959a49e52312cc9653..38442a406dd6fb6ef47cd468248618e68337a26a 100644 --- a/lisp/gnus-logic.el +++ b/lisp/gnus-logic.el @@ -181,8 +181,10 @@ (with-current-buffer nntp-server-buffer (let* ((request-func (cond ((string= "head" header) 'gnus-request-head) + ;; We need to peek at the headers to detect the + ;; content encoding ((string= "body" header) - 'gnus-request-body) + 'gnus-request-article) (t 'gnus-request-article))) ofunc article) ;; Not all backends support partial fetching. In that case, we @@ -196,6 +198,7 @@ (gnus-message 7 "Scoring article %s..." article) (when (funcall request-func article gnus-newsgroup-name) (goto-char (point-min)) + (gnus-score-decode-text-parts) ;; If just parts of the article is to be searched and the ;; backend didn't support partial fetching, we just narrow to ;; the relevant parts. diff --git a/lisp/gnus-score.el b/lisp/gnus-score.el index f86b6f837a70ce54b06668187821fe57c3f80f4c..003355dd2c91847241dc67263f83d26ae52920de 100644 --- a/lisp/gnus-score.el +++ b/lisp/gnus-score.el @@ -1736,6 +1736,24 @@ score in `gnus-newsgroup-scored' by SCORE." (setq entries rest))))) nil) +(defun gnus-score-decode-text-parts () + (let ((handles (mm-dissect-buffer t))) + (cond ((stringp (car handles)) (pop handles)) + ((and (bufferp (car handles)) + (stringp (car (mm-handle-type handles)))) + (setq handles (list handles)))) + + (save-excursion + (article-goto-body) + (delete-region (point) (point-max)) + (save-restriction + (narrow-to-region (point) (point)) + (mapc #'mm-display-inline + (remove-if-not + (lambda (handle) + (string-match "^text/" (mm-handle-media-type handle))) + handles)))))) + (defun gnus-score-body (scores header now expire &optional trace) (if gnus-agent-fetching nil @@ -1752,8 +1770,10 @@ score in `gnus-newsgroup-scored' by SCORE." (all-scores scores) (request-func (cond ((string= "head" header) 'gnus-request-head) + ;; We need to peek at the headers to detect + ;; the content encoding ((string= "body" header) - 'gnus-request-body) + 'gnus-request-article) (t 'gnus-request-article))) entries alist ofunc article last) (when articles @@ -1773,6 +1793,7 @@ score in `gnus-newsgroup-scored' by SCORE." (widen) (when (funcall request-func article gnus-newsgroup-name) (goto-char (point-min)) + (gnus-score-decode-text-parts) ;; If just parts of the article is to be searched, but the ;; backend didn't support partial fetching, we just narrow ;; to the relevant parts.