Questions tagged [kill-buffer]
47 questions
38
votes
6 answers
How to reopen just killed buffer, like C-S-t in Firefox Browser?
Sometimes I accidentally kill a buffer and want to reopen it, just like C-S-t to undo closed tab in Firefox, but there is no built-in command in Emacs, the defun undo-kill-buffer in http://www.emacswiki.org/RecentFiles :
(defun undo-kill-buffer…

CodyChan
- 2,599
- 1
- 19
- 33
19
votes
5 answers
Kill process buffer without confirmation?
I have C-x C-k bound to kill-this-buffer. But when I enter into a buffer which is running a process like Python or MySQL, if I do C-x C-k it asks
Buffer "*Python*" has a running process; kill it (y or n)?
How can I kill process buffers without…

Chillar Anand
- 4,042
- 1
- 23
- 52
8
votes
2 answers
Kill-buffer prompt with option to diff the changes
The save-some-buffers command prompts to save or ignore each modified file, and also provides an option to diff the modified file against the file it is visiting.
I'd like the same behavior from kill-buffer or kill-this-buffer. If the buffer is…

glucas
- 20,175
- 1
- 51
- 83
7
votes
3 answers
How can I kill buffers based on mode?
I know about kill-matching-buffers but that searches buffer names, I want instead to search buffer modes. For example, I might want to kill all buffers that have "notmuch-" or "[Notmuch]" as substrings in the mode column in the *Buffer List*.

Sandra
- 194
- 1
- 7
6
votes
1 answer
How to automatically kill a shell buffer when the shell process exits
In shell-mode when you exit the shell process (e.g. by typing exit) the buffer still hangs around (with the message "Process shell<1> finished").
How can I automatically kill the shell buffer when the shell process exits?
(1) Is there a package…

halloleo
- 1,215
- 9
- 23
5
votes
2 answers
How do i close the *compilation* buffer without visitinig its window?
I like to work with a vertically split frame with code in both windows. When i call M-x compile the *compilation* buffer shows in the other window (wich is fine as M-g n would show problematic code in the current window while i can still see the…

Mario Gil
- 249
- 1
- 10
4
votes
1 answer
server-edit vs kill-buffer to kill an emacsclient buffer
I use emacsclient to open files from my webrowser (pdfs, text files etc). When I'm done with the file, I know I need to close it with C-x # (server-edit); if I use C-x k (kill-buffer) I get a warning that the buffer still has a client. This happens…

Tyler
- 21,719
- 1
- 52
- 92
3
votes
3 answers
Rename scratch buffer and ask confirmation to kill non-file buffers created by user
I tend to use often non-file buffers kinda like post-it-notes and it is way too easy to kill them inadvertently, as there is no confirmation to kill. Even if you enforce the habit of writing only in file buffers (subject to confirmation), you might…

antonio
- 1,762
- 12
- 24
3
votes
2 answers
Delete word backward without coping it to buffer
(I feel like there should be duplicate for this, but I could not find it. Pardon me.)
Question
How can I delete word backwards without it being copied to buffer?
Explanation
I developed a habit of coping text from somewhere, coming to emacs, using…
3
votes
3 answers
Dired-like browser for buffers?
I use Spacemacs, and I often use SPC b b to list buffers so that I can kill the buffers I no longer want. Unfortunately, this process takes a while because I have to repeatedly press SPC b b, navigate to a buffer I want to kill, open it, and then…

sid-kap
- 544
- 1
- 6
- 13
3
votes
1 answer
How to kill all duplicates of the current frame
The command make-frame creates a duplicate frame of a given frame.
Is there a reverse command which kills all duplicates (if any) of the current frame?
More precisely assume that the current frame contains a single visible window corresponding to a…

Name
- 7,689
- 4
- 38
- 84
2
votes
1 answer
How can I delete all the gdb related windows/buffers after `q` in gdb CLI window
I use (setq gdb-many-windows t) and (setq gdb-show-main t) configurations in my init.el, so after executing M-x gdb, there will be six windows in the frame, after typing q in the main gdb cli window to finish debugging, how can I quit/delete all the…

CodyChan
- 2,599
- 1
- 19
- 33
2
votes
1 answer
force kill a buffer?
I have a buffer (belonging to ein mode that got into a bad state) that throws an elisp error every time I try to kill it (using ibuffer, M-x kill-this-buffer, etc.)
Backtrace suggests that the buffer is trying to run some elisp that is failing. Is…

Leo Alekseyev
- 177
- 5
2
votes
3 answers
Killing current buffer reliably
I try to add a nicer key binding to kill the current buffer.
An obvious solution is to use kill-this-buffer, but often it does not work, or e.g. does not work the first time. The key binding for it is definitely not overridden by the buffers keymap,…

9000
- 497
- 2
- 15
2
votes
2 answers
How select and kill desire many buffers in ido mode?
Emacs 26.1. ido, smex
If I want to kill one buffer I use command C-x k
Here result:
As result I can kill ONE desire buffer.
But suppose I need to kill the next buffers:
build.gradle, approfile.json, cascade.update.txt
How I can do this quickly?

a_subscriber
- 3,854
- 1
- 17
- 47