2

I want to make my ibuffer not to be pompted.

So it is my config for ibuffer

(setq ibuffer-expert t) ;; disable prompt when deleting modified buffer.
(add-hook 'ibuffer-hook (lambda ()
              (ibuffer-auto-mode 1) ;; keeps ibuffer list up to date
              (setq ibuffer-show-empty-filter-groups nil) ;; don't show empty group
              (ibuffer-vc-set-filter-groups-by-vc-root)
              (ibuffer-do-sort-by-recency)))

first line of it I setted ibuffer export to true. But I open ibuffer then I execute to kill modified buffer or special buffer like multi-term. It is still asked to prompt.

What is problem?

Drew
  • 75,699
  • 9
  • 109
  • 225
Jay Lee
  • 323
  • 2
  • 9

1 Answers1

2

I open ibuffer then I execute to kill modified buffer or special buffer like multi-term. It is still asked to prompt.

It is not ibuffer that is prompting you in these cases.

Your multi-term buffer will be running a process so, when ibuffer tries to kill that buffer, Emacs will ask if you are sure you want to kill the process.

Similarly, when ibuffer tries to kill a modified buffer which is visiting a file, Emacs will ask if you are sure you want to do that, as you will lose your modifications.


C-hf kill-buffer tells us:

The functions in ‘kill-buffer-query-functions’ are called with the buffer to be killed as the current buffer. If any of them returns nil, the buffer is not killed. The hook ‘kill-buffer-hook’ is run before the buffer is actually killed. The buffer being killed will be current while the hook is running. Functions called by any of these hooks are supposed to not change the current buffer.

C-hv kill-buffer-query-functions shows that it contains the function process-kill-buffer-query-function which will "Ask before killing a buffer that has a running process."

If you're really sure you want to, you can disable that with:

(remove-hook 'kill-buffer-query-functions 'process-kill-buffer-query-function)

Note that this doesn't only affect ibuffer. Anything that kills a buffer is affected.


To kill a modified file-visiting buffer without being prompted, you may need to write a kill-buffer-query-functions function which sets the buffer as un-modified. I wouldn't recommend doing this.

phils
  • 48,657
  • 3
  • 76
  • 115
  • 1
    but ibuffer-expert said that `If non-nil, Don't ask for confirmation of "dangerous" operations.` – Jay Lee Feb 14 '19 at 07:35
  • The meaning of `ibuffer-expert` is confined to ibuffer's *own* behaviours -- it doesn't mean that *other* parts of Emacs will stop prompting you. In your examples, `ibuffer` is not asking you to confirm anything. I can see why you interpreted the description the way you did, but I'm afraid it doesn't actually do what you thought it did. – phils Feb 14 '19 at 09:41
  • From what I can see, the "dangerous" ibuffer operations are: `ibuffer-do-shell-command-pipe-replace`, `ibuffer-do-revert`, `ibuffer-do-delete`, `ibuffer-do-kill-on-deletion-marks`. If you are not an expert, then ibuffer itself will ask you to confirm those operations. – phils Feb 14 '19 at 09:48