Unix & Linux Stack Exchange is a question and answer site for users of Linux, FreeBSD and other Un*x-like operating systems. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

When I run M-x kill-buffer for a buffer which was openend via gnuclient, I first get this prompt...

Kill buffer (default 'my-buffer-name'): 

Then I get a second prompt/message...

Buffer 'my-buffer-name' belongs to gnuserv client(s); kill anyway? (yes or no) 

How can I disable the second gnuserv/client message? (I don't need it).

share|improve this question
up vote 1 down vote accepted

The following script works for both with gnuclient or emacsclient, though its (original) docstring says, "Kill buffer, taking gnuclient into account." ... from emacswiki: KillKey

(defun my-kill ()
  "Kill buffer, taking gnuclient into account."
  (if (buffer-modified-p)
      (error "Buffer has unsaved changes")
    (if server-buffer-clients
      (kill-buffer (current-buffer)))))

The above addresses the question, as asked, but aside from that, I have worked around the issue by using emacs' built-in server and emacsclient (vs. gnuclient, as mentioned in the question).

With this new server/client combination, I can open files in emacs, from a bash shell, as if they were opened (visited) from within emacs itself.

In a launcher script, eg. named e, this basic command does the trick; no more annoying prompts when I kill the buffer...

It also has the added advantage of allowing features like restoring VisibleBookmarks, etc to function for that file/buffer.

emacsclient -e "(find-file \"$1\")" &>/dev/null

I think that something similar could be done with GNU server/client, but I quite like emacsclient, so I'll run with it.

share|improve this answer

Your Answer


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.