0

windows 10, emacs 26.1

In my init.el

(with-eval-after-load 'magit-status
  (define-key magit-status-mode-map (kbd "C-<tab>") nil))

This disable C-<tab> after magit-status was load. And now C-<tab> is disable in magit-status. Nice.

But suppose I want to rollback C-<tab> in magit-status. How I can do this? Off course I can remove this code and restart Emacs. But has any better solution?

3

Replace the nil in your code with the name of the function it was originally bound to and re-evaluate it. I think it's magit-section-cycle, so the code would be:

(with-eval-after-load 'magit-status
  (define-key magit-status-mode-map (kbd "C-<tab>") 'magit-section-cycle))

You can evaluate just that line by placing point (the cursor) at the end of the second line and entering C-x C-e.

The with-eval-after-load form delays running the code until after magit-status is loaded. If you're just tweaking your settings and you want to switch your keybindings back and forth temporarily, you only need to evaluate the define-key form (as long as magit-status has already been loaded):

(define-key magit-status-mode-map (kbd "C-<tab>") 'magit-section-cycle)

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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