4

I would like to save an eww buffer as an html buffer with text formatting, hyperlinks, etc preserved. If I do C-x C-w, it saves only the raw text visible in the buffer.

Here is my use case: I use the below helper function to clean up a web page to show only the information relevant to me.

(defun modi/eww-keep-lines (regexp)
  "Show only the lines matching regexp in the web page.
Call `eww-reload' to undo the filtering."
  (interactive (list (read-from-minibuffer
                      "Keep only lines matching regexp: ")))
  (let ((inhibit-read-only t)) ; ignore read-only status of eww buffers
    (save-excursion
      (goto-char (point-min))
      (keep-lines regexp))))

Hyperlinks and text properties are preserved in the eww buffer after calling the above function.

I would like to save the filtered eww buffer I get after calling the above function as an html file.

  • 1
    I don't have an answer, but let me thank you for that little function. Will come in handy. :) – Manuel Uberti May 28 '15 at 18:15
  • To clarify, you do not just want a buffer with the page source in HTML. You want to go through the EWW rendering engine and back to HTML, preserving only what is actually important to the display? – PythonNut May 30 '15 at 2:33
  • @PythonNut Correct. My end goal is to copy the filtered eww buffer (filtered using that function in the question) as rich text/html so that I can paste that in an email to people. I mainly care about retaining the hyperlinks. – Kaushal Modi May 30 '15 at 3:37

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.