Emacs Challenge?

Some of the most popular posts here at Irreal are those in which I attempt bring the power of Emacs to bear on VimGolf problems. I like those posts too because I always learn some new tricks both by working on the problem myself and from the (usually better) solutions that readers contribute. Commenters on other blogs have lamented that there's no EmacsGolf to challenge and entertain users of the one true editor. I've been wondering if there's really any interest in that.

To me the value of such a site would be the opportunity to try some challenges working the way the typical Emacs user works and thus learn new techniques both self-discovered and from others. That means that the rules should be a bit different from VimGolf. Here's some ideas off the top of my head

  • Any ELPA package from the standard sites could be used because, after all, that's how we actually do our work.
  • External tools accessed through mechanisms such as 【Ctrl+u Meta+|】 are allowed for the same reason.
  • Solutions would be held for a week, say, and then posted all at once.
  • Maybe favor real-world problems so that the solutions are more generally applicable.

Is there any interest in such a thing? If so, we can start off easy by posting the challenges and solutions here at Irreal. If there's enough participation, it would probably be worth moving it to its own site. I am definitely not a front-end person so if I do all the heavy lifting, even the new site would be WordPress (or something) based. If someone with the requisite skills wants to get involved we could make it more like the VimGolf site or whatever seems best.

If you would be interested in this leave a comment. Feel free to suggest additional or alternative rules. If enough people respond positively, I'll make up some challenges (and solicit them from readers) and start posting them here at Irreal. If we get enough traction, I'll mount a separate site.

I thought about calling this thing EmacsGolf or something similar but that seems a bit derivative so I'm thinking along the lines of The Emacs Challenge or something like that. Suggestions welcome.

Update: 【Ctrl+|】 → 【Meta+|

This entry was posted in Blogging and tagged . Bookmark the permalink.
  • yves


    I think you meant 【Ctrl+u Meta+|】instead of 【Ctrl+u Ctrl+|】.

    By the way. I would be interested into such website. As a side note, since I am quite a beginner concerning Emacs shortcuts, I would use it as source ideas to implement little Emacs lisp scripts and thus learning the Emacs Framework. I've implemented your last post (Enumerate Words) that way. I would not think about calling external command line (sort -u), instead I wanted to implement a full Emacs Lisp solution (in order to learn).

    Great idea.

    • jcs

      Yes. Fixed. Thanks.

  • Hi,

    I think Yves is quite right. I'm rather more of Emacs beginner - I've been using Emacs for only about 12 years;) - but I'd guess that while "the Vim way" might be "do it in as few keystrokes as possible", the Emacs way would be more of "if it is to be done more than twice, write an Elisp function to do that". Obviously, number of keystrokes is an objective measure (or kind of), while reusability is not (but if someone insists, we could count the number of function/macro calls in the Elisp routine).

    After all, this is a question of the goal: do we want to have fun while learning something interesting, or do we want to have fun while learning something useful. If the latter, we should probably aim at something like "smart usage of stock Emacs functions, ELPA packages and Elisp hacking (maybe for beginners, maybe not)".

  • David Bjergaard

    I like the idea, I would propose two "Leagues:"
    1. The vimGolf-esque:
    Get it done in as few keystrokes/commands as possible.
    Multiple sub-divisions:
    a. would use only stock-emacs
    b. any outside package/library goes
    2. An elisp league:
    Solve the problem using elisp, either fully, or by writing a
    helper function to tackle the editing paradigm.
    Again Multiple sub-divisions:
    a. would use only stock-elisp + (require 'cl)
    b. any outside package/library goes
    I don't know how you would score entries... in the style of vimgolf,
    the metric is objective if you follow agreed-upon rules, the
    difficulty with emacs is that it is intrinsically is open-ended.

  • Francesco


    thanks for the suggestion ; I would be interested for sure, especially if problems are real-world-like.

    Like previous commenters, I'm not sure which metric scores should be based on (or if there should be scores at all)

  • I will take this opportunity to hock my [VimGolf Minor Mode][1] as well. I talked pretty extensively with Ilya about opening up real entry possibilities on VimGolf proper and he was always very amenable but we never really fleshed it out further. The question is really who would have the time to hash out the fairly intractable cultural differences between the vim and emacs communities, rather than any technical barriers.

    [1]: http://marmalade-repo.org/packages/vimgolf

    • jcs

      That would be great but, as you say, it's hard to see how it would work. I've used both Vim and Emacs extensively and can testify that the cultures are very different. An Emacs user in real conditions would think you were crazy if you said, "You can't use extensions or external programs," whereas a Vim user probably wouldn't mind all that much. OTOH, I'd love to be able to leverage your VimGolf minor mode. Do you have any ideas on how we could make this work? I think it would be a good long term solution if we could come up with a workable plan.

      • With very little work we could make the challenge download generic rather than specific to VimGolf at which point any site could in theory host a challenge. To host, all you would have to do would be to maybe have a certain id around the `pre`'d input and `pre`'d output and then VimGolf would just parse it out and stick it into the competition buffers. The submit feature was never turned on because we could never settle whether or not the emacs community would be able to swallow the idea of using only the baseline.

        • jcs

          Great idea. If the notion of an EmacsGolf gets off the ground, it would definitely be worth tweaking your VimGolf mode. If that happens, I'll email you for details.