Discussion:
how to determine a buffer exist?
(too old to reply)
s***@gmail.com
17 years ago
Permalink
Hi,
In my .emacs file, I don't want *Messages* buffer appear every time I
open emacs, so I do

(kill-buffer "*Messages*")

This is fine when fire up emacs each time, but if I change the .emacs
file when I am editing, and try to M-x load-file -> .emacs, I will get
an error message saying no such buffer, since the buffer has been
killed.

So, I want this..
;;pseudocode
(if ("*Message*" exit) (kill-buffer "*Messages*"))

does anyone know how to do this?
Dmitry Dzhus
17 years ago
Permalink
Post by s***@gmail.com
;;pseudocode
(if ("*Message*" exit) (kill-buffer "*Messages*"))
does anyone know how to do this?
You should write this:

(if (get-buffer "*Messages*") (kill-buffer "*Messages*"))

Also consider a `messages-buffer-max-lines` option in case you wish to
switch off logging.
--
Happy Hacking.

Dmitry Dzhus
http://sphinx.net.ru

Loading...