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

From: Michael Heerdegen <[email-masked]>
Date: Sat, 14 Apr 2012 02:36:38 +0200

Hello Juanma,

> Michael, this patch adds the hook described above. Could you please
> test it and see whether it works for you use case?

Yes, this looks really good.  With

(add-hook 'emacs-lock-locked-buffer-hook
          (lambda (buffer) (ding) (pop-to-buffer buffer)))

I get all I want.  So, I'm happy with your patch.

However, should `emacs-lock-locked-buffer-hook' not better be named
`...-functions' or so?  Because, from the manual:

|    By convention, abnormal hook names end in `-functions' or `-hooks'.
| If the variable's name ends in `-function', then its value is just a
| single function, not a list of functions.

> As for the note option, I'm thinking about unobtrusive ways to add it.

Mmh, the prefix arg of `emacs-lock-mode' is already used for the locking
mode.  So we'll probably need a separate command that reads the note
text and saves it to a buffer local variable, and maybe a user option
that controls if this command is run automatically by emacs-lock-mode.

Then I would just change the standard messages:

(message "Emacs cannot exit because buffer %S is locked"
               (buffer-name locked))

(message "Buffer %S is locked and cannot be killed" (buffer-name))

to include the note - Just a proposal.

Anyway, if you have a patch, please send it to the bug's address again.

Regards,

Michael.