0

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

3 Answers 3

3

If you need that in a script, evaluate:

(frame-parameter nil 'name)
4
  • This always returns "F1", no matter which buffer I am in.
    – yazz.com
    Dec 2, 2010 at 6:50
  • 1
    Strange, it works for me, it behaves exactly like (buffer-name) (+1 for that).
    – cYrus
    Dec 2, 2010 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, 2010 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, 2010 at 16:16
2

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.

2

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

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .