Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to Kill buffer in emacs without answering confirmation?

Tags:

emacs

How to kill the buffer in emacs without being questioned.

like image 400
Talespin_Kit Avatar asked Jun 24 '11 11:06

Talespin_Kit


People also ask

How do I close all buffers in Emacs?

M-x kill-matching-buffers. Offer to kill all buffers matching a regular expression. C-x k ( kill-buffer ) kills one buffer, whose name you specify in the minibuffer. The default, used if you type just RET in the minibuffer, is to kill the current buffer.

How do I stop a process in Emacs?

More generally: You can use M-: (kill-process PROCESS) RET , where PROCESS "may be a process, a buffer, or the name of a process or buffer", with those names being as they appear in the output of list-processes .

How do I kill a program in Emacs?

If you started Emacs from a terminal, the parent process normally resumes control. The low-level primitive for killing Emacs is kill-emacs . This command calls the hook kill-emacs-hook , then exits the Emacs process and kills it.

How do I stop Emacs shell?

Kill Emacs ( save-buffers-kill-terminal ). On a text terminal, suspend Emacs; on a graphical display, iconify (or “minimize”) the selected frame ( suspend-frame ). Killing Emacs means terminating the Emacs program. To do this, type C-x C-c ( save-buffers-kill-terminal ).


2 Answers

This will kill the current visible buffer without confirmation unless the buffer has been modified. In this last case, you have to answer y/n.

(global-set-key [(control x) (k)] 'kill-this-buffer) 
like image 164
xevincent Avatar answered Oct 12 '22 06:10

xevincent


I use this

(defun volatile-kill-buffer ()    "Kill current buffer unconditionally."    (interactive)    (let ((buffer-modified-p nil))      (kill-buffer (current-buffer))))  (global-set-key (kbd "C-x k") 'volatile-kill-buffer)     ;; Unconditionally kill unmodified buffers. 

It will kill the buffer unless it's modified.

like image 35
Noufal Ibrahim Avatar answered Oct 12 '22 07:10

Noufal Ibrahim