Håkon Hægland
Håkon Hægland

Reputation: 40748

How to define special keyboard shortcut for killing view-file buffer in Emacs

I am using view-file to display some help information.When I press F3 the help file is opened with view-file. I want to close the view-file buffer using the same key F3. But for all other buffers, the shortcut should not be defined, that is: the usual C-x k should still work here.

Upvotes: 2

Views: 82

Answers (1)

juanleon
juanleon

Reputation: 9380

To summarize discussion, and to solve the question of "witch buffer to kill?", here is a solution:

(eval-after-load "view"
  '(define-key view-mode-map [(f3)] 'kill-this-buffer))

Upvotes: 4

Related Questions