1

I would like to know how I can never again be prompted when I invoke the command

kill-this-buffer

with the words

Buffer <name> modified; kill anyway?

I would thus like to kill the buffer immediately without saving any changes made to the buffer and without having to say yes or no or even y or n. I understand changes will be lost.

Drew
  • 75,699
  • 9
  • 109
  • 225
Edman
  • 1,167
  • 7
  • 13
  • 1
    I cannot in good conscience recommend that you bypass that question: it has saved and will continue to save the hides of many Emacs users (from noobs to gurus, I imagine): it has certainly saved mine on multiple occasions. – NickD Dec 27 '22 at 16:44
  • It depends on the tasks one is performing from within Emacs. When sorting through large numbers of files, it is cumbersome. In other contexts it could be a necessary. In my opinion Emacs requires too many confirmations. – Edman Dec 27 '22 at 17:05

1 Answers1

2

From reviewing the implementation of kill-buffer, I see that the kill-buffer-query-functions hook gets called before the "Buffer modified" prompt is presented to the user. You might try resetting the buffer-modified-p flag using (not-modified) with something like the following:

(add-hook 'kill-buffer-query-functions
          (lambda () (not-modified) t))
ebpa
  • 7,319
  • 26
  • 53