Warning: this is an htmlized version!
The original is here, and the conversion rules are here. |
;; This file: ;; http://angg.twu.net/elisp/eev-inspect.el.html ;; http://angg.twu.net/elisp/eev-inspect.el ;; (find-angg "elisp/eev-inspect.el") ;; Author: Eduardo Ochs <eduardoochs@gmail.com> ;; ;; See: ;; https://github.com/mmontone/emacs-inspector/issues/8 ;; https://github.com/mmontone/emacs-inspector/issues/8#issue-1275655944 ;; (load (buffer-file-name)) ;; The variable `inspect-history-b' is similar to `inspect-history', ;; but uses a different format. Remember that `inspect-expression' is ;; defined as: ;; ;; (defun inspect-expression (exp) ;; "Evaluate EXP and inspect its result." ...) ;; ;; The first element of the list `inspect-history-b' is an "exp" that ;; will be evaluated to obtain the initial object to be inspected, and ;; the other elements of `inspect-history-b' are a series of actions ;; that transform one inspected object into the next one - a ;; "subobject". These actions can be either symbols - that are ;; interpreted as names of functions that receive a single argument - ;; or sexps containing "it"s, inspired by the ones used by dash.el. ;; Try: ;; ;; (require 'dash) ;; (--filter (< 5 it) '(1 2 3 4 5 6 7 8 9 10)) ;; ;; The three functions defined below manipulate these lists made of an ;; "exp" and a series of "actions": (defun inspect-history-b-sub1 (it f) "An internal function that is used to manipulate `inspect-history-b'." (if (symbolp f) (funcall f it) (eval f))) (defun inspect-history-b-subs (exp-and-actions) "An internal function that is used to manipulate `inspect-history-b'." (let* ((it (eval (car exp-and-actions))) (fs (cdr exp-and-actions)) (history (list it))) (while fs (setq it (inspect-history-b-sub1 it (car fs))) (setq fs (cdr fs)) (setq history (cons it history))) history)) (defun inspect-history-b-sub (itfs) "An internal function that is used to manipulate `inspect-history-b'." (car (inspect-history-b-subs itfs))) ;; Try: ;; (inspect-history-b-sub1 '(1 (2 3 4)) 'cdr) ;; (inspect-history-b-sub1 '(1 (2 3 4)) '(nth 1 it)) ;; (inspect-history-b-sub '('(1 (2 3 4)) cdr)) ;; (inspect-history-b-sub '('(1 (2 3 4)) cdr car)) ;; (inspect-history-b-sub '('(1 (2 3 4)) cdr car (nth 2 it))) ;; (inspect-history-b-subs '('(1 (2 3 4)) cdr car (nth 2 it))) ;; `inspect-expression-b' is a variant of ;; `inspect-expression' that receives an argument of the form ;; exp-and-actions - see above - and sets `inspect-history' and ;; `inspect-history-b' in the right way. ;; ;; Tests: ;; (inspect-expression ''(1 (2 3 4))) ;; (inspect-expression-b '('(1 (2 3 4)))) ;; (inspect-expression-b '('(1 (2 3 4)) cdr car (nth 2 it))) ;; (inspect-expression-b '('(1 (2 3 4)) cadr (nth 2 it))) ;; (inspect-expression '(selected-window)) ;; (inspect-expression '(current-buffer)) ;; (inspect-expression 'derawify-face) ;; (find-eface-links 'derawify-face) ;; (find-eface-links 'default) ;; (inspect-expression (face-attribute 'default :font)) ;; (query-font (face-attribute 'default :font)) (defvar-local inspector-history-b nil "The inspector buffer history, in another format.") (defun inspect-expression-b (history-b) "This is similar to `inspect-expression'... TODO: document this. HISTORY-B is a list of the form exp-and-actions." (let* ((history (inspect-history-b-subs history-b)) (obj (car history))) (inspector-inspect obj) (with-current-buffer "*inspector*" (setq inspector-inspected-object (car history)) (setq inspector-history (cdr history)) (setq inspector-history-b history-b)) nil)) ;; Load inspector.el and eev-inspect.el. ;; This block is full of eev-isms. You are not expected to understand this! ;; ;; (find-git-links "https://github.com/mmontone/emacs-inspector" "emacsinspector") ;; (defun e () (interactive) (find-angg "elisp/eev-inspect.el")) ;; (code-c-d "emacsinspector" "~/usrc/emacs-inspector/") ;; (find-emacsinspectorfile "") ;; (load "~/usrc/emacs-inspector/inspector.el") ;; (load "~/elisp/eev-inspect.el") '("This is a test block: * (eepitch-shell) * (eepitch-kill) * (eepitch-shell) rm -Rfv ~/usrc/emacs-inspector/ cd ~/usrc/ git clone https://github.com/mmontone/emacs-inspector cd ~/usrc/emacs-inspector/ --") ;; Local Variables: ;; coding: utf-8-unix ;; End: