Olav Fosse
2 days ago

I wrote this #elisp index generator a while ago. It's probably not the best way to do this, but there's something really neat about this little hack :p

2 days ago

I wrote about implementing a custom Tramp Method in Emacs.

#emacs #trampmode #elisp

3 days ago

Scraping the shell command output was the way to go - perhaps a little slower, but far more reliable.

So thankful for dash.el's --> macro. Makes me feel like I'm programming in bash again (in a good way). Must use it more. #elisp

Chris Siebenmann
4 days ago

Elisp problem: given a list l and a thing, create (l[1] thing "-or" l[2] thing "-or" ...). Emacs Lisp supports this for a simple string, but I wanted a list of strings.

Solution: (cdr (mapcan (lambda (x) ("-or" x thing)) l))

Don't try to be clever about when to put in the separator, just put in an extra one at the front and take it out at the end. (Dropping the first element of a list is easier than dropping the last one, and idiomatic in Lisp.)


Keynote: Delimited Continuations, Demystified by Alexis King | Lambda Da...
#scheme has been very prompt on adopting research work
Apparently it just didnt care about those adoptions being adopted
I mean the first thing I stumbled at after learning about curry Howard correspondence upon googling long long ago , was haskell monads and a terrible book #lyah , also i wasnt very serious about #learntocode thing , before i could figure out the economic incubation of my own labor , didnt start lime that.
That aside , despite trying #emacs in a whim to get away from browser in 2014 ( long after that ) first thing i stumbled at was #pubshell
again no #functionalprogramming , while ema s started to replace nearly everything i used till then , for a long time i saw #elisp as an easy to use config lang with a huge relative value preposition some functions, some calls and a compile env (based on gcc? ( as it was a program?) and a bit of #git ( again no orgit till then .. i was using org-publish though , but without #cd , again not into devops and yes broken org-emacs was an issue then, besides reproducility issues 1 and i present eve now, which helped in seeing #nix primarily as a config language with types, functions and options . It took me a year till i focused on creating my own serious symlinks with home.file . which took me to focus on flakes , modules and nix the language, till then it was more a config language for #nixos (I was not alone and nor fully wrong 2 which fascinated me with its build options also at that time i started to dabble into #ohw and was trying to free myself of commercial stuff since 2014
, then it was time to care about my representation on #socialmedia and integrity of the ab\use of my identity thanks to #cambridgeanalytica and #netflix , as it neared the real life experiences , thanks to the local socio economics and i saw nix as to #selfhost my infra. Dabbling into #typetheory #prooftheory bits of #haskell and #agda is still on ..lets see , where it all goes ( if anywhere at all).
Summary = i ve been more a plt guy than a pl guy per se.

Upside As, I write this I am working to get my emacs config to load some of my nix paths. :meta #introduction post, this also changes , how is see #nixpkgs sets
what next[experimental ] also try to to do it with dotfiles instead of dotconfig dir 3 , although i prefer home.file and I guess , I ll for my own reasons notes - * src = builtins.filterSource(path: type: type != "directory" || baseNameOf path != ".svn")./source-dir;Thus, the first argument e1 must be a predicate function that is called for each regular file, directory or symlink in the source tree e2. If the function returns true, the file is copied to the Nix store, otherwise it is omitted. The function is called with two arguments. The first is the full path of the file. The second is a string that identifies the type of the file, which is either "regular", "directory", "symlink" or "unknown" (for other kinds of files such as device nodes or fifos — but note that those cannot be copied to the Nix store, so if the predicate returns true for them, the copy will fail). If you exclude a directory, the entire corresponding subtree of e2 will be excluded.4When an interpolated string evaluates to a path, the path is first copied into the Nix store and the resulting string is the store path of the newly created store object.

For instance, evaluating "${./foo.txt}" will cause foo.txt in the current directory to be copied into the Nix store and result in the string "/nix/store/-foo.txt".

Note that the Nix language assumes that all input files will remain unchanged while evaluating a Nix expression. For example, assume you used a file path in an interpolated string during a nix repl session. Later in the same session, after having changed the file contents, evaluating the interpolated string with the file path again might not return a new store path, since Nix might not re-read the file contents. 5
criticism , feedback, hat tips welcome

Chris Siebenmann
2 weeks ago

I still don't understand what I'm doing with #elisp and macros, but this works to use a macro in a dolist:

(dolist (x list-of-things) (eval `(make-function-macro ,x)))

This also lets me byte-compile this file, while the version that uses a function-making function blows up. (Well, maybe it wouldn't if I used eval, but a direct call goes boom.)

This is with lexical binding for my .el file, which is not the default but is recommended.

Found in:
#emacs #emacslisp

Hélio Costa
2 weeks ago

Despite all that, next up: org-roam to change for good, this time from proprietary software to capture and organise my learnings and thoughts.

Later, I’ll post the final UI of my org-agenda - I liked the result - despite my #Elisp code still being a mess 😬

#orgmode #Emacs

2 weeks ago

What is the difference between a macro and a function?

#lisp #elisp

Chris Siebenmann
2 weeks ago

Current status: discovering that I actually want an Emacs elisp function that defines functions, not a macro that defines functions, because you cannot put macros in (dolist ...) and similar things, and of course I have a whole collection of functions to make and do things with, which I would like not to do by hand in lines after lines of elisp.

#emacs #emacslisp #elisp

Jez 📚
2 weeks ago

Not only is symex.el a useful package now I'm starting to remember its keybindings, but also it dares challenge the orthodoxy of calling a symbolic expression a "sexp" #emacs #elisp

2 weeks ago

@abcdw @goku12 For the past 20+ years I've maintained a bibliography (now at ~13 000 entries) using nothing but #Emacs #auctex & #bibtex mode on what's basically just a text (.bib) file. A short #elisp function also allows me to immediately open the document (say, pdf or djvu) corresponding to the entry, simply by entering F9 anywhere on the entry. This system has several advantages:

Emacs's regexp-search together with reftex-citation allow for incredibly powerful and flexible searches through the database
Any other interaction niceties more or less easily implementable through elisp code. For instance, I have a custom function that abbreviates a selected piece of text according to ISO 4 standard
It's basically just a text file, so in particular situations one can search or modify with any text editor
Automatically integrated with Emacs & AUCTeX when writing TeX files (in Emacs of course :) )

Of course it's a purely subjective choice, I'm not saying it's objectively better than any other. But worth considering and trying!

4 weeks ago

Revisited my torrent client project (using #elisp of course) and checked a bunch of torrent test files whether they can be processed without any extensions. To my surprise, the #Archlinux ISO torrent relies on the WebSeed extension, meaning that the torrent merely points at a list of HTTP/FTP URLs. So, unless another peer discovery mechanism like DHT is used, you'd be better off directly downloading from a HTTP/FTP mirror...

Andros Fenollosa
4 weeks ago

Prefiero testear con el REPL (si el lenguaje dispone), y realiza pruebas que se ejecuten en el pipeline. Considero que es un flujo like- TDD pero más dinámico.
#clojure #lisp #python #elisp

El navegador #Nyxt, para amantes de #Emacs #elisp, ya lo tienen disponible en #flathub.

Howard Abrams
1 month ago

@holgerschurig @nnungest Yeah that use of `rgrep` might be a good excuse for a small #elisp wrapper around `shell-command` (see the dwim project,

You might also take advantage of `ripgrep` or the silver searcher to make the results a little nicer.

Pavel Korytov :emacs:
2 months ago

@louis @galdor @a13cui To be honest, I'm skeptical about defining "superiority" on the set of isomorphic representations of reasonable code.

Of course, there's the space of bad code, e.g. long hard-to-understand poorly-documented (take any) functions, spaghetti code, WET, unreadable constructs such as nested ternaries, etc., etc... And better programmers sample that space less, but it's substantial, even in more minimal languages.

I.e. I doubt you can write "better" code, you can write the code that is less bad perhaps.

Conversely, I'm in love with #elisp, so I know I can write the same iteration construct with mapcar & co, cl-loop, threading macros, seq-*, dash functions, dolist, cl-do, cl-reduce & the rest of cl-*, hmm, what else... And I don't feel like I've grown much because of that 🙂

By the way, it's kinda the same with the aforementioned darkness.js, with its countless _.chain(libraries) besides the built-in loop expressions, .map / .reduce / whatever, .forEach... A Scheme with C syntax indeed.

And next to the above, there's the space of memory/compute inefficient code... From my work with students, I often find it harder to explain that this code is O(n!) while it should be O(n^2).

Besides, there are principles of single responsibility, separation of concerns, which are mostly language-independent. And architectural decisions.

...maybe I'll change something in this stream of consciousness if I manage to work in the field for the next 20 years 🤷

My blackjack.el test suite is still all green too.

#emacs #elisp

2 months ago

The small #elisp linked below demonstrates how to limit the completion of certain commands to a specific major mode in #emacs E.g. to make `ledger-occur` only available when you're in a buffer with ledger-mode.

Packages which define (interactive) commands may handle this themselves. See the MODES argument in the (interactive) help text. However, it's not a common practice, so you can achieve this from your own configuration with a few lines of elisp.

Why do this? I maintain my ledger in an #orgmode file with ledger source blocks in between. `ledger-occur` does not behave well when used in a different mode, and it resulted in data loss when executed in an Org buffer. To prevent accidentally selecting `ledger-occur` in other contexts, I put a restriction in place:

(my/restrict-symbol 'ledger-mode '(ledger-copy-transaction-at-point ledger-occur))

Now, I can't accidentally invoke `ledger-occur` or `ledger-copy-transaction-at-point` outside `ledger-mode`.

The restriction only affects the completion options in the command list invoked by M-x. Therefore, if you bind a restricted command to a key, it would still be invokable.

2 months ago

I've been doing some VS Code extension hacking recently (something cool coming soon, possibly!) and I have to say...

It is really a testament to LISP and to the Emacs contributors that docstrings are:
1. a core part of the language
2. are available on nearly every function and command

The best way to even find out if a command _exists_ in VS Code is to open the "keyboard shortcuts" window. And then just guess the args…

#vscode #vscodeExtension #emacs #elisp #lisp #docstring #documentation

In #commonlisp and #elisp , can you give me an example on when you would use the intern function?

As far as I understand, this is used to turn a string into it's corresponding keyword symbol. When is this useful?

2 months ago

#elisp question, following on from earlier:

How do you run an interactive shell command in #emacs --batch mode?

2 months ago

All of this bringeth me to this proposal: a single file #elisp library that provides the basic framework for abstracting these inconsistencies away.

2 problems:

  • what to name it
  • where should it go on the system?
2 months ago

#emacs #elisp #scripting
This is also a runtime challenge. When I invoke a long-running function in Emacs with an interactive progress display, it had better be asynchronous. But when you call async-shell-command from a noninteractive session, it just exits.

2 months ago

#emacs #elisp #scripting
... The next problem, which is async.
#elpaca is the best elisp package manager, and I want to be able to use it everywhere. But unlike straight, elpaca (seems to) requires an interactive session. Maybe there's a solution in having both straight.el and elpaca available and symlink some/all of their caches together? Then interactive operations can use elpaca but a script can fall back to straight without double downloads.

2 months ago

Whoops, I made a minor edit with thread editing on and thought I was making a new post afterwards. Suffice to say we can do something like

(if noninteractive
(call-interactively #'name--main)
(provide' name))

For the footer
#emacs #elisp #scripting
(numbers are hard)/?

Luis Felipe
2 months ago

How do you make paredit work when editing elisp in Org mode's code blocks?

#emacs #orgmode #paredit #scheme #elisp #lisp

James Endres Howell
3 months ago

My #ADHD secret to sticking with #Emacs and #elisp: I felt as though I was MAKING PROGRESS and LEARNING A TON at. EVERY. STEP.

Just start at “This, this right here, is good enough.” If you truly experience “Wow, today is better than yesterday!” almost every day, you can sustain the years of ‘effort’(?) it takes to reach goals that appear MAGICAL at the beginning.

This technique also works for switching to #Linux, #grapheneOS, #selfhosting, #degoogling, etc etc etc

James Endres Howell
3 months ago

@stranded_output DUDE! YES! THIS IS MY STRUGGLE!

THIS IS WHY #Emacs and #elisp were perfect for me! Ironic? I guess. I can definitely see how to many newcomers its learning curve resembles a sheer cliff.

But I just made a list of things I wanted, and worried away at the list one teeny tiny atomic feature at a time. It took years, but (HERE IS THE SECRET) I felt as though I was MAKING PROGRESS and LEARNING A TON at. EVERY. STEP.

I have quite a lot more followers than I did when I first wrote my introduction, so it’s only fair that I’m writing a new one, bump up the major version.

#introduction #intro #introductions

Hi! o/

I am Ștefan (ș as sh, I also accept Stephan or the equivalent in your language). I’m 21 years old, ♑, he/him, proud #leftist and soon to graduate CS @ UVABc. Sort of proudly living in #romania. My native language is Romanian, fairly proficient at English, slowly learning #finnish (and #italian).

Tried a lot of programming languages in my childhood up until now, a non-chronological list of ones that stuck with me for one reason or another being: VB6 (that’s what I started on at 8 years old), #pascal (+ #freepascal and #delphi), #perl (+ #raku), #tcl #tcltk, #lisp (usually #scheme, on a good day #elisp #emacslisp and #commonlisp), #elixir, #php, #forth, #lua, #oberon, #modula-2, #cpp #c++, #ocaml, #fsharp, #smalltalk (+ #squeak #pharo #self), #ada, #powershell, #dart, #matlab, #rlang, #zig, #nim, #cobol and #julia. I don’t claim full proficiency in all of these, but I’m familiar enough with these (+ some others not mentioned here) that I could get along just fine with 2 weeks at most of studying and looking through cookbooks and examples). I’m flexible in learning new languages and technologies if needed.

I also do #sudoku and #math for fun (especially functional equations and number theory problems, sometimes calculus and geometric algebra). I am interested in #linguists, #conlangs (#lojban and #esperanto) and #nlp, contemporary (post-‘45, usually post-‘89 for me) history, #balkan history, lower-level stuff (I like to learn about how tools around me work, I’m most interested in #compilers, #emulators and #microcontrollers), #typography and #latex, #linux + #bsd, #msdos, #amiga, #oberon, #plan9, #philosophy, #astronomy (especially in a worldbuilding context) and #philosophy, along with other less notable interests.

I engage in #politics relatively often irl, although I’m not inserting it in absolutely every scenario in my life. As I mentioned, I’m a #leftist and #progressive (or… um… #woke) (Nazis and fascists can have a merry fuck off, DNI with me). I am also a spiritual person, a #deist (if you really want to put it that way, an agnostic, although it’s not quite true) and I find #astrology and #tarot interesting (I’ll let you guess my moon and ascendant, let’s see how close you are).

With that being said, I hope I’m welcome here, you can pick your subset of things that interest you from this list, you have plenty of options. :P Quite a bit longer than last time, but oh well…

3 months ago

What options do I have for parsing #orgmode child headlines in #elisp?

Can find a million and one options for walking up the tree, but struggling to find how to walk down

#emacs :emacs:

James Endres Howell
3 months ago


✅ Learn enough #Emacs #lisp #emacslisp #elisp to write my own boutique major-mode and minor-modes

✅ Get back on Mastodon and post some rants

✅ Migrate to #GrapheneOS and take the final step out of Apple's #walledgarden

__ Set up one of the laptops with #Guix #GuixOS and see how free a nerd can breathe

3 months ago

Thanks to "An Introduction to Programming in Emacs Lisp", "Mastering Emacs" and similar resources, I feel comfortable in writing little snippets of #Elisp for convenient small functions in #Emacs (like this I understand how to write a minor/major mode. However, I am not able to write something like a game (snake, tetris) or an "application" using several windows to provide a UI (like Gnus' article/summary windows). Looking at the code of those packages feels like a big wall to me. Are there tutorials showing how to build these kinds of things, with step by step guidance?

I just discovered this novel #emacs #emacslisp #elisp feature:

As part of their definitions, functions can be declared as being pure and side-effect free. This shows up in *Help* buffers and is also used by the compiler for optimisation. These types of declarations are associated with the symbol as opposed to the function value(, just like #clojure metadata(

I know #dlang has a similar feature where functions can be marked as being pure (, but I haven't seen it anywhere else. I suppose #rust immutable references are kind of similar too, although that's stretching it.

Are there any there any other cool or novel features in elisp?

An Emacs frame with two windows. The upper window contains a buffer showing the definition of s-join and the lower window contains a *Help* buffer describing s-join.
3 months ago

This piece #elisp of makes #emacs execute certain code when opening a file with a particular name. This is useful for files that have no clear extension or mode setting.

I use it to enter `yaml-mode` whenever I open a .clang-format file (which I don't want to pollute with -*- magic).

The original code was inspired by this StackExchange post, but I found the implementation quite cumbersome so I rewrote it to make it more condense.

blake shaw
4 months ago

When @spritelyinst closes in on their work on #Guile's wasm compiler (maybe later this year?!), it'll certainly become the easiest way to target optimized #wasm. Tree-IL has gotta be the simplest intermediate language to compile to, and you get all the optimizations Guile offers for free.

Considering Robin Templeton, the author of Guile's #elisp compiler, is one of the engineers behind it, I can't help but speculate that this will put #emacs in the browser within reach. If I can handle my org-agenda online by 2025, I will cry.

It's called #Scheme because it allows just a few friends to plot a CONSpiracy to build amazing things.

@chris_spackman Yes, for sure. I was the same with #emacs--using the arrow keys, the delete key, etc. Then I learned a bunch of the readline() shortcuts and I use them all over the place.

For a while I dabbled with write #elisp for various helpers, but it isn't worth it when you sit at different computers logged in as different users all the time.

Multiple ramps to multiple plateaus.

4 months ago

(let ((host ""))
(open-network-stream host (current-buffer) host 443 :type 'tls)))
why does it hang? #elisp

cc @rougier

4 months ago

test toot from emacs
never use lambdas in the update-function because it causes trouble

Álvaro Ramírez
4 months ago

Sprinkling your code with logs for debugging

#swift #elisp #emacs

Demos inserting unique log lines in code for debugging
4 months ago

One #elisp tip for profiling non-interactively when using #emacs --batch:

(require 'profiler)
(profiler-start 'cpu)
;; ...
(let ((filename (format "%d.profile" (truncate (float-time)))))
(profiler-write-profile (profiler-cpu-profile) filename))

You can then use M-x profiler-find-profile on the file.

I've moved some of the request objects outside the drawing loop and resorted to reusing one object per type of request, then mutating the fields as necessary before sending the request. Now the performance hotspots left seem to be inside the data marshalling code. I can't do much about it unless I were to rewrite it to avoid creating/walking objects in the first place.

5 months ago

Using xcb.el I managed to recreate a X11 drawing demo with #elisp. This may or may not pave the way forward to faster graphics rendering programs in #Emacs...

A X11 window with a black border and an assortment of graphical primitives drawn on a white background.
Edward Hervey
5 months ago
Oh boy... the endeavours in improving my #emacs setup has brought me all the way down the rabbit hole.

Yup, learning #elisp . In hindsight, I should have done this ages ago. Previously I was just mimicking existing code for my init.el whereas now I'm actually writing it from scratch. It's really not that hard of a language to understand and learn. Makes you feel like a wizard when you can hook and extend your IDE and work environment with such ease.

But the most important part for me is that it's the first time I'm learning a new language and using all the assistance of a fully-fledged IDE from the beginning... it's amazing. Having docs, completion, repl, .... all within one environment is sooooo much of a productivity boost.

I barely scratched this when I started learning #rust a few years back. Had I started learning it with this environment I would have learnt (a bit) faster.

So yes, this is the confession of an old fart realizing late (but not too late) that fully-fledged IDE are the way to program (and debug, learn programming,...).

@daviwil Thank you for that very interesting stream today. It was great watching you do some deep dive into #Elisp data structures and functional libraries.

In my opinion #Emacs Lisp is a bright light in the otherwise dim #Lisp ecosystem when it comes to discoverability, documentation and user experience. 🚀

@hl @engtao you probably noticed the long list of links on the wiki page, for learning #elisp , but if I had to do it all over again, that might start with the Land of Lisp, and try to do the examples in #emacs itself; noticing the differences between common and #emacslisp.

8 months ago

@engtao Thanks. Are there any particular books, tutorials or other resources you've found good for learning #elisp ?

9 months ago

@hl I had an almost identical experience. Have been learning #elisp on and off for a while, for similar reasons. Good luck with the journey.

9 months ago

The `named-let` macro came in quite handy to solve #adventofcode day 6 in #elisp. It allows you to express your solution with a recursive call, while under the hood it translates to a loop. Which is, of course, also known as tail call optimization.

(spoiler alert in the link below if you're even slower than me going through the AoC)

David Wilson
9 months ago

🔴 On today's #SystemCrafters stream, we'll experiment with Emacs' built-in debuggers, `debug` and `edebug`.

Let's see if we can discover some good debugging strategies for when your configuration or a package you use starts to break!

Join us LIVE at 4PM UTC on YouTube or Twitch:


#emacs #elisp #gnu #linux #freesoftware

#EmacsTip: If you are writing #Emacs #Lisp macros, #Macrostep might be of interest. It allows to expand macros interactively.

#Emacs #EmacsLIsp #Elisp #Macro #MacroExpand

10 months ago

Thank you for accepting my application to join Fosstodon (whoever you are). I'm looking forward to participating. My interests are #emacs #elisp #orgmode #latex and FOSS projects, generally.

10 months ago

@cwebber I have been using #emacs as an editor for many years and very gradually picked up some #elisp from setting parameters in my config. In the last year or so I have also been learning #CommonLisp through #OrgMode babel because of an interest in reproducible research, and because the support for the language in Org babel was good. I had originally decided to use #python for these calculations in documents, but found myself using more and more lisp as time went by because it's convenient in that environment. Lisp is fun to learn, but not having a computer science background can make some of the ideas (lambda functions and macros, for example) difficult to understand. I enjoy reading here about what other people are doing.

10 months ago

@elb @cwebber i host a weekly radio show. I use #emacs / #elisp to generate all the playlist info, the scripts, and the newsletter from an M3U i generate.

10 months ago

@cwebber Yay! I got exposed to #lisp primarily through #clojure which then took me down the rabbit hole and led me to #Emacs, too.

I feel like most of my parentheses are in #elisp these days, but boy do I get excited about it! :)

@cwebber A long time ago, in a terminal far away, I was programming in vim when a friend recommended #emacs. I switched and never looked back.

My responsibilities at work outgrew my tooling, and I found #org-mode and began writing #elisp to help me out. It was awesome so I picked up #common-lisp (now my favorite).

Found #Guix; Nix ideas with Lisp? Yes.

Now I solve problems with various lisps while people tell me those problems can't be solved.

10 months ago

Quick tip: you can write standalone #Elisp scripts with the following header lines:

#!/usr/bin/env sh
":"; exec emacs --quick --script "$0" "$@" # -*- mode: emacs-lisp -*-

This is used by #DoomEmacs' helper scripts, but it's great whenever you need the convenience of a #ShellScript but the power of Lisp. It even supports Emacs' buffer-manipulation capabilities!

Do note that using `(message ...)` will print to stderr and cannot be used in pipes. Instead just return the values.

10 months ago
anybody know of a way to parse through a directory of #orgmode org files and get all the items not marked as complete? maybe #python or #elisp that I could run outside of #emacs ? I wrote a little bash script that does it using grep and sed but it's sooooo hacky.

Since I did the same on my old instance, thought I should have an intro here as well, it’s mostly stolen from there

[insert #introduction #intro #introductions since it seems those hashtags are popular or something]

My name is Ștefan (ș being sh or s if you’re English), 20 y.o., ♑, he/him, leftist and all that. I’m sadly living in Romania, I’m an undergrad in computer science and I’ve tried waaaay too many programming languages.

My usual speciality is programming, I prefer functional programming (and Lisps such as #scheme, #commonlisp and #elisp sometimes), math (mostly real analysis, calculus, number theory and geometric algebra).

I am also interested in #linguistics (and NLP), post-WWII history (especially post-‘89), #compilers and #emulators (and generally low-level stuff), #typography and #latex, #linux and #bsd (and #dos stuff) and #philosophy, #astronomy and #astrology (don’t @ me) among many other things. I hope I’ll be welcomed here!

Gabriele Bozzola
11 months ago

Hello! #introductions #introduction

I am finishing grad student in #numericalrelativity (#generalrelativity, #astrodon) at #UArizona. I study #blackholes and #gravitationalwaves. I work a lot with #HPC and #Python. I am strong advocate for #OpenSource and #OpenScience.

My computer boots directly into #Emacs. I am involved with #vterm and other #elisp packages.

I am a massive fan of #nationalparks and enjoy #hiking and #cycling. I like to read about #history.