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