Hacker News new | comments | show | ask | jobs | submit login
The Emacs Widget Library (gnu.org)
67 points by licorna 3 months ago | hide | past | web | favorite | 51 comments



What's the news here? The widget library has been around since 2000. The comments seem to have devolved into yet another vi/emacs debate, but the article isn't about emacs per se.


After using vim for years and becoming what I would consider proficient in it, is there any reason to try out emacs? I've been wondering if I could be more productive in it after the learning curve, or if I should spend that time further solidifying and slightly improving my vim skills. Has anyone here used both and have any thoughts on this?


Emacs is not just an editor, it's a text-mode Lisp machine.

If you like this idea, it does make sense to try it. Some people love Evil, a Vim emulation layer on top of Emacs.

I do all my computing using just StumpWM, Emacs, Firefox and xterm. I'm much happier than with my previous setup. Curses-based CLI applications don't compose well. They are little silos.

In contrast, on Emacs everything is hackable and alive. There's a wealth of classic packages (calc, dired, gnus, ansi-term, ess, auctex...) and modern ones (org-mode, magit, notmuch, pdf-tools, projectile, ivy, company...) that can let you craft a great environment.

Even if you are not a fan of huge customizations, I'm not either, small tweaks that adapt everything to your preferred workflow really do increase productivity. For example, my agenda view on org-mode emulates a kanban board.

I prefer to do as much of my computing as possible on a text-mode Lisp machine for this reason. Everything is friendly and customizable alive. I do web stuff on a regular browser inside a container: Firefox + Tridactyl. And plumbing is left to Unix, either NixOS or a simple Linux (Arch or Slackware) on xterm.

I find that trying to move stuff that naturally falls into one of these platforms (Emacs, Web, Unix) into another one makes me unhappy. For example, trying to browse the web on Emacs or composing emails on a web browser.


> I do all my computing using just StumpWM, Emacs, Firefox and xterm

Same, though I use Awesome for my window manager.


If only it was an actual graphical-mode Lisp machine.

XEmacs did better there, but it seems to have faded away.


What type of container do you use for your browser?


Just firejail (despite the name it has no association to Firefox):

https://firejail.wordpress.com/

https://wiki.archlinux.org/index.php/Firejail

It's super easy to use.


I also used Vim for about 5 years. I have been using Emacs for about two years now. Emacs, hands down, is the better editor, and not only that. When I first decided to learn one of them, Vim seemed cool because modal editing was something new to me. I'm glad I learned it, but I wish I had switched to Emacs earlier. Emacs offers so much than Vim plus many other programs combined. Emacs users often mention org-mode, but to me Gnus is the best non-programming related Emacs package. Life's short. In addition to learning an editor, I don't want to learn an email client UI (all of the ones I used (Thunderbird, Gmail website, Evolution, Geary, Kmail, etc.) suck compared to Gnus), an IRC UI, or any other software that I may want to use in the future. With Emacs, once I grasped the basics, learning ERC (an IRC client), org-mode, Gnus, Projectile, etc. was not that hard. For example, using org-mode I can create flashcards and export them to Anki (it' so much faster and less frustrating than the Anki editor). Emacs is also well documented. Moreover, Elisp introduced me to the Lisp family of languages. I'm amazed how the Common Lisp development environment with Slime and Quicklisp is so much better than anything else out there. People think Python notebooks are great for easy prototyping. I say they should try Slime first. yada yada yada (You should try Emacs yourself and see if you like it.) yada yada yada.


> I'm amazed how the Common Lisp development environment with Slime and Quicklisp is so much better than anything else out there.

Now imagine the commercial ones.

https://franz.com/products/allegro-common-lisp/acl_ide.lhtml

http://basalgangster.macgui.com/RetroMacComputing/The_Long_V...


Why Franz and not LispWorks?

20 minutes into a Franz video about single-step debugging and they still hadn’t set it up yet. Maybe that was impressive 30 years ago?


Have you tried Notmuch. I like Gnus, but I find Notmuch's architecture really neat. Besides, it's super fast.

Have you considered org-drill instead of exporting to Anki? Or you run Anki on a phone?

The only thing I miss on Emacs is a good OMEMO XMPP or Signal implementation. Currently Bitlbee lacks both.


I tried mu4e before Gnus. Haven't tried Notmuch. I like reading hackernews and some mailing lists on Gnus without cluttering my inbox. Not sure if Notmuch can handle that.

Yes, I use Anki on my phone too.

I haven't thought about using Emacs as an IM, but I use w3m for browsing, which is great given all JS/CSS crap we get from websites these days. I just want text and can easily search for it within w3m.


How well does Evil mode work with Gnus? I used mu4e for a while but eventually just went back to thunderbird.


I don't know. I've never used Evil. I felt like I should actively forget Vim in order to get the most out of Emacs. Vim emulation maybe good for editing for some people, but Emacs is much more than an editor. People bring up the Emacs pinky problem, and I agree it's a problem. But the solution for me was easy: mapped the left alt to ctrl, and kept using the right alt as alt.


