reddit / emacs

eww is awesome. What do you use it for?

ilemming · 2022-11-16 00:49
I had dogs almost all my life. And they were invariably always big breeds. Rottweiler, GSD, Caucasian Shepherd *(google this one if you don't know, I guarantee, you'd be amazed)*. I liked big dogs then, and I still love them. I didn't understand small dogs until we got a miniature schnauzer. And I have to say, this tiny fella is the best companion and non-human friend I ever had. Similarly, all my Emacs life I simply ignored eww. I knew it existed, but I never tried using it. I just didn't understand the point. I would always use "the big browser" and complain that it's sad Emacs doesn't have one. But lately, I've been using eww more and more, and sometimes even get annoyed when I actually have to open something in an external browser. I like eww because it allows me to focus on the text. I love text; text is awesome, it lets me slash through the forest of information without having my mind wander around, overstimulating my brain neurons with fonts, colors, background images, icons, side banners, ads, etc. If you've never read Graydon's "Always bet on text" [post](https://graydon2.dreamwidth.org/193447.html), definitely give it a gander. I agree with it almost entirely. Lately, I even stopped watching YouTube videos to learn anything, at least, not without speeding them up to 1.5x. But first, I would [extract subtitles](https://github.com/agzam/youtube-sub-extractor.el) and quickly read through them, and then proceed to the watching. That lets me learn things and retain information much better. Yes, text is not perfect and interactive, visual data has incredible value and very often text just cannot replace it. But my initial instinct is to scout the text first, and then, if needed get to the rest. I even wrote a [tiny applescript](https://gist.github.com/agzam/e90123c0820991ae39fbe61fed5a57df) to send the current page from the browser to eww. eww is so cool, it can open a pdf link and if for some reason it can't render the document, it would ask you if you want it to try extracting the text. I advised elfeed to automatically open every entry in eww: (advice-add 'elfeed-show-entry :after #'+process-elfeed-entry) (defun +process-elfeed-entry (entry) "Process each type of entry differently. e.g., you may want to open HN entries in eww." (let ((url (elfeed-entry-link entry))) (pcase url ((pred (string-match-p "https\\:\\/\\/www.youtube.com\\/watch")) (youtube-sub-extractor-extract-subs url)) (_ (+eww-open-in-other-window url))))) I borrowed [a bunch of great ideas from Prot](https://protesilaos.com/codelog/2021-03-25-emacs-eww/) I mapped an Embark action, to open any URL in another window: ;; this is Doom syntax, I'm sure you can figure out vanilla Emacs one (map! (:map embark-url-map "e" #'+eww-open-in-other-window)) (defun +eww-open-in-other-window (url) "Use `eww-open-in-new-buffer' in another window." (interactive (list (car (eww-suggested-uris)))) (other-window-prefix) ; For emacs28 -- it's a hack, but why not? (eww-browse-url url :new-window)) And now, I want to find a way to change CSS for different websites. So for example, I want HackerNews comments thread to appear just like in a normal browser, in eww it looks flat and makes it difficult to see which comment belongs to what thread. Also, I'd like to find a way to jump to a specific element on the page. Even though eww has a way to show only the main textual portion, by heuristically analyzing the web page, it can cut out navigation menus and other garbage. That thing doesn't always work and you still have to manually scroll through garbage to get to the main text. *If you know how to do these things, please share your thoughts.* Anyway, my question is, do you use eww? Can you share your tricks and the things you do with it?
fixedfree · 2022-11-16 01:13
I think I might now! Thanks for sharing! Overview for those of use new to eww: https://www.emacswiki.org/emacs/eww
Soupeeee · 2022-11-16 01:42
I occasionally use it to browse documentation, test reports, and other similar text-only documents.
Pay08 · 2022-11-16 01:45
I just don't get how you're supposed to use it. If you have to enter the URL manually, isn't it just easier to use a normal browser?
andyjda · 2022-11-16 02:23
not sure what you mean. The `eww` command takes in any string, and parses it to figure out if it's a URL. If it's not a URL, it'll build a query using the set search-engine (defaults to DuckDuckGo, but you can customize the variable `eww-search-prefix`). The result-page of a search engine is actually mostly text so it's the exact type of content that works best in `eww` Also if the word at point is a URL (or looks like it), it'll be used as the default argument (but `eww` will ask for confirmation first)
na85 · 2022-11-16 02:25
Ahh but you see it's not a browser. It's a wowser.
Pay08 · 2022-11-16 02:28
>If it's not a URL, it'll build a query using the set search engine I didn't know that, that makes it much more useful.
donio · 2022-11-16 02:35
Most important use is rendering HTML emails in notmuch. (shr rather than eww but close enough). But I use it for regular browsing too, mainly text-only versions of news sites: https://www.cbc.ca/lite/news/world?sort=editors-picks https://text.npr.org/ https://lite.cnn.io/en http://68k.news/ Local files like documentation, conversion outputs. Some other text focused sites.
andyjda · 2022-11-16 02:39
Happy to help (:
thetemp_ · 2022-11-16 02:52
This is great NEWS!
redback-spider · 2022-11-16 03:30
Who claims that emacs has no bigger browser there is xwwp. But I get it it's so impossible to get emacs with xwidget support installed and running that in novhere runs. I just installed it even on a guix machine but there was only the emacs command that started the non xwidget emacs, then I tried to find it in the /gnu directory just that xwwp then crashed emacs repeatable before it showed 1 website :)
ilemming · 2022-11-16 05:12
Yes, I use xwidget as well. I wanted to try xwwp, for a while now, perhaps, I finally will. Thank you for reminding me about it. I don't use xwidget much, mainly because of two reasons. The first one is text. The second reason why often I don't use xwidget, is technical, and I'm pretty sure it'll get fixed at some point. There's a bug in xwidget where Emacs sometimes stops recognizing `<ESC>` after creating an xwidget buffer. Even if you switch to another window, it still won't work, until you perform a mouse click. I've tried to find a workaround, emulating clicks, using hooks and advising things, but I've never succeeded. It really annoys me, but I can't do anything about it. I'm not even sure if this bug happens only on Mac, maybe it doesn't affect Emacs on Linux. But my current workstation is a Mac (not by choice though).
ilemming · 2022-11-16 05:22
Well, frankly, I don't ever have to type any URLs to get to eww. From elfeed, it just opens them automatically. There's `eww-search-words`, it feeds them to a search engine (just like [@andyjda](https://www.reddit.com/user/andyjda) said). Any URL I encounter in a text e.g., in email, which I read in Emacs (I use notmuch) - I would dispatch an Embark action. If you don't use Embark, give it a try, it's very awesome. So, yes, there's no manually typing URLs, almost ever. Matter of fact, I don't even remember when I stopped typing URLs, even for a regular browser. Almost always I type my search queries in Emacs, there's [engine-mode](https://github.com/hrs/engine-mode). Doing it in Emacs lets you do very flexible things, for example, I can perform code search on GitHub, and it would automatically set the language of search depending of what major-mode is of the current buffer. (defcustom engine-mode/github-mode->lang '(("clojurescript" . "Clojure") ("clojure" . "Clojure") ("clojurec" . "Clojure") ("emacs-lisp" . "Emacs Lisp") ("Info" . "Emacs Lisp") ("lisp-data" . "Emacs Lisp") ("helpful" . "Emacs Lisp") ("js" . "JavaScript")) "Associates current mode with a language in Github terms" :type 'alist :group 'engine) (defun engine/search-github-with-lang () "Search on Github with attempt of detecting language associated with current-buffer's mode" (interactive) (let* ((mode-name (replace-regexp-in-string "-mode$" "" (symbol-name major-mode))) (lang (cdr (assoc mode-name engine-mode/github-mode->lang))) (lang-term (if lang (concat "language:\"" lang "\" ") "")) (current-word (if (region-active-p) (buffer-substring (region-beginning) (region-end)) (thing-at-point 'symbol))) (search-term (read-string "Search Github: " (concat lang-term current-word)))) (engine/search-github search-term)))
arthurno1 · 2022-11-16 05:30
I perceive it a bit slow, but I occasionally open some blogs or docs in it. For example, I recently wrote a small parser for html5 elements and used eww to read HTML spec from whatwg.org, so I don't need to switch between Emacs and browser when following tags and elements documentation. I think I should use it a bit more than what I do currently, but I am so latent to change my workflow when I well am used to something.
[deleted] · 2022-11-16 05:43
[deleted]
Mango-D · 2022-11-16 05:48
eww doesn't support the modern web. I use EAF instead.
ilemming · 2022-11-16 05:51
It's about text, not web browsing. For web I still use a browser.
gopar · 2022-11-16 06:11
Like many I use it for documentation and text friendly sites. I even ported the famous vimium browser plugin to eww. Best of both worlds \o/
ilemming · 2022-11-16 06:47
> I even ported the famous vimium browser plugin to eww. What? No way.. link please?
Shimmy-choo · 2022-11-16 08:33
Huh. I always just assumed this would be a terrible experience, direct was akin to getting doom to run on a mechanical calculator. More about proving that it can be done, than for it to be actually useful. I will have to give it a try, thanks for the suggestion!
Face_Motor_Cut · 2022-11-16 09:23
Have you tried the eaf browser?
sarmaq · 2022-11-16 09:37
I've been bit by Caucasian shepherd twice as a kid.
Pay08 · 2022-11-16 10:50
I don't use RSS (maybe I should start), so my usecases there are limited. Can you actually use GitHub in a text-only environment? The last time I tried it didn't look like it. I'll check out embark, thanks for the recommendation.
owmagow · 2022-11-16 15:31
Never heard of eaf. Gonna check it out. Thanks.
unix_hacker · 2022-11-16 15:59
If you're interested in a text-centric Internet like I am, look into [elpher](https://github.com/emacsmirror/elpher), which is a web browser for the [Gopher](https://en.wikipedia.org/wiki/Gopher_(protocol)) and [Gemini](https://gemini.circumlunar.space/) protocols, which are text-centric alternatives to HTTP. Gemini is the successor to Gopher (an early competitor to HTTP), and its websites are practically just simple Markdown pages. If you want to support an alternate universe of text-centric websites, consider setting up your own page on Gemini.
lykwydchykyn · 2022-11-16 17:39
If I could get eww to login to reddit, it might have a future with me. So far i just can't work it into what I do; even stuff as mundane as API docs seem to require javascript and fancy CSS rendering. I love the idea of being able to browse the web in emacs with minimal styling, and I pine for the days when I could use conqueror or keysnail to have an emacsy browsing experience, but sadly firefox broke all that and I won't touch Chrome if I can help it. If only the web were still based on standards and not whatever Google or Mozilla push next.
paretoOptimalDev · 2022-11-16 19:11
If eww updated buffername with page title and opened a new eww buffer by default I could use it a lot more. I'm pretty sure those things are easy to do, bur haven't gotten around to them yet
ilemming · 2022-11-16 21:00
Prot has done some tweaks, if you haven't seen it, give it a try https://protesilaos.com/codelog/2021-03-25-emacs-eww/
ilemming · 2022-11-16 21:09
Whoa, that sounds terrible. Adult caucasian shepherd probably won't kill you (they are smarter than that), but can definitely cripple you for life. A shepherd protecting his territory is an unstoppable, fearless, terror-bearing killer machine. To be honest, even though I had one before, these dogs terrify me. Not because I don't trust a dog. I just need to learn to trust the owner. Some people have them because they want an aggressive dog. And that's just wrong.
ilemming · 2022-11-16 21:12
> I don't use RSS I recently started using elfeed. And was pleasantly surprised of how good it is. I'm now reading HN, lobste.rs, reddit, some scientific news, etc., all through it. Try it, it's awesome. > Can you actually use GitHub in a text-only environment I use a combination of [magit-forge](https://github.com/magit/forge), [gh-notify](https://github.com/anticomputer/gh-notify), [code-review](https://github.com/wandersoncferreira/code-review), [gist](https://github.com/defunkt/gist.el), [git-link](https://github.com/sshaw/git-link). That covers most of the stuff I do with GitHub. Occasionally I have to open GitHub URLs in the browser, almost always jumping to it from Emacs. I've been itching to write a package to control GH Actions and read the logs and unless someone beats me to it, I'm hoping to work on that soon.
ilemming · 2022-11-16 21:15
Why do you need to login to reddit? If you just want to browse specific subreddits, use the rss feed. I browse through r/emacs (and some others) in elfeed. When I need to comment on stuff, I'd open the link in an external browser. Takes a keystroke.
ilemming · 2022-11-16 21:20
I have not. I'm required to use Mac for work, and since it takes too much effort to keep work and personal stuff on separate machines, I just use Mac for everything. The last time I tried using EAF on Mac, it didn't work for me. I think they've fixed the issues since then. I have to give it another try. But I use EWW not for the real web experience though. I use it for pure text. So, even with EAF, it still would be very valuable for me.
Pay08 · 2022-11-16 21:25
Yeah, the main thing that stopped me a while back was that there was no reader that I actually liked (at least not in my distro's repos).
ilemming · 2022-11-16 21:52
Oh, yeah, that's interesting. I wonder if websites still support Gopher, IIRC all major browsers stopped supporting the protocol. And I wonder if there are many good sources (news, etc.) that support Gemini. I need to learn more about these protocols and see where they stand today. Sadly, it seems they are not used much these days. Thank you for your suggestions.
ilemming · 2022-11-17 05:16
what kind of reader are you talking about? You just want to read random files off GitHub? Open its raw form in the browser, send it to eww, then change the major mode to whatever type of the file you're dealing with. e.g., sometimes I read Org-mode files that way, without having to download them. That reminds me, I probably need to figure out a bookmarklet (or something) that clicks on "RAW" button and sends the link to EWW.
Pay08 · 2022-11-17 08:03
I meant an RSS feed reader.
sarmaq · 2022-11-17 12:43
I'm from Caucasus. They are indeed terrifying, especially when you're a child. One bit me when I threw it a bone in the arm. Another bit me in the leg when I was in mountains chasing chickens (it was a farm where I lived with my family).
ilemming · 2022-11-17 18:36
Oh, try elfeed. It's not too difficult to set it up and it's really good. I stopped mourning the loss of Google Reader, which I used every day until Google have decided to kill it. And after that I stayed skeptical (about rss) for a long time, thinking I don't need an rss reader. But I still occasionally want to browse through HN, lobse.rs, reddit, etc. elfeed turned out to be a huge time-saver. I no longer feel like aimlessly browsing through web-pages, clicking "next" btn, thinking any moment now I will discover something amazing. It just lets me slash through the noise.
Benthamite · 2022-11-22 01:14
Link‽
gopar · 2022-11-22 02:47
It's not a public package, its not even a package. It's a series of functions in my config
gopar · 2022-11-22 02:48
See above
AuroraDraco · 2022-11-22 14:33
RSS is awesome actually. It took me a long time to set up elfeed and get into the habit of reading RSS, but once you have a good list of new sites you enjoy reading it basically acts like an all in one news platform where you read all your news and they are ordered by means of which you find more interesting (with elfeed-score). Highly recommend you get started with it