|
From: | Andreas Röhler |
Subject: | Re: kill-buffer without asking for confirmation |
Date: | Mon, 28 Nov 2022 18:27:42 +0100 |
User-agent: | Mozilla/5.0 (X11; Linux x86_64; rv:102.0) Gecko/20100101 Thunderbird/102.4.2 |
(defun kill-buffer-unconditional (&optional buffer) "Kill buffer unconditional, kill buffer-process if existing. Sometimes being queried sucks..." (interactive (list (current-buffer))) (let ((buffer (or (and (bufferp buffer) buffer) (get-buffer (current-buffer)))) proc kill-buffer-query-functions) (if (buffer-live-p buffer) (progn (setq proc (get-buffer-process buffer)) (and proc (kill-process proc)) (set-buffer buffer) (set-buffer-modified-p 'nil) (kill-buffer (current-buffer))) (message "Can't see a buffer %s" buffer)))) Am 28.11.22 um 09:40 schrieb Peter Münster:
Hi, When a buffer is modified, kill-buffer normally asks for confirmation ("Buffer modified; kill anyway?"). How can I avoid this confirmation please? This worked with version 28.X: (defun some-function-called-by-timer () "Send email to user." (compose-mail user-mail-address "bla") (insert "bla") (funcall send-mail-function) (cl-letf (((symbol-function 'yes-or-no-p) (lambda (_) t))) (kill-buffer))) But unfortunately, it doesn't work any more with the latest 29.0.50. TIA for any help,
[Prev in Thread] | Current Thread | [Next in Thread] |