2017-06-08 11:47:56 +02:00
|
|
|
;;; core/autoload/debug.el -*- lexical-binding: t; -*-
|
2017-02-20 00:18:15 -05:00
|
|
|
|
|
|
|
;;;###autoload
|
2017-06-08 02:04:06 +02:00
|
|
|
(defun doom/what-face (&optional pos)
|
|
|
|
"Lists all faces at point. Overlay faces are denoted with an asterix."
|
2017-02-20 00:18:15 -05:00
|
|
|
(interactive "d")
|
2017-06-08 02:04:06 +02:00
|
|
|
(let ((pos (or pos (point)))
|
2017-05-17 17:43:35 +02:00
|
|
|
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))))
|
2017-06-08 02:04:45 +02:00
|
|
|
(if (called-interactively-p 'any)
|
|
|
|
(message "%s %s"
|
|
|
|
(propertize "Faces:" 'face 'font-lock-comment-face)
|
|
|
|
(if faces (string-join faces ", ") "n/a"))
|
|
|
|
(mapcar #'substring-no-properties faces))))
|
2017-05-17 17:43:35 +02:00
|
|
|
|
2017-06-08 02:04:45 +02:00
|
|
|
;;;###autoload
|
2017-05-19 16:52:32 +02:00
|
|
|
(defun doom-active-minor-modes ()
|
|
|
|
"Get a list of active minor-mode symbols."
|
2017-06-08 11:47:56 +02:00
|
|
|
(cl-loop for mode in minor-mode-list
|
|
|
|
unless (and (boundp mode) (symbol-value mode))
|
|
|
|
collect mode))
|
2017-02-20 00:18:15 -05:00
|
|
|
|
|
|
|
;;;###autoload
|
2017-05-19 16:52:32 +02:00
|
|
|
(defun doom/what-minor-mode (mode)
|
|
|
|
"Get information on an active minor mode. Use `describe-minor-mode' for a
|
|
|
|
selection of all minor-modes, active or not."
|
|
|
|
(interactive
|
|
|
|
(list (completing-read "Minor mode: "
|
|
|
|
(doom-active-minor-modes))))
|
2017-06-08 02:05:23 +02:00
|
|
|
(describe-minor-mode-from-symbol
|
|
|
|
(cl-typecase mode
|
|
|
|
(string (intern mode))
|
|
|
|
(symbol mode)
|
|
|
|
(t (error "Expected a symbol/string, got a %s" (type-of mode))))))
|
2017-05-26 11:17:19 +02:00
|
|
|
|
|
|
|
;;;###autoload
|
|
|
|
(defun doom/am-i-secure ()
|
|
|
|
"Test to see if your root certificates are securely configured in emacs."
|
|
|
|
(declare (interactive-only t))
|
|
|
|
(interactive)
|
|
|
|
(if-let (bad-hosts
|
2017-06-08 11:47:56 +02:00
|
|
|
(cl-loop for bad
|
|
|
|
in '("https://wrong.host.badssl.com/"
|
|
|
|
"https://self-signed.badssl.com/")
|
|
|
|
if (condition-case _e
|
|
|
|
(url-retrieve bad (lambda (_retrieved) t))
|
|
|
|
(error nil))
|
|
|
|
collect bad))
|
2017-05-26 11:17:19 +02:00
|
|
|
(error (format "tls seems to be misconfigured (it got %s)."
|
|
|
|
bad-hosts))
|
|
|
|
(url-retrieve "https://badssl.com"
|
|
|
|
(lambda (status)
|
|
|
|
(if (or (not status) (plist-member status :error))
|
|
|
|
(warn "Something went wrong.\n\n%s" (pp-to-string status))
|
|
|
|
(message "Your trust roots are set up properly.\n\n%s" (pp-to-string status))
|
|
|
|
t)))))
|