The SSH host key has changed on 8 April, 2022 to this one: SHA256:573uTBSeh74kvOo0HJXi5ijdzRm8me27suzNEDlGyrQ
Browse Source

Warn about key rebinds

warn-key-rebind
Gergely Polonkai 6 years ago
parent
commit
4e666d5c6b
  1. 3
      init.el
  2. 27
      lisp/gpolonkai-misc.el

3
init.el

@ -40,6 +40,9 @@
(load "frame-manip")
(load "file-manip")
(load "window-manip")
(load "gpolonkai-misc")
(advice-add 'define-key :before #'warn-key-rebind)
;; Define aliases
(defalias 'yes-or-no-p 'y-or-n-p)

27
lisp/gpolonkai-misc.el

@ -0,0 +1,27 @@
(defun warn-key-rebind (keymap key new-def)
"Warn if a key is being rebound."
(let ((global-def (global-key-binding key))
(local-def (local-key-binding key))
(minor-defs (minor-mode-key-binding key))
(key-desc (key-description key)))
(when (and global-def
(not (numberp global-def))
(not (equal global-def new-def)))
(warn "'%s' from the global keymap is being rebound from '%s' to '%s'"
key-desc
global-def
new-def))
(when (and local-def
(not (numberp local-def))
(not (equal local-def new-def)))
(warn "'%s' from the local keymap is being rebound from '%s' to '%s'"
key-desc
local-def
new-def))
(when minor-defs
(dolist (binding minor-defs)
(warn "'%s' from '%s' keymap is being rebound from '%s' to '%s'"
key-desc
(car binding)
(cdr binding)
new-def)))))
Loading…
Cancel
Save