I really like the rlang functions to achieve this:
rlang
my_fun <- function(){ rlang::call_name(call = rlang::current_call()) } my_fun() #> [1] "my_fun"
Created on 2025-03-27 with reprex v2.1.1