I’m a new emacs user and I’ve been using doom emacs for a while now and i’m willing to learn Elisp, but found out that it might not be as easy as it might seem at first, because as i found out, lisp is quite different from other programming languages that i’m used to, especially knowing that i’m not a programmer by any means and my programming knowledge is very little, not mentioning that elisp is pretty old so the learning resources might not be as much as other more popular programming languages
so my question is, Is it worth it?
like what is the level of mastery do i need to achieve to start implementing custom elisp in my configs to enhance my emacs experience?
and how exactly can i improve my emacs experience if i learned elisp?
in other words, how rewarding it would be
Lisp and Scheme are marvelous 60s-70s hippie acid-head languages. “Hey, let’s use a small set of primitives and treat code and data the same and we can run huge worlds with a tiny, recursive interpreter!”
By the time you get to Emacs though, many huge worlds have been built, and navigating the huge world(s) that small set of primitives has created can be…uh…daunting – both because of 1000s of people’s contributions and because of the weight of history (e.g. booleans are “predicates” – from calculus – thus all the “_p” names).
That said, at it’s core, it’s elegant and lovely.
It’s sort of a silly question.
To customise emacs beyond clicking around in ‘customise’ you need to write elisp. If you learn little elisp then you can only customise it using other people’s code, if you learn a lot of it then you can write an mua.
You decide where you want to be on that spectrum.
so my question is, Is it worth it?
It’s worth more than a bunch of other people’s opinions.
This has been removed, as it is not very civil; please attack ideas, not people.
Yes. It’s worth it.
If you’ve ever tweaked your Doom config, you’re already writing elisp. Going from setting options to writing new modes will certainly take time, but lisp is a language that builds on itself.
In fact, Emacs+elisp is one of the best systems for learning by doing. C-h f, C-h v, C-x C-e, etc will get you far. The built in tutorial is absolutely worth going thru, and understanding lisp will improve your understanding of other languages as well.
There is a buildin tutorial ? where can I find it , since I also would love to get started learning more elisp!
There’s a tutorial for using Emacs - the key combination to enter the tutorial is on the welcome screen (I think it’s “CTRL-h t” but I don’t have it in front of me). It doesn’t cover elisp.
There are two elisp manuals available via the info system (CTRL-h i), a reference manual and an introductory text. They’re also available in other formats and are online as well. The reference manual is kept current with every release. I’m not sure about the introductory text, but the core of elisp hasn’t changed (I think) since lexical scoping was made the default several years ago.
Edit: added availability of manuals in non-info formats.
If you prefer a more modern looking interface there is also https://emacsdocs.org/docs/elisp/Emacs-Lisp
Actually learning elips itself is the reward.
If you’re sold on sticking with Emacs, then learning elisp will unquestionably pay dividends, and the more you learn the more you’ll be able to do (but you don’t need to understand everything in order to do anything).
and how exactly can i improve my emacs experience if i learned elisp?
That’s the thing – it’s up to you. The ability to “scratch any itch” is what elisp give you. That doesn’t mean any given thing is easy to do (although it might be) but, to a significant extent, if you can identify a problem then implementing a solution is also a possibility.
Let me cite RMS to answer that:
The editor itself was written entirely in Lisp. Multics Emacs proved to be a great success—programming new editing commands was so convenient that even the secretaries in his office started learning how to use it. They used a manual someone had written which showed how to extend Emacs, but didn’t say it was a programming. So the secretaries, who believed they couldn’t do programming, weren’t scared off. They read the manual, discovered they could do useful things and they learned to program.
source: https://www.gnu.org/gnu/rms-lisp.html
Programming in elisp is fun, too. Since it’s (typical for Lisp!) interactive programming features.
Elisp isn’t just a programming language it’s an execution environment and it doesn’t make a lot of sense to consider them separately.
For example the largest abstraction in elisp is the buffer. A lot of core language features revolve around and are greatly modified by the buffer. For example variable bindings can typically be overrides in buffer-local variables.
Furthermore there’s a lot of editor specifics that are interesting. Text properties are the least of which. Buffer narrowing is another. But what about… fields? Judicious use of fields limits where you can type into a buffer. Consider the customize user interface for example.
Basically emacs is a complete tui development environment.
“i’m not a programmer by any means” what do you use Emacs for? (sincere question, I know non-programers use Emacs)
Lisp (and especially Emacs Lisp) isn’t harder than other languages. I’m not a professional programmer either, but I’ve dabbled in languages from BASIC to bash to PERL, JavaScript, and Python. In my experience, Elisp has been the easiest of all of them.
Once you wrap your head around how lists work in Lisp, it all comes together pretty quickly. And Emacs’s self-documenting nature makes learning it that much easier.
The syntax is more consistent than any other language I’ve come across. It’s lists all the way down.
Just do “C-h R eintro RET” and start learning. Do “M-x find-library RET” to read the code of your favorite package and figure out how it works.
It’s pretty tiny compared to a lot of languages considering that most of what you use it for is working with Emacs, which has a small number of intrinsic types like buffers, windows, frames, text properties etc.
Compared to being the kind of person who reads
use-package
like JSON and treats it like a declaration language, you will be light years ahead at configuration if you just know lists, quoting, alists, plists, and writing functions. Users who don’t go at least that far will be constantly shooting themselves in the foot and spending much more time with minor, novice level bugs that are completely obvious.Compared to being the kind of person who reads use-package like JSON and treats it like a declaration language, you will be light years ahead at configuration if you just know lists, quoting, alists, plists, and writing functions.
Hey,
use-package
user here. I switched from my half-baked NIH init framework with a bunch of functions and other stuff you’re talking about, and never looked back.My 1670kLoC config doesn’t contain any definitions and mostly declarative. If I need to
defun
something (so, there’s no package with similar functionality) - there’s definitely time to start another package. I don’t even need to publish it on MELPA, since installation from git sources hasn’t been an issue since Quelpa appeared (like 10 years ago).Users who don’t go at least that far will be constantly shooting themselves in the foot and spending much more time with minor, novice level bugs that are completely obvious.
Debugging
use-package
forms is very easy if you know about macro expansion.It’s pretty tiny compared to a lot of languages
Correction: It’s actually rather sprawling and one of the least “compact” languages. [1] Doesn’t mean we shouldn’t read and write it, though.
[1] See section 2, “Compactness and Orthogonality”, in Chapter 4 of The Art of Unix Programming, by Eric Raymond (2003).
Do you have a good resource for learning this?
I’m making what I believe to be a better one.
The elisp manual is not bad. Between shortdocs and that, using the scratch buffer or ielm, it’s pretty fast to get going. I would save an elisp buffer to a file at first. Scratch is ephemeral by default. Like anything, reinforcement and consistent effort go farther than having the perfect approach.
You need surprisingly little if you already have general lisp knowledge to actually be able to write your own configs. Hell, you don’t need any knowledge just work with it as if it’s some config file grammar. I started with doom and after a year or so took a step into vanilla Emacs. My Emacs config is exactly how I want it now. Don’t get me wrong it’s not life changing compared to Doom but if you have a weekend spare and you are feeling up the challenge, give it a shot.
When I want to add an automatic garage door, I don’t go on r/ElectricalEngineering and ask how rewarding learning EE can be. I decide wtf I want to have happen, then google accordingly.
This has been removed, as it is not very civil; please attack ideas, not people.
Is it just me or have there been a lot of posts lately from accounts with overall negative comment karma.
In this case, his negative comment karma comes from heavy involvement in subs regarding overseas affairs (i.e., opinions about current events in Israel). His question about learning elisp was genuine.
Not just you and it’s not just /r/emacs or /r/org-mode, I’ve seen them in other places as well. While the guy in /r/org-mode wasn’t one, most of them write so poorly that they must be ESL people and argue about minute things that well-adjusted (genuine?) people wouldn’t argue about.
The other thing I’m seeing is an increase in duplicated posts to multiple forums asking fragmentary, barely coherent questions. Writing this, I just had the obvious epiphany that my assumption–there’s a person at the other end–might be wrong.
Hm, yeah, imagine some kind of service that takes a question from a user and posts it on Reddit, then feeds the answers into its own ML model and gives something back to the user (with a significant delay, obviously, so maybe more for training purposes).
There was a post here within the past couple of months that, when I looked at its account history, seemed to be obviously some kind of bot, but its writing was coherent enough to seem authentic in isolation.
Seems like a dark time for the Web is coming. :/
In my experience, you don’t really need to know much elisp (if any) to be able to configure your editor unless you’re building your own plugin. Once you have a specific problem, you just Google and use Emacs internal docs.
That said, elisp has an interesting trait: variables are dynamic by default. It’s quite different from other languages so it may be amusing to learn more about (if you do find that interesting, check out PicoLisp)