From 95007e53053642a47047dd3067be6d7260ea6742 Mon Sep 17 00:00:00 2001 From: Eli Zaretskii Date: Tue, 22 Oct 2024 09:38:09 +0300 Subject: [PATCH] ; Improve documentation of 'eww-guess-content-type-functions' * lisp/net/eww.el (eww-guess-content-type-functions): Doc fix. * etc/NEWS: Announce 'eww-guess-content-type-functions'. Bug#73133 (cherry picked from commit 9fdc03e8f9868bb9253a0df9bf0c1b718e8576a8) --- etc/NEWS | 9 ++++++++- lisp/net/eww.el | 13 +++++++------ 2 files changed, 15 insertions(+), 7 deletions(-) diff --git a/etc/NEWS b/etc/NEWS index 47e01ebb1d2..48f042f7620 100644 --- a/etc/NEWS +++ b/etc/NEWS @@ -259,7 +259,14 @@ will now automatically turn on 'visual-wrap-prefix-mode' in addition to near window edge and the continuation lines are indented using prefixes computed from surrounding context. -** CC Mode +--- +*** New user option 'eww-guess-content-type-functions'. +The value is a list of functions that EWW should call to determine the +content-type of Web pages which don't have a valid 'Content-Type' +header. The default value is a function that considers a page with an +HTML 'doctype' declaration to have context-type "text/html". + +** CC mode +++ *** New type of 'c-offsets-alist' element. diff --git a/lisp/net/eww.el b/lisp/net/eww.el index 3cdb8a3f42e..4df9740d540 100644 --- a/lisp/net/eww.el +++ b/lisp/net/eww.el @@ -111,13 +111,14 @@ duplicate entries (if any) removed." (defcustom eww-guess-content-type-functions '(eww--html-if-doctype) - "List of functions used to guess a page's content-type. + "List of functions used by EWW to guess the content-type of Web pages. These are only used when the page does not have a valid Content-Type -header. Functions are called in order, until one of them returns the -value to be used as Content-Type. They receive two parameters: an alist -of headers, and the buffer that holds the complete response. If the -list is exhausted, EWW assumes \"application/octet-stream\" per -RFC-9110." +header. Functions are called in order, until one of them returns a +non-nil value to be used as Content-Type. The functions receive two +arguments: an alist of page's headers, and the buffer that holds the +complete response of the server from which the page was requested. +If the list of the functions is exhausted without any non-nil value, +EWW assumes content-type is \"application/octet-stream\", per RFC-9110." :version "31.1" :group 'eww :type '(repeat function)) -- 2.39.2