Better doom/what-face; remove unused util defuns

This commit is contained in:
Henrik Lissner 2017-05-17 17:43:35 +02:00
parent 03ebdf7855
commit 310c235bb5

View file

@ -2,14 +2,21 @@
;;;###autoload ;;;###autoload
(defun doom/what-face (pos) (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") (interactive "d")
(let ((hl-line-p (bound-and-true-p hl-line-mode))) (let ((pos (point))
(if hl-line-p (hl-line-mode -1)) faces)
(let ((face (or (get-char-property pos 'read-face-name) (when-let (face (get-text-property pos 'face))
(get-char-property pos 'face)))) (dolist (f (if (listp face) face (list face)))
(if face (message "Face: %s" face) (message "No face at %d" pos))) (push (propertize (symbol-name f) 'face f) faces)))
(if hl-line-p (hl-line-mode 1)))) (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 ;;;###autoload
(defun doom/what-col () (defun doom/what-col ()
@ -17,14 +24,10 @@
(message "Column %d" (current-column))) (message "Column %d" (current-column)))
;;;###autoload ;;;###autoload
(defun doom-what-bindings (key) (defun doom/what-bindings (key)
(list (interactive "k")
(minor-mode-key-binding key) (message "minor-mode:\t%s\nlocal:\t\t%s\nglobal:\t\t%s"
(local-key-binding key) (or (minor-mode-key-binding key) "n/a")
(global-key-binding key))) (or (local-key-binding key) "n/a")
(or (global-key-binding key) "n/a")))
;;;###autoload
(defun doom/what-major-mode ()
(interactive)
(message "Mode: %s" major-mode))