From: Lars Ingebrigtsen Date: Thu, 24 Dec 2015 16:34:31 +0000 (+0100) Subject: Allow overriding shr functions from eww X-Git-Tag: emacs-26.0.90~2881 X-Git-Url: http://git.eshelyaron.com/gitweb/?a=commitdiff_plain;h=45ebbc0301c8514a5f3215f45981c787cb26f915;p=emacs.git Allow overriding shr functions from eww * eww.el (eww-display-html): Allow overriding elements in `shr-external-rendering-functions'. --- diff --git a/lisp/net/eww.el b/lisp/net/eww.el index 5748e88bbca..2224b2e74e7 100644 --- a/lisp/net/eww.el +++ b/lisp/net/eww.el @@ -411,13 +411,15 @@ Currently this means either text/html or application/xhtml+xml." (inhibit-modification-hooks t) (shr-target-id (url-target (url-generic-parse-url url))) (shr-external-rendering-functions - '((title . eww-tag-title) - (form . eww-tag-form) - (input . eww-tag-input) - (textarea . eww-tag-textarea) - (select . eww-tag-select) - (link . eww-tag-link) - (a . eww-tag-a)))) + (append + shr-external-rendering-functions + '((title . eww-tag-title) + (form . eww-tag-form) + (input . eww-tag-input) + (textarea . eww-tag-textarea) + (select . eww-tag-select) + (link . eww-tag-link) + (a . eww-tag-a))))) (erase-buffer) (shr-insert-document document) (cond diff --git a/lisp/net/shr.el b/lisp/net/shr.el index d51b8c73d10..23899521140 100644 --- a/lisp/net/shr.el +++ b/lisp/net/shr.el @@ -135,6 +135,14 @@ cid: URL as the argument.") (defvar shr-inhibit-images nil "If non-nil, inhibit loading images.") +(defvar shr-external-rendering-functions nil + "Alist of tag/function pairs used to alter how shr renders certain tags. +For instance, eww uses this to alter rendering of title, forms +and other things: +((title . eww-tag-title) + (form . eww-tag-form) + ...)") + ;;; Internal variables. (defvar shr-folding-mode nil) @@ -150,7 +158,6 @@ cid: URL as the argument.") (defvar shr-depth 0) (defvar shr-warning nil) (defvar shr-ignore-cache nil) -(defvar shr-external-rendering-functions nil) (defvar shr-target-id nil) (defvar shr-table-separator-length 1) (defvar shr-table-separator-pixel-width 0)