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)
|
2017-06-10 16:10:59 +02:00
|
|
|
"Shows all faces and overlay faces at point.
|
|
|
|
|
|
|
|
Interactively prints the list to the echo area. Noninteractively, returns a list
|
|
|
|
whose car is the list of faces and cadr is the list of overlay faces."
|
2017-06-10 15:32:55 +02:00
|
|
|
(interactive)
|
2017-09-15 13:49:00 +02:00
|
|
|
(let* ((pos (or pos (point)))
|
|
|
|
(faces (let ((face (get-text-property pos 'face)))
|
|
|
|
(if (keywordp (car-safe face))
|
|
|
|
(list face)
|
|
|
|
(cl-loop for f in (doom-enlist face) collect f))))
|
|
|
|
(overlays (cl-loop for ov in (overlays-at pos (1+ pos))
|
|
|
|
nconc (doom-enlist (overlay-get ov 'face)))))
|
2017-06-10 15:32:55 +02:00
|
|
|
(cond ((called-interactively-p 'any)
|
2017-06-10 16:10:59 +02:00
|
|
|
(message "%s %s\n%s %s"
|
2017-06-10 15:32:55 +02:00
|
|
|
(propertize "Faces:" 'face 'font-lock-comment-face)
|
|
|
|
(if faces
|
|
|
|
(cl-loop for face in faces
|
|
|
|
if (listp face)
|
|
|
|
concat (format "'%s " face)
|
|
|
|
else
|
|
|
|
concat (concat (propertize (symbol-name face) 'face face) " "))
|
|
|
|
"n/a ")
|
2017-06-10 16:10:59 +02:00
|
|
|
(propertize "Overlays:" 'face 'font-lock-comment-face)
|
2017-06-10 15:32:55 +02:00
|
|
|
(if overlays
|
|
|
|
(cl-loop for ov in overlays
|
|
|
|
concat (concat (propertize (symbol-name ov) 'face ov) " "))
|
|
|
|
"n/a")))
|
|
|
|
(t
|
|
|
|
(and (or faces overlays)
|
|
|
|
(list faces overlays))))))
|
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)
|
2017-09-15 13:49:10 +02:00
|
|
|
(unless (string-match-p "\\_<GNUTLS\\_>" system-configuration-features)
|
|
|
|
(warn "gnutls support isn't built into Emacs, there may be problems"))
|
2017-12-10 14:49:52 -05:00
|
|
|
(if-let* ((bad-hosts
|
|
|
|
(cl-loop for bad
|
|
|
|
in '("https://wrong.host.badssl.com/"
|
|
|
|
"https://self-signed.badssl.com/")
|
|
|
|
if (condition-case _e
|
2017-12-20 19:57:15 -05:00
|
|
|
(url-retrieve-synchronously bad)
|
2017-12-10 14:49:52 -05:00
|
|
|
(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)))))
|
2017-06-18 23:37:58 +02:00
|
|
|
|
|
|
|
(defvar doom--profiler nil)
|
|
|
|
;;;###autoload
|
|
|
|
(defun doom/toggle-profiler ()
|
|
|
|
(interactive)
|
|
|
|
(if (not doom--profiler)
|
|
|
|
(profiler-start 'cpu+mem)
|
|
|
|
(profiler-report)
|
|
|
|
(profiler-stop))
|
|
|
|
(setq doom--profiler (not doom--profiler)))
|
2017-12-31 17:49:27 -05:00
|
|
|
|
|
|
|
;;;###autoload
|
|
|
|
(defun doom/info ()
|
|
|
|
"Collects information about this session of Doom Emacs and copies it to the
|
|
|
|
clipboard. Helpful when filing bug reports!"
|
|
|
|
(interactive)
|
|
|
|
(with-temp-buffer
|
2017-12-31 18:32:34 -05:00
|
|
|
(message "Producing information about your system...")
|
2017-12-31 17:49:27 -05:00
|
|
|
(call-process (expand-file-name "bin/doom-doctor" doom-emacs-dir) nil t)
|
|
|
|
(ansi-color-apply-on-region (point-min) (point-max))
|
2017-12-31 18:32:34 -05:00
|
|
|
(kill-new (buffer-string))
|
|
|
|
(message "Done. Copied to clipboard!")))
|