plexus / chemacs2

Emacs version switcher, improved
779 stars 47 forks source link

Remove arguments from the variable after handling them #50

Closed porras closed 1 year ago

porras commented 1 year ago

Fixes #49.

Feel free to give any kind of refactoring instructions, my Emacs Lisp is almost nonexistent and in any case, probably not-idiomatic.

I tried to keep it as closest as the original implementation as possible, keeping the recursive and functional algorithm, and simply adding the side-effect before returning (and implementing it in a separate function). I just needed to add an argument to the recursive function to keep track of the position in the list.

I think that since we're removing the arguments from the variable, the 'command-switch-alist part is no longer neccessary, but I may be wrong.

plexus commented 1 year ago

Looks good at first glance. This has been very much a "wisdom of the crowd" type of project, so I'll merge this and we'll see if anyone thinks they can further improve it. Thanks a lot for the contribution!