From 656caef3505e11b073d59b9c18d3fd21e199d77c Mon Sep 17 00:00:00 2001 From: Lars Magne Ingebrigtsen Date: Tue, 10 Feb 2015 16:29:05 +1100 Subject: Allow using variable-width fonts in eww * lisp/gnus/mm-decode.el (mm-shr): Only pass the fill column when not using fonts, because limiting the width to what's appropriate for followups doesn't really help when not using proportional fonts. * lisp/net/shr.el (shr-use-fonts): New variable. (shr-fill-text): Rename from "fold". (shr-pixel-column, shr-pixel-region, shr-string-pixel-width): New functions. (shr-insert): Just insert, don't fill the text. Filling is now done afterwards per display unit. (shr-fill-lines, shr-fill-line): New functions to fill text on a per-unit base. (shr-find-fill-point): Take a "beginning" parameter. (shr-indent): Indent using the :width display parameter when using fonts. (shr-parse-style): Ignore "inherit" values, since we already do that. (shr-tag-img): Remove the insertion states. (shr-tag-blockquote): New-style filling. (shr-tag-dd): Ditto. (shr-tag-li): Ditto. (shr-mark-fill): New function to mark lines that need filling. (shr-tag-h1): Use a larger font. (shr-tag-table-1): Get the natural and suggested widths in one rendering. (shr-tag-table): Create the "fixed" version of the table only once so that we can cache data in the table. (shr-insert-table): Get colspan calculations right by having zero-width columns after colspan ones. (shr-expand-alignments): New function to make :align-to specs work right when rendered in one buffer and displayed in another one. (shr-insert-table-ruler): Use :align-to to get the widths right. (shr-make-table): Cache more. (shr-make-table-1): Use the new data layout. (shr-pixel-buffer-width): New function. (shr-render-td): Add a caching layer. (shr-dom-max-natural-width): New function. --- lisp/gnus/ChangeLog | 12 ++++++++++++ lisp/gnus/mm-decode.el | 9 ++++++++- 2 files changed, 20 insertions(+), 1 deletion(-) (limited to 'lisp/gnus') diff --git a/lisp/gnus/ChangeLog b/lisp/gnus/ChangeLog index 32d3f08f586..ac7e2acab93 100644 --- a/lisp/gnus/ChangeLog +++ b/lisp/gnus/ChangeLog @@ -1,3 +1,15 @@ +2015-02-10 Lars Ingebrigtsen + + * mm-decode.el (mm-shr): Only pass the fill column when not using + fonts, because limiting the width to what's appropriate for followups + doesn't really help when not using proportional fonts. + +2015-02-09 Lars Ingebrigtsen + + * mm-decode.el (mm-convert-shr-links): Don't overwrite the faces from + shr, beacause that breaks folding. + (mm-shr): Don't shorten the width when using fonts. + 2015-02-05 Teodor Zlatanov * gnus-start.el (gnus-save-newsrc-file-check-timestamp): Remove diff --git a/lisp/gnus/mm-decode.el b/lisp/gnus/mm-decode.el index 311ea7cffff..6c783bbef03 100644 --- a/lisp/gnus/mm-decode.el +++ b/lisp/gnus/mm-decode.el @@ -1815,6 +1815,7 @@ If RECURSIVE, search recursively." (start end &optional base-url)) (declare-function shr-insert-document "shr" (dom)) (defvar shr-blocked-images) +(defvar shr-use-fonts) (defvar gnus-inhibit-images) (autoload 'gnus-blocked-images "gnus-art") @@ -1822,7 +1823,10 @@ If RECURSIVE, search recursively." ;; Require since we bind its variables. (require 'shr) (let ((article-buffer (current-buffer)) - (shr-width fill-column) + (shr-width (if (and (boundp 'shr-use-fonts) + shr-use-fonts) + nil + fill-column)) (shr-content-function (lambda (id) (let ((handle (mm-get-content-id id))) (when handle @@ -1890,12 +1894,15 @@ If RECURSIVE, search recursively." (< start (point-max))) (when (setq start (text-property-not-all start (point-max) 'shr-url nil)) (setq end (next-single-property-change start 'shr-url nil (point-max))) + (setq face (get-text-property start 'face)) (widget-convert-button 'url-link start end :help-echo (get-text-property start 'help-echo) :keymap shr-map (get-text-property start 'shr-url)) (put-text-property start end 'local-map nil) + (dolist (overlay (overlays-at start)) + (overlay-put overlay 'face nil)) (setq start end))))) (defun mm-handle-filename (handle) -- cgit v1.2.3