Mine is nearly the same. I use xcape to make space behave as ctrl when pressed in conjunction with other keys, but just space otherwise. Much more convenient use of the left thumb. But yes, in practice there is some getting used to it if you are a fast typer, because xcape uses a tiny time threshold to distinguish between the intent behind these two (and that normal space occurs at key release, not key press).


Interesting, I alt as control on Windows and Linux. I wonder if there is a way to map Space to Control when tapped on Windows.


Map as in the equivalent of the xcape solution? You can do these things using AutoHotKey. I use this:

https://github.com/benhansenslc/BigCtrl


I have used vim/tmux/screen for almost 20 years, and while I only use a subset of the functionality, I am extremely at home in that workflow. I recently switched over to Emacs because I started spending a lot of time in Scheme.

I set it up over a couple of days to almost entirely emulate my vim setup: leader key, 'jk'->ESC, evil binding everywhere, you name it. At this point, my config file is only 165 lines, yet it provides all the editing comforts to which I'm accustomed. The only thing I haven't figured out yet is how to map my enter key to ':' in normal mode.

I still use vim out of habit when I'm in the terminal, but the transition is so smooth I don't even notice which one I'm using. It's difficult to say if it's worth the effort to switch unless you are looking at a specific use case with which vim struggles. I am in love with the ease of CL/Scheme editing in Emacs, but without that itch, I probably wouldn't have switched. I've had many people try to convert me in the past, but they couldn't provide the why.


Can you share this config you speak of? Would like to give it a whirl!


Sure. https://pastebin.com/R7zmfhp0

I don't use a lot of plugins in vim so it's relatively trim. The only thing I'm planning on adding at this point is https://github.com/emacs-evil/evil-surround. Ivy probably requires some tweaking to get the behavior right, and I'm not super familiar with it yet.


I too have vim muscle memory in the terminal, so what I do is alias vim to emacsclient. It's actually really great! Terminal emacsclient with evil is basically indistinguishable from terminal vim.


I think you shouldn't concern yourself too much with the editor. Negative productivity gains are a possibility too. Emacs can be the ultimate productivity trap if you love customizing stuff. Using Emacs often feels like working on a buggy, never-ending project.


I've been down this road and negative gains are likely. I like tinkering with these things and find it fun, so that's fine with me. But efficiency/productivity we're secondary to exploration.

Unless you have it your heart to become an absolute elisp guru, emacs won't really offer you anything more than vim or any other editor, except plugins that are harder to integrate and configure.


Interesting perspective. I know the thought has sometimes struck me how much time I put on extending my Emacs... but as of late, I have also been shocked by how much time it has saved me. I can now do rather complicated sequences of actions with the press of a key or two. This would not have been as easy to implement without Emacs!


I've used Emacs for about 8 years now and before that I used vim. I think Emacs in Evil mode is the best. Emacs default keybindings were giving me the Emacs pinky.

Then again nowadays I am trying to be pragmatic with editors and more get things done. It is easy to go into endless customization in Emacs where you don't actually solve any real problems. (i.e I once used elnode https://github.com/nicferrier/elnode to build and host a website... great little project that took way too much time better used elsewhere.)

Nowadays I basically do VSCode for many things and jump onto Emacs if VSCode can't do it. Still using vim bindings though.


A classic trick to avoid Emacs pinky is swapping Caps Lock and Ctrl. I'm using it everywhere though; swapcaps makes it much more comfortable to use the Ctrl key on a standard PC keyboard.


Another approach is to hit Control in its default corner location with the bone below the pinky (fifth metacarpal) instead of the pinky itself. It's definitely a little awkward at first, but works better than you might expect after a little bit of practice. Probably not very viable for most laptop keyboards, though.

Truly hardcore modifier wizards (or people recovering from injury) have been known to use pedals.


I hit Control with the last finger joint before the nail, pinky curled. I don't know how it happened but that's how it is now.


With the placement of the Control key on most keyboards, your pinkie is doing a straight downwards motion which is much less straining than going sideways, even if it is a bit of a long stretch. Most keyboards (maybe not on laptops though) also have two Control keys so the load is distributed over two pinkies instead of one and neither hand makes any crazy stretches. Personally, I think Caps Lock as Control is categorically terrible advice. I'm sure your intentions were good, but I wouldn't be surprised if this classic trick wasn't originally some vile Vim scheme designed to undermine Emacs users.

Ideal would be to use a keyboard and OS (MacBooks have both) where you can map Control to the keys immediately next to the spacebar. Using the strongest finger (thumb) instead of the weakest finger and the strongest movement (thumb curl) rather than the weakest is a true upgrade.


> With the placement of the Control key on most keyboards, your pinkie is doing a straight downwards motion

On every keyboard I have in my apartment, and every keyboard I've used for a long time, moving my left pinky straight down with my hands on the home row hits left shift and the windows key, in that order. Hitting caps lock with my left pinky is barely a movement at all.


Caps-lock is an abomination. I used to try remapping it to something useful, or disabling it in software with autohotkey or the like, but that was not sufficiently foolproof, so I've given up and just rip the keycap off my keyboards. Looks a little trashy, but it works fantastic.


I've been on vim for 8+ years. About 2 years ago I set up emacs because I wanted to start working in lisp land and use org mode. I couldn't use emacs without vim keybinds so I installed evil. I still use both editors, but I find emacs much easier to customize and the 'operating system' part of emacs makes it much easier to manage all the things I need to do. It sucks for big files, and there are some annoying quirks where repeating actions don't quite match vim's behavior, otherwise, I can hardly tell the difference, and when I do it is much easier to adjust to fit my needs. If you have your workflows set, then as with anything, there isn't much reason to switch, but emacs opens up a whole new world of possibilities in other ways.


I've been using spacemacs for a bit now, mainly because of org-mode. Most of the keybindings from Vim transfer to spacemacs, so it hasn't been very hard to learn, so for you I think it would be a nice middle ground, if you don't want to immediately go full Emacs.


Spacemacs unfortunately suffers from slow startup speed and an unnecessary "layers" abstraction.

I could never use Emacs without vim keybindings, but I don't need to install Spacemacs to get that. It's as easy as

    package-install evil
    package-install evil-commentary
    package-install evil-leader
    package-install evil-org
    package-install evil-surround


Have you tried doom-emacs? https://github.com/hlissner/doom-emacs

It has an insane startup speed! I tried once and it opened within a second. I'm not an evil user myself, so don't know about the vim compatibility.

If you are interested in making the startup faster, check https://github.com/hlissner/doom-emacs/wiki/FAQ#how-is-dooms... from the same author


Layers are not an abstraction, it's an organization-system for the configuration. Anyone who has more then a handful lines of configurations develops some system to avoid the infamous .emacs bankruptcy. And Spacemacs comes with dozen packages pre-configured, while offering the option to allow the user to choose from hundred more package-configurations.

Similar slow startup. Majority impact on spacemacs startup is the regular search for package updates. Without it the startup-time is relative tame, though there is of course some place for improvment if you aim for <1 sec-startups.


Your missing he part where you have to configure all those packages. Having new features already setup and integrated for me is a huge plus. It takes a lot of work to mimic something as well done as Spacemacs.


here's the total configuration required:

    (require 'evil)    
    (require 'evil-matchit)
    (require 'evil-surround)

    (evil-mode 1) 
    (global-evil-matchit-mode 1)
    (global-evil-surround-mode 1)
    (evil-commentary-mode)
judge for yourself whether this is too much work to paste into your .emacs


Spacemacs does a lot more than provide vim key bindings and modal editing.

The biggie to me is discoverability, with it's pneumonic key combos, and integrating with packages like helm.

Even with evil, the vim semantics are often violated in special buffers, making for a rather disjointed experience. Spacemacs also does a lot to smooth out a lot of those problems.


i switched for org mode. spacemacs keeps the vim keys and offers great discover of commands. initially learning to navigate files and buffers is awkward though


Definitely yes. Use evil if you have to. Then check out org-mode and magit and you'll never go back.


The only thing lacking in magit is the graph log renderer, which is just ASCII and can't deal with complicated graphs well


I wrote a graph renderer in emacs lisp a few years ago [0]. It never got included in magit because my code wasn't very good. I'm not sure it would have been better for complicated graphs than the standard git log one, though. Do you have an example of a complicated graph and how a better renderer deals with it?

[0] https://github.com/magit/magit/issues/495#issuecomment-17480...


well, gitk is really my high-bar standard. Of course it't not ascii, but in terms of the end-user-goal of clarity, it's the best. as for ascii renderers, tig doesn't do too badly.

your project looks very nice though, certainly an improvement over the default in magit.


Oh, I see, tig puts merges on one line. I used two for some reason. I think I was copying git graph too closely and missed that opportunity. It would be rather easy to modify my elisp version to be like tig.

When I was testing mine the worst case repository for me was git.git. It's essentially useless to view the graph in any ASCII viewer. It actually breaks tig right now on my box. gitk does much better because it breaks some of the long branches rather than piling them all up until it no longer fits on the screen.


Idk, Maybe your version is better than than tig, I was just comparing tig to 'git log'


Emacs can embed gtk widgets https://www.emacswiki.org/emacs/EmacsXWidgets


One step closer to Genera. :)


One thing I tried to make in Emacs was a window at the top which shows the lines that you do not see that are unindenting from the currently visible indentation. It would act almost like a header. Next, would be to display these vertically inside the space created by the indentation itself. I don't see how to pack more source code context information on a screen than that


did it work? can you share?

I imagine a sticky header for the last line of any text from another level, is that would you built?


edit: found a plugin that does it nicely for org-mode :) org-sticky-header




Guidelines | FAQ | Support | API | Security | Lists | Bookmarklet | Legal | Apply to YC | Contact

Search: