diff --git a/core/autoload/debug.el b/core/autoload/debug.el index b27213f3a..a147ca582 100644 --- a/core/autoload/debug.el +++ b/core/autoload/debug.el @@ -2,14 +2,21 @@ ;;;###autoload (defun doom/what-face (pos) - "Tells you the name of the face (point) is on." + "Lists all faces at point. Overlay faces are <>-delimited." (interactive "d") - (let ((hl-line-p (bound-and-true-p hl-line-mode))) - (if hl-line-p (hl-line-mode -1)) - (let ((face (or (get-char-property pos 'read-face-name) - (get-char-property pos 'face)))) - (if face (message "Face: %s" face) (message "No face at %d" pos))) - (if hl-line-p (hl-line-mode 1)))) + (let ((pos (point)) + faces) + (when-let (face (get-text-property pos 'face)) + (dolist (f (if (listp face) face (list face))) + (push (propertize (symbol-name f) 'face f) faces))) + (dolist (ov (overlays-at pos (1+ pos))) + (let ((face (overlay-get ov 'face))) + (dolist (f (if (listp face) face (list face))) + (push (propertize (concat (symbol-name f) "*") 'face f) faces)))) + + (message "%s %s" + (propertize "Faces:" 'face 'font-lock-comment-face) + (if faces (string-join faces ", ") "n/a")))) ;;;###autoload (defun doom/what-col () @@ -17,14 +24,10 @@ (message "Column %d" (current-column))) ;;;###autoload -(defun doom-what-bindings (key) - (list - (minor-mode-key-binding key) - (local-key-binding key) - (global-key-binding key))) - -;;;###autoload -(defun doom/what-major-mode () - (interactive) - (message "Mode: %s" major-mode)) +(defun doom/what-bindings (key) + (interactive "k") + (message "minor-mode:\t%s\nlocal:\t\t%s\nglobal:\t\t%s" + (or (minor-mode-key-binding key) "n/a") + (or (local-key-binding key) "n/a") + (or (global-key-binding key) "n/a")))