How can I find out the name of the current buffer, window, or frame in Emacs?


If you need that in a script, evaluate:

(frame-parameter nil 'name)
  • This always returns "F1", no matter which buffer I am in. – Yazz.com Dec 2 '10 at 6:50
  • 1
    Strange, it works for me, it behaves exactly like (buffer-name) (+1 for that). – cYrus Dec 2 '10 at 14:40
  • I'm on GNU 23.2, It may be Emacsen version dependent whether frame-parameter works or not? – Yazz.com Dec 2 '10 at 15:36
  • Same version here: GNU Emacs 23.2.1 on Debian Linux. But (frame-parameter nil 'name) returns the name of the frame (the one you see in the task bar of your desktop environment, for example) that can be changed. For the buffer name, you should use (buffer-name). – cYrus Dec 2 '10 at 16:16

C-x C-b (list-buffers) will display a list of buffers. The current buffer has a . to the left of its name. I believe windows and frames do not have names, so there is nothing to find out there.


I have since found out that (buffer-name) from within an elisp script will return the name of the current buffer

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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