This question already has an answer here:

When trying to run it I get

M-x buffer-file-name [No match]

But it has a function help entry via C-h f and I can evaluate it with M-: buffer-file-name. So why isn't it accessible via M-x?

marked as duplicate by Drew, Community Mar 23 '15 at 17:05

This question has been asked before and already has an answer. If those answers do not fully address your question, please ask a new question.


buffer-file-name is a function, but not an interactive command. M-x calls execute-extended-command, so can't be used on non-command functions.

For more information, see What is the difference between a function and a command?.

  • 3
    However it's worth mentioning you can run M-: (eval-expression) and evaluate "(buffer-file-name)" in the mini-buffer or in ielm. – stsquad Mar 23 '15 at 15:37

Not the answer you're looking for? Browse other questions tagged or ask your own question.