2

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?

djechlin
  • 923
  • 8
  • 21

1 Answers1

7

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?.

Dan
  • 32,584
  • 6
  • 98
  • 168
  • 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