I'm not sure why the background color is there either, but it seems to be controlled by the function shr-color-check, which is supposed to check that the contrast between the fg and bg is sufficient for the text to be visible. I agree that the readability is not very good in your example. Luckily, there are some variables that can be tweaked: shr-color-...
eww is basically an interactive wrapper around the shr package, which renders HTML as Emacs text (the actual HTML parsing is done by the libxml package). You can use it in mu4e by setting mu4e-html2text-command to a simple custom function:
(defun my-render-html-message ()
(let ((dom (libxml-parse-html-region (point-min) (point-max))))
As noted in the EWW info manual node you can use EWW as a target for browse-url, which is what Org uses if a URI starts with "http", "https", etc. You can of course customize browse-url behaviour with M-x customize-group browse-url
Alternatively, add the following to ~/.emacs.d/init.el: (setq browse-url-browser-function 'eww-browse-url)
If you're visiting ...
Eww, as many other packages, uses the display text property to
display images. That is why toggling the invisible text property
didn’t help. You’re making the text itself invisible but the display
property is still being shown.
In fact, this is something so common that the code below should work
on any buffer that displays images (not just eww).
eww uses the url library, so we can add advice to url-http-user-agent-string to fake the User-Agent string:
(advice-add 'url-http-user-agent-string :around
"Pretend to be a mobile browser."
"Mozilla/5.0 (Linux; U; Android 4.0.3; ko-kr; LG-L160L ...
load-theme-buffer-local.el (GitHub repository) is supposed to do what I tried to do, but do it the right way.
To use it with eww, install it and add
(lambda () (load-theme-buffer-local 'tango (current-buffer))))
to your init file.
PS: I cannot test this approach myself, so let me know if this works.
As @Drew noted, Emacs doesn't include this library so on Windows you need to install it separately.
See the Emacs README.w32 section "Optional dependency libraries" for more information. As of Emacs 25 it looks like you can download the dependencies from the GNU FTP server (or a mirror). E.g. http://ftp.gnu.org/gnu/emacs/windows/emacs-25-x86_64-deps.zip
You are correct that eww does not automatically create new buffers for you. But I have been using this trick from ergoemacs.org and it works great!
With the below eval'ed, each time you do M-x eww from a non-eww buffer, a unique eww buffer will be created.
;; Auto-rename new eww buffers
(defun xah-rename-eww-hook ()
"Rename eww browser's buffer so sites ...
Warning: dirty work-around ahead
Since you "greatly prefer [pdf-tools] to DocView", is it safe to assume that using it to view all pdfs is acceptable?
The following code snippet will switch the document to pdf-view-mode anytime doc-viewis entered with a pdf document.
(defvar tv/prefer-pdf-tools (fboundp 'pdf-view-mode))
(defun tv/start-pdf-tools-if-pdf ()...
As of Emacs 25.1 you can pass an argument to eww-reload to load from the cache rather than the network. I'm using the following:
(defun my/eww-toggle-images ()
"Toggle whether images are loaded and reload the current page fro cache."
(setq-local shr-inhibit-images (not shr-inhibit-images))
(message "Images are now %s"
shr.el has a (defvar shr-inhibit-images nil), and a
(defcustom shr-blocked-images nil
"Images that have URLs matching this regexp will be blocked."
:type '(choice (const nil) regexp))
It seems like (setq shr-inhibit-images t) stops the web requests when I view HTML emails.
Note that it turns off image display for eww ...
shr and eww can't work in Emacs 23. Regardless of other incompatibilities, they require Emacs to have been compiled with libxml2 support, and that ability came in 24.1
If you want to try eww, you should install Emacs 24.4 or later ("later" currently meaning compiling from the source repository).
Note that eww is built into these versions (24.4+) of Emacs, ...
This doesn't work
The reason calling eww-readable right after eww does not work is because eww is asynchronous; when eww-readable is called the eww buffer is not yet rendered, so there are no "unreadable" parts to omit.
How to do that?
There may be a more elegant way, but if you have lexical binding (see the last section) enabled in your init file, you ...
This behaviour was discussed in bug#34374 and merged on 2019-02-15.
So in Emacs 27, calling eww with a prefix argument tells it to use a new buffer instead of reusing the default *eww* buffer.
I'm surprised this functionality isn't just built-in. Am I just missing it?
Yes and no. Similar functionality was added in Emacs 26 as the command eww-...
As far as I can tell *eww* buffers store image data in the display text property.
So, to save an image we need to get this property and save it to a file.
Here is a sketch of a solution.
(defun my-eww-save-image (filename)
"Save an image opened in an *eww* buffer to a file."
(let ((image (get-text-property (point-min) 'display)))
Start a file-notify watch when opening a file in eww.
In the callback function for that watch, do 2 things:
Reload the *eww* buffer every time the function is triggered by file-notify event.
Log the event descriptors specific to file opening actions in eww. This is because you need to know which file-notify watches to remove when you quit eww (...
You can go back with l (which is bound to eww-back-url). As with
any major mode, you can get an overview of available keybindings by
typing C-h m in a eww buffer.
The keybinding l is meant to be familiar to Emacs users, as it's
also used in the info browser (where it runs Info-history-back).
If you want to generally change/add the rendering of nodes of a certain tag type you just add an association from the tag as symbol to the rendering function in the list shr-external-rendering-functions.
Example: Render <em> nodes using a self defined function my-tag-em:
(add-to-list 'shr-external-rendering-functions '(em . my-tag-em))
I have tested ...
Bookmark+ gives you lots of ways to manage sets of normal Emacs bookmarks, including for EWW.
It also offers several unique possibilities for bookmarking URLs with EWW, if you use Emacs 25 or later.
You can convert your existing EWW "bookmarks" (which are not normal Emacs bookmarks) to normal Emacs bookmarks.
From then on, you can just create normal Emacs ...
This problem was caused by pkg-config being installed in two places. Once by apt, the other time by Linuxbrew. The path was finding the Linuxbrew pkg-config copy first, which was configured to look in non-standard locations for libraries.
While this is problem is specific to the site, it's important to note that pkg-config will report that a package isn'...
It seems eww is designed to avoid this behavior. This function, eww-new, can be called when a new eww buffer is desired:
(defun eww-new ()
(let ((url (read-from-minibuffer "Enter URL or keywords: ")))
(switch-to-buffer (generate-new-buffer "eww"))
Looks like this is bug#24111, which was fixed for Emacs 26 in "Fix rendering of some complex SVG images" of 2017-01-24.
It is always recommended to use the latest Emacs version possible, especially in the context of browsing the web, but in the meantime I think you can hack around this issue on Emacs 25 with the following advice:
You seem to be using dynamic binding which means that str would be evaluated once your lambda function is executed at which time the variable str is no longer in scope.
You should turn on lexical binding to have your hook function converted into a closure during the invocation of my-eww-url so that once your hook function will be invoked str will be bound ...
I fixed the same issue with a noob solution so here it is:
I basically added a hook that calls eww-reload on the "other frame" -that supposedly has the web page open- once the markdown gets saved.
This works fine for me as I usually have my window split into two frames only when I'm writing in markdown, one for md and the other for preview -using either ...
Glenn Morris on the emacs.bugs mailing list pointed out a bug of emacs-24.5. One has to delete the cookie caching file saved in url-cookie-file because it can became saved in an incorrect format. http://debbugs.gnu.org/cgi/bugreport.cgi?bug=21370
I had the same problem and I have finally got it working.
I applied the patch in https://debbugs.gnu.org/cgi/bugreport.cgi?bug=11788#52.
Then, to solve
error in process filter: url-http-generic-filter: Wrong type argument:
I just had to add a line to url-http.el:462 which was
(skip-chars-forward "HTTP/") ; Skip ...