From ab657babf013822604566732d198c6ad094d5f26 Mon Sep 17 00:00:00 2001 From: Lars Magne Ingebrigtsen Date: Mon, 3 Nov 2014 01:35:44 +0100 Subject: [PATCH] Make titles in eww prettier (eww-tag-title): Remove newlines and extra whitespace from the displayed title. --- lisp/ChangeLog | 2 ++ lisp/net/eww.el | 4 ++++ 2 files changed, 6 insertions(+) diff --git a/lisp/ChangeLog b/lisp/ChangeLog index 2288bba4c5e..b4f3f109855 100644 --- a/lisp/ChangeLog +++ b/lisp/ChangeLog @@ -7,6 +7,8 @@ go back to the non-readable version. (eww-display-html): Don't try to decode the text if we've been passed in a pre-parsed DOM. + (eww-tag-title): Remove newlines and extra whitespace from the + displayed title. 2014-11-02 Lars Magne Ingebrigtsen diff --git a/lisp/net/eww.el b/lisp/net/eww.el index 954810ad0c9..2e4a7d76d8d 100644 --- a/lisp/net/eww.el +++ b/lisp/net/eww.el @@ -350,6 +350,10 @@ word(s) will be searched for via `eww-search-prefix'." (dolist (sub cont) (when (eq (car sub) 'text) (setq eww-current-title (concat eww-current-title (cdr sub))))) + (setq eww-current-title + (replace-regexp-in-string + "^ \\| $" "" + (replace-regexp-in-string "[ \t\r\n]+" " " eww-current-title))) (eww-update-header-line-format)) (defun eww-tag-body (cont) -- 2.39.5