Comments (6)
You want a command to kill just buffers with a particular major mode or what?
from crux.
Let me explain it with one example.
Consider that your current file is main.cpp
and you have a total of 6 buffers open:
mean.cpp, header.h, src, project, *scratch*, *Messsages*
If you call crux-kill-other-buffers
only header.h
will be killed.
I think it is also good idea to kill src
and project
which are dired buffers.
One possible solution is like you said, considering the setup of a particular major mode in crux-kill-other-buffers
from crux.
I also need crux command. something like crux-kill-other-dirs
from crux.
any updates regarding this feature request ?
from crux.
For now I can use
-
list buffer from helm
-
select all buffer
-
delete
-
C-x b
-
C-u C-SPACE
-
M-S-D
from crux.
@mambolevis maybe you need this
(defun kill-other-buffers ()
"Kill all other buffers."
(interactive)
(mapc 'kill-buffer (delq (current-buffer) (buffer-list))))
Taken from Kill Other Buffers
But it will kill everything. crux-kill-other-buffers doesn't kill everything. Because it use (seq-filter #'buffer-file-name (buffer-list))
which will only return 'visited-buffer'. So that the dired buffer doesn't get kill.
The above code will kill everything. Because it just kill whatever (buffer-list)
return. I come with my own solution:
(require 'cl)
;;;###autoload
(defun noprompt-kill-buffers ()
"Kill buffers matching REGEXP without asking for confirmation."
(interactive)
(flet ((kill-buffer-ask (buffer) (kill-buffer buffer)))
(kill-matching-buffers "^[^\*]"))) ;;all buffers that doesn't start with *
I think I can improve the regex value to make it more robust.
Update:
Fresh new version :)
;;;###autoload
(defun aza-kill-other-buffers ()
"Kill all buffers but current buffer and special buffers"
(interactive)
(dolist (buffer (delq (current-buffer) (buffer-list)))
(let ((name (buffer-name buffer)))
(when (string-match "^[^\*]" name)
(funcall 'kill-buffer buffer)))))
from crux.
Related Issues (20)
- crux-reopen-as-root interactive? HOT 1
- crux-move-beginning-of-line in ansi-term HOT 1
- Crux fails wiith "crux-open-with: Wrong type argument: stringp, nil" HOT 3
- write-as or "clone file" HOT 2
- crux-sudo-edit broken on emacs 27 HOT 4
- Support using non-ansi-term commands for crux-visit-term-buffer HOT 1
- Emacs shift-selection with crux-move-beginning-of-line
- crux-kill-other-buffers and special buffers HOT 1
- Cut New Release? HOT 2
- `crux-duplicate<-and-comment>-current-line-or-region` using regions blends lines HOT 2
- Move to line begin is broken. HOT 1
- Refine the keybinding advice in README.md.
- [Feature Request] Add move-line-up/down feature. HOT 1
- Get "The mark is not set now, so there is no region" when the first time open a buffer after latest restart use emacs daemon.
- [Feature Request] Add mark-lines' like feature.
- How to open files in full windows
- crux-smart-open-line-above: unexpected behavior with orgmode links
- crux-rename-file-and-buffer: move file into a different directory, without changing the filename
- crux-smart-kill-line ignores visual-line-mode HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from crux.