I would like to have a yasnippet to evaluate infix math expression on the current line. E.g., If the line is 1 + 2 =
and I trigger yasnippet at the end of line, it will append the result at the end: 1 + 2 = 3
.
I found this snippet from https://www.reddit.com/r/emacs/comments/6u0gmx
$1 = ${1:$(calc-eval
(replace-regexp-in-string "p" "perm"
(replace-regexp-in-string "c" "choose"
yas-text)))}$0
But it's a real-time interactive snippet that I don't prefer.