Subject: bug#11017: 24.0.94; emacs-lock--kill-emacs-query-functions should ding

From: Juanma Barranquero <[email-masked]>
Date: Thu, 15 Mar 2012 13:54:12 +0100

On Thu, Mar 15, 2012 at 05:48, Michael Heerdegen
<[email-masked]> wrote:

> if I lock a buffer and try to exit Emacs, I only get a message:
>
>  "Buffer %S is locked and cannot be killed"

Really? I get "Emacs cannot exit because buffer %S is locked".

> This is IMHO not enough.  If the user tries to exit Emacs while there
> are locked buffers, he obviously has forgotten about these locks. So,
> there should be a (ding) to attract the user's attention.

A ding is obnoxious to many people. It could be added as an option,
but it is not really necessary IMHO. You can use

(defadvice emacs-lock--kill-emacs-query-functions (around do-ding activate)
  ad-do-it
  (unless ad-return-value (ding)))

(defadvice emacs-lock--kill-emacs-hook (around do-ding activate)
  (condition-case err
      ad-do-it
    (error
     (ding)
     (signal (car err) (cdr err)))))

> Without this, the user will possibly continue saying "yes" to the
> expected questions Emacs typically asks, and accidentally modify some
> buffer, which is annoying.

Getting into the habit of typing without reading what Emac is saying
is dangerous because you can end typing Y to a question you would've
rather said N...

    Juanma