[[!sidebar content=""]] [[!meta title="Bidirectional links with eev"]] [[!meta copyright="Copyright © 2022 Eduardo Ochs"]] [[!inline pages="internal(2022/info/eev-nav)" raw="yes"]] # Bidirectional links with eev Eduardo Ochs [[!inline pages="internal(2022/info/eev-before)" raw="yes"]] Consider the two sexps below: (code-c-d "foobar" "/tmp/foo/bar/" :anchor) (code-c-d "fb" "/tmp/foo/bar/" :anchor) Each one of them defines several "short hyperlink" functions. After running them the three sexps below are roughly equivalent: (find-file "/tmp/foo/bar/plic.txt") (find-foobarfile "plic.txt") (find-fbfile "plic.txt") The "`code-c-d`"s above also define functions with even shorter names – `find-foobar` and `find-fb` - that point to "anchors" in files in the directory `/tmp/foo/bar/`. The three sexps below are roughly equivalent - (find-fline "/tmp/foo/bar/plic.txt" "«bletch»") (find-foobar "plic.txt" "bletch") (find-fb "plic.txt" "bletch") Until feb/2022 the only way that I had to produce these hyperlinks to anchors quickly required a LOT of muscle memory… I had to type this, M-1 M-h M-w M-h M-h 9* M-h M-2 M-h M-y M-h M-- M-h M-w M-k where the number of "``"s depended on whether I preferred `find-foobar` of `find-fb` - i.e., of on what is my preferred "code" for the "directory" `/tmp/foo/bar/`; either "`foobar`" or "`fb`". In this presentation I will show a much better way to generate short hyperlinks to anchors and push these short hyperlinks to the kill ring, and how I use that to create bidirectional hyperlinks between my notes on a language $LANGUAGE and programs written in that language. For more info see [this page](http://angg.twu.net/emacsconf2022-kla.html). # Discussion - Q: Can you say why you like all your links to be elisp expressions rather than something more textual? Is it just so you can always evaluate the expressions? - A: rswgnu5: it is quicker to create hyperlinks that don't have titles, and many years ago I had some problems when I gave titles that were not very good, and I ended up with links that didn't do what I expected, so I sort of stopped trusting links whose actions are hidden and only their titles are shown. also, I am trying to write code in which all parts are easy to understand. - Q: I am fond of and inspired by your idea of Lisp Markup & Interfaces. Have you thought of other Lisp Markup uses than Links? How do you think of incorporating tree-sitter? If that makes sense to you or at all. - A: can you explain your idea? I haven't had time to play with tree-sitter yet, but my holidays will start in a few weeks... I sometimes get stuck trying to understand the inner details of things whose inner details shouldn't be relevant... I had this problem with both Org and Hyperbole several times, and I guess that I will have it with tree-sitter too... - edrx: I don't have a concrete idea. I just have been thinking of the intersection of Markup, minimalist Textinterfaces and little Languages | language oriented programming for a while. Eg Lisp is a nice List/ tree data syntax. You use it for links. Do you have other markup like uses for? And speaking of tree data, tree-sitter is a tool to incrementally & robust build a tree from a flat text buffer. - do you know this? https://github.com/mmontone/emacs-inspector - Bi-directional links is a good idea. - I look forward to trying it out and seeing how it feels. It certainly looked cool! - awesome! btw edrx i'd really enjoyed the last eev workshop, would be totally down to attend another one later too - An interesting link type to add would be org id for org roam or denote id link types. - I've been trying to use eev to explore parts of Emacs that I don't understand... a basic example is M-x list-packages - Something to love about org mode, hyperbole, and eev is how they push the idea of links further [[!inline pages="internal(2022/info/eev-after)" raw="yes"]] [[!inline pages="internal(2022/info/eev-nav)" raw="yes"]] [[!taglink CategoryEEV]]