F.el: Modern API for working with files and directories in Emacs
github.com
github.com
Also note that (besides dash), emacs-devel decided against adding any of these packages to the ELPAs. This has made it harder to add a number of packages to NonGNU ELPA, but has been a good excuse to get rid of the dependencies. If anyone is looking for some good Elisp exercise consider sending a patch to replace f/s/... with built-in functionality.
In case dash/f/s/... provide functionality that is not available on older releases of Emacs that one still intends to support, consider using compat (https://elpa.gnu.org/packages/compat.html), a library that I have been developing that attempts to backport recent developments for older releases.
I like dash because it gives me the convenience of threading macros and anaphoric functions. Are there options for those in compat/emacs standard?
Threading macros and stuff like if-let & co. have been available for a while and are backported by compat.
I have never seen an example of if-let that made me understand it, but I see thread-first and thread-last, those may be useful.
Thanks!
They are often useful when you have a computation that might fail at any step, sort of like with Maybe monads in Haskell. Eg. if I want to retrive a password from auth-source, it might be that no entry exists, or that the entry has no password entry. In that case I do:
(if-let* ((auth (auth-source-search :host "domain.org"
:create t))
(func (plist-get (car auth) :secret))
(pass (funcall func)))
(use-to-login-to-some-service pass)
(user-error "Cannot find password"))I looked for anaphoric functions elisp on both DDD and Google. I believe that DDD uses Bing so TL;DR: Bing is not good at searching stuff, only basic queries. After maybe a couple of years of DDD I intuitively knew that I would have had to ask that question to Google.
NonGNU ELPA was created so that they can alias these packages to something else, and keep using them as dependencies, without giving up the prefixes f-* and s-*.
Emacs 28 adds a builtin Elisp cheat sheet command that collates a lot of Emacs's elisp functions into neat categories along with examples and hyperlinks to the manual. So, if you don't want a third-party library like f, dash, or s, you can give it a try first:
I wrote about it here:
https://www.masteringemacs.org/article/emacs-builtin-elisp-c...
In f.el and so on, the functions are consistently named and prefixed with `f-'; this is indeed what makes it modern.
Faux-namespacing by convention looks appealing on first glance/in isolation, but I think it falls apart in the context of the overall emacs package ecosystem.