News for hackers. Stuff that matters.
Re:Onboarding to Elixir by ashton314 on Tuesday June 22, 2021 @03:05PM (#27595760)
Oh that's lovely! I'm an Emacs user, and I've got two yasnippets that do roughly the same thing:

https://gist.github.com/ashton314/f0a90a46e39b103635f2be8d8e...

The second one adds a pipe in front, which is super handy. Yours gives me some ideas though…

Re:Onboarding to Elixir by bostonvaulter2 on Tuesday June 22, 2021 @03:51PM (#27596324)
Do you know if you can insert the current line number with yasnippet? I have two snippets that look almost identical to yours, although my non-pipe version leaves the cursor at the beginning of the label since I've found that I often want to customize the label because I may be inspecting similar variables at different points in the code.

Ah, figured it out. It's very powerful to be able to call elisp inside snippets. Here's my new Labeled Inspect snippet:

    # -*- mode: snippet -*-
    # name: Labeled Inspect
    # key: lin
    # --
    IO.inspect($1, label: "$2$1 (`(buffer-name)`:`(line-number-at-pos))`")
and a piped version:

    # -*- mode: snippet -*-
    # name: Piped Inspect
    # key: pin
    # --
    |> IO.inspect(label: "$2$1 (`(buffer-name)`:`(line-number-at-pos))`")
Re:Onboarding to Elixir by ashton314 on Tuesday June 22, 2021 @04:46PM (#27596967)
Excellent! I'm going to have to extend mine. Emacs ftw