Skip to content

Instantly share code, notes, and snippets.

@federkamm
Last active May 10, 2020 20:36
Show Gist options
  • Save federkamm/6bb3e0b55157fe0d995fd9bc4e1947e7 to your computer and use it in GitHub Desktop.
Save federkamm/6bb3e0b55157fe0d995fd9bc4e1947e7 to your computer and use it in GitHub Desktop.
Single shot god-mode for Emacs: Activate god-mode for just one command
(use-package god-mode
:ensure t
:config
(defun god-mode-deactivate-and-remove-hook ()
(god-local-mode -1)
(remove-hook 'post-command-hook #'god-mode-deactivate-and-remove-hook))
(defun god-mode-single-shot ()
(interactive)
(god-local-mode 1)
(add-hook 'pre-command-hook #'god-mode-deactivate-and-remove-hook))
:bind ("C-z" . god-mode-single-shot))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment