Take the 2-minute tour ×
Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

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

share|improve this question

3 Answers 3

up vote 3 down vote accepted

If you need that in a script, evaluate:

(frame-parameter nil 'name)
share|improve this answer
    
This always returns "F1", no matter which buffer I am in. –  Zubair 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? –  Zubair 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

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

share|improve this answer

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.

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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