Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

Buffer name variable

2 views
Skip to first unread message

Stefano

unread,
Apr 9, 2007, 3:43:50 PM4/9/07
to
Hi!
Is there a variable which holds the buffer name in GNU emacs? I know,
seems a terribly basic question... but I haven't been able to find it.
If there is one, I'd like to set it in the last lines of the file with
a ";; Local Variables"-like line. For now, I'm using the line "''
eval: (rename-buffer "foo")", but setting a variable would be more
"clean" and would avoid using "eval", which triggers a security alert
on most systems.
Thanks in advance.
Stefano

steve gonedes

unread,
Apr 25, 2021, 11:43:23 AM4/25/21
to
"Stefano" <stefanot...@gmail.com> writes:

> Hi!
> Is there a variable which holds the buffer name in GNU emacs?

There are some functions.

(current-buffer) => returns buffer device
(buffer-name) => the name of buffer as a string.
(buffer-name (current-buffer)) => the name of the current buffer.

and
buffer-file-name => the filename of current buffer.


If you really want to dig in; the emacs lisp manual has all this and
more under the buffer section in the info pages.


> I know,
> seems a terribly basic question... but I haven't been able to find it.
> If there is one, I'd like to set it in the last lines of the file with
> a ";; Local Variables"-like line. For now, I'm using the line "''
> eval: (rename-buffer "foo")", but setting a variable would be more
> "clean" and would avoid using "eval", which triggers a security alert
> on most systems.
> Thanks in advance.
> Stefano


have you tried get-buffer-create. There is a way to do what you want,
but it is some elisp code... I don't have it on this machine. let me
know I'll dig it up.

You could set a variable in your dot-emacs or use a hook. you do not
need to use eval in the local variables line. like i said it's on the
other machine...




0 new messages