Most active commenters

    Emacs Lisp Elements

    (protesilaos.com)
    212 points robenkleene | 28 comments | | HN request time: 0.002s | source | bottom
    1. precompute ◴[] No.43667144[source]
    Great! This could serve as an easy introduction for users new to Elisp.
    2. mfld ◴[] No.43667283[source]
    Nice - I feel this introductory guide fills a gap. Also, I really like his video tutorials.
    3. algo_lover ◴[] No.43667300[source]
    One of the good things to happen in emacs was the inclusion of `seq.el`. It makes easy functional operation over sequences, so no longer need `dash.el` or `cl-lib.el`. (dash still has many more functions inspired by clojure which is awesome when you need them)

    But I still wish the emacs community could adopt a modern data structure library. It's difficult to consolidate usage of sequences (lists/vectors) with alists and plists. This would make it so much more accessible.

    replies(1): >>43668110 #
    4. ajross ◴[] No.43667357[source]
    Seems clear and useful. That said, there's nothing particularly bad or inaccessible about the actual Emacs Lisp manual: https://www.gnu.org/software/emacs/manual/html_mono/elisp.ht...

    Or the official tutorial: https://www.gnu.org/software/emacs/manual/html_mono/eintr.ht... (which to be clear I haven't read, but have heard nice things about).

    Of all the things for which emacs can be criticised, documentation rigor is really not one.

    replies(2): >>43667664 #>>43669427 #
    5. mijoharas ◴[] No.43667565[source]
    It's a shame it doesn't really go into keywords, or alists/plists. (Or different argument lists, he mentions `&rest` but there's optional, and more too iirc)
    6. tikhonj ◴[] No.43667636[source]
    I've had a great time using Emacs Lisp over the past 15 years: it's one of the easiest ways to quickly whip up personalized tools for my own use, and, at the same time, my code has been surprisingly resilient and stable over this time.

    And this is despite the fact that Emacs Lisp routinely flouts every single software engineering "best practice". The language is dynamically scoped by default! It simply doesn't have namespaces! Static types? Hah! (And I, an inveterate Haskeller, don't even miss them.) You can—and people routinely do—hook directly into all sorts of implementation details from other parts of the codebase.

    And yet it just works. And it works remarkably well.

    My theory: what matters isn't "best practices", it's have a coherent conceptual design and code that reflects that design. Emacs is designed around a small but expressive set of core concepts that it uses in a consistent manner. Text with properties, buffers, modes, commands, customization variables... Almost everything more complex in Emacs is structured out of these (+ a handful more), and, once you've internalized them, it's surprisingly easy to both learn new higher-level tools and to write your own.

    The design of both the user interface and the code directly reflect these concepts which gives us a naturally close connection between the UI and the code (it's almost trivial to jump from an interaction to the code that powers it), makes both UI and code units effortlessly composable and generally makes it easier to understand what's going on and how we can change it.

    replies(2): >>43667712 #>>43668618 #
    7. db48x ◴[] No.43667664[source]
    Agreed; Emacs is the gold standard for documentation. It comes with a reference manual (400k words), an Emacs Lisp reference (600k words), _and_ 64 other manuals for individual Emacs modes or features including one just for Calc mode (250k words), a manual just for Org mode (130k words), one for Gnus (180k words) etc. All told it adds up to about 2.6 million words of documentation.

    Still, another manual written from a different perspective probably won’t hurt anything.

    replies(1): >>43668275 #
    8. nothrabannosir ◴[] No.43667712[source]
    > My theory: what matters isn't "best practices", it's have a coherent conceptual design and code that reflects that design.

    Just because something has a >0 level of success doesn't mean there are no negatives. "Best practices don't matter because Emacs Lisp doesn't follow them and it just works" isn't a valid argument: it could very well be that Emacs (Lisp) would shine fifteen-fold brighter if it did also follow those practices. It just happens that having those elements you mentioned as positives are enough to keep the train going in spite of the shortcomings.

    I use Emacs and program in Emacs Lisp to scratch my itches, and I agree that there are elements that make it work and hey, I'm still here, but I will bet good money that a parallel universe with Emacs Lisp', Now With Namespaces would work even better.

    "Working" isn't binary.

    replies(2): >>43667940 #>>43668109 #
    9. sauercrowd ◴[] No.43667784[source]
    Prot - the author - is a pretty incredible guy. He maintains a bunch of nice Emacs packages and themes.

    But maybe even more remarkable: he got kicked out of his flat in Greece, couldn't afford a new place, bought a small plot of land in the mountains and started building a hut from materials he was able to afford or from things neighbours gave him. Really the bare minimum (he often sat in his hut with a jacket in winter cause it wasn't well isolated/heated)

    Absolutely inspiration, all documented on his YouTube channel https://youtube.com/@protesilaos?si=MnjV7MhKtsT5RDSM

    replies(4): >>43668135 #>>43668485 #>>43669003 #>>43669092 #
    10. NeutralForest ◴[] No.43667842[source]
    When Prot writes something I try to make place to read it. He's a very nice person and also inspiring, he's living following his values and is very insightful.
    11. tikhonj ◴[] No.43667940{3}[source]
    That's certainly true!

    But based on my holistic experience using Emacs—more than a binary "it works"—I'm convinced that the conceptual design carries most of the weight.

    Would namespaces, lexical scoping, etc be better? Almost definitely. But it would be a marginal improvement, a difference in degree not kind. Other "best practices" like more aggressive information hiding would go against Emacs's design and make it worse as a whole.

    Most "best practices" are neither necessary nor sufficient and, in most cases, not even particularly effective, even when they offer strict improvements over the status quo.

    replies(1): >>43668569 #
    12. teddyh ◴[] No.43668109{3}[source]
    > Emacs Lisp', Now With Namespaces

    Do you mean lexical binding, available as an option since 24.1?

    13. tom_ ◴[] No.43668110[source]
    Thanks for the tip. I'd managed to miss the addition of these. I had somehow noticed the addition of the newer string- functions though, and immediately found them a huge improvement over the mishmash of randomly-named crap that was there before, so I expect seq- to be similarly transformative.

    I immediately notice there's seq-filter, which can kill off one of my helper routines. And then (now I'm looking...) I've discovered this was always equivalent to cl-remove-if-not. But I never realised, because of the mystery meat naming conventions.

    14. hollerith ◴[] No.43668135[source]
    A video of the inside of the hut: https://www.youtube.com/watch?v=W2T_lihBs9I
    15. beepbooptheory ◴[] No.43668275{3}[source]
    The Gnus manual in particular has certain whimsical Pratchett-esque charm to it that I love so much.
    16. kleinishere ◴[] No.43668485[source]
    He also offers 20EUR/hr eMacs coaching. For those jumping in or graduating to a new level.

    https://protesilaos.com/coach/

    replies(1): >>43668761 #
    17. ◴[] No.43668544[source]
    18. TeMPOraL ◴[] No.43668569{4}[source]
    > Would namespaces, lexical scoping, etc be better? Almost definitely. But it would be a marginal improvement, a difference in degree not kind.

    That's the thing - it probably would not be.

    IMO, the key things that allow Emacs to succeed and last, while being somewhat unique in how it "routinely flouts every single software engineering "best practice"", are not merely conceptual, but cultural or even philosophical. The most fundamental of those, IMO, is that Emacs is ultimately owned by users, who are treated as intelligent partners in the relationship. Everything is designed with extensibility in mind. There's no hard boundary between "core developers", "third-party extension developers" and "end-users" - everyone can be any of them, including all three, at any time.

    Maximizing extensibility and interoperability, not demanding "users" to coordinate with "developers" and ask for permission, not chasing user growth (it's all Free Software), expecting that everyone is a responsible adult, encouraging users to make Emacs "their own" - all that leads to an approach that goes the opposite to standard software development practice, because the standard practice is built around entirely opposite assumptions.

    19. golly_ned ◴[] No.43668618[source]
    I’ve consistently failed to make writing elisp net positive for me for basically anything. I use it as a configuration language, and even then, for functions longer than a few lines, it’s still a lot of coding for very little benefit. I just can’t find things to improve in such a way that it’ll actually be worth writing elisp code for, especially compared to other tools (like a quick Python script or even a bash one-liner), or things within Emacs. What are the things you’ve written in elisp that have helped you?
    replies(1): >>43669716 #
    20. dima55 ◴[] No.43668761{3}[source]
    "emacs". It is called "emacs"
    replies(2): >>43668966 #>>43669289 #
    21. dan-g ◴[] No.43668966{4}[source]
    This happens with iOS autocorrect → https://en.wikipedia.org/wiki/EMac
    22. sakesun ◴[] No.43669003[source]
    A digital rishi.
    23. phforms ◴[] No.43669092[source]
    My Emacs wouldn’t be the same without Prots modus themes[1], which I found to be a great foundation to build my own theme on top of. I am grateful for all the work he did for the Emacs community.

    I also enjoy watching his videos where he talks about various philosophical topics from a very clear, pragmatic and down-to-earth perspective. My impression is that he is a really kind and humble person and that he lives by his philosophical insights, without bragging about his lifestyle or judging about how other people live their lifes.

    [1]: https://protesilaos.com/emacs/modus-themes

    24. tom_ ◴[] No.43669289{4}[source]
    Its page calls it Emacs: https://www.gnu.org/software/emacs/
    25. spudlyo ◴[] No.43669427[source]
    One reasons Prot himself was able to become a bonafide Emacs Guru in just a few years is because he's the kind of person who reads manuals. He speaks highly of the included docs, and often credits them for his knowledge.
    26. Rediscover ◴[] No.43669716{3}[source]
    > What are the things you’ve written in elisp that have helped you?

    Usually tools to alleviate working with dumbass web-based (supposedly needing the corporate-approved browser) stuff for $DAY-JOB.

    Oh, and an extension to allow emacs-w3m to handle lynx-style multibookmarks.

    replies(1): >>43669985 #
    27. prestonlibby ◴[] No.43669985{4}[source]
    > > What are the things you’ve written in elisp that have helped you? > > Usually tools to alleviate working with dumbass web-based (supposedly needing the corporate-approved browser) stuff for $DAY-JOB. > > Oh, and an extension to allow emacs-w3m to handle lynx-style multibookmarks.

    This sparks my interest as I am in the early days of both customizing Emacs and attempting to displace some of my browsing with it as well. Could you elaborate further on this multibookmarks concept and perhaps an example of one of those alleviations for working with web-based workflows?