1

As per title, I want to define a kill buffer hook with the variable kill-buffer-hook and the function should be able to detect when (kill-buffer ) has been called interactively.

Is this possible?

The use case is in that I'd like to control the buffer displayed after killings. Anyway, there are a lot of hidden buffers opened and killed in the background, which should not trigger the hook actions.

1 Answer 1

5

Test the variable this-command to see whether it is kill-buffer

1
  • Perfect! Just want to add I realized I need to test for kill-this-buffer too, for the cases when the buffer is killed from the menubar/toolbar. There is always a way in Emacs)
    – antonio
    Commented Nov 16, 2016 at 13:57

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.