How can I find out the name of the current buffer, window, or frame in Emacs?
3 Answers
If you need that in a script, evaluate:
(frame-parameter nil 'name)
-
-
1Strange, it works for me, it behaves exactly like
(buffer-name)
(+1 for that).– cYrusDec 2, 2010 at 14:40 -
I'm on GNU 23.2, It may be Emacsen version dependent whether frame-parameter works or not?– yazz.comDec 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)
.– cYrusDec 2, 2010 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