debug.el 1.3 KB

12345678910111213141516171819202122232425262728293031323334353637383940
  1. ;; <https://www.reddit.com/r/emacs/comments/7htdzk/show_reddit_prettyprint_debugger_frames/>
  2. (defun wi-debugger-pp-frame ()
  3. (interactive)
  4. (let ((inhibit-read-only t)
  5. (frame (backtrace-frame (debugger-frame-number))))
  6. (set-buffer (pop-to-buffer "*BT: Frame*"))
  7. (cl-destructuring-bind (special fn &rest args) frame
  8. (erase-buffer)
  9. (progn
  10. (insert "(" (pp-to-string fn))
  11. (dolist (arg args)
  12. (insert "\n" (pp-to-string arg)))
  13. (insert ")"))
  14. (goto-char (point-min))
  15. (indent-pp-sexp))))
  16. ;; (define-key debugger-mode-map "r" 'wi-debugger-pp-frame)
  17. (defun wi-god-mode-update-cursor ()
  18. (let ((limited-colors-p (> 257 (length (defined-colors)))))
  19. (cond
  20. (god-local-mode
  21. (progn
  22. (set-face-background
  23. 'mode-line
  24. (if limited-colors-p "white" "#e9e2cb"))
  25. (set-face-background
  26. 'mode-line-inactive
  27. (if limited-colors-p "white" "#e9e2cb"))))
  28. (t (progn
  29. (set-face-background
  30. 'mode-line
  31. (if limited-colors-p "black" "grey75"))
  32. (set-face-background
  33. 'mode-line-inactive
  34. (if limited-colors-p "grey20" "grey90")))))))
  35. (add-hook 'god-mode-enabled-hook 'wi-god-mode-update-cursor)
  36. (add-hook 'god-mode-disabled-hook 'wi-god-mode-update-cursor)