Package: emacs
Severity: minor
Tags: patch
EWW currently fails to trim any leading and trailing whitespace
/and/ newline codes off the
contents, as in the
following (valid) HTML document:
A title with newlines.
Here, eww-current-title will be "\nA title with newlines.\n",
which causes the *eww-history* buffer contents to be formatted like:
A title with newlines.
http://example.org/
Which, in turn, causes eww-history-browse to fail (unless used
on the first line of such an entry), due to the use of
(line-beginning-position):
(let ((history (get-text-property (line-beginning-position) 'eww-history)))
(unless history
(error "No history on the current line"))
(quit-window)
I suggest that this issue be resolved as follows:
• eww-tag-title is changed to strip any [[:blank:]\r\n]+ from
the element textual content; (it may also turn any
embedded [\r\n] codes into ordinary blanks, though it isn’t
/strictly/ necessary given the rest of the changes below);
• eww-list-histories turns any control characters in :title into
something printable (say, using the caret notation; ^J for \n,
etc.; this doesn’t cover non-ASCII controls, though);
• the eww-history property is made to cover the whole
*eww-history* entry, – not just its initial character;
conversely, eww-history-browse is changed to use (point)
instead of (line-beginning-position).
Also, while we’re at it, I suggest getting rid of the
right-padding of the /last/ (as in: second) field of the history
records, for it’s entirely unnecessary, and makes copying the
URIs from *eww-history* harder.
A possible patch is MIMEd. (Note that the eww-tag-title change
looks a bit too verbose, though.)
--
FSF associate member #7257 http://boycottsystemd.org/ … 3013 B6A0 230E 334A