|
Warning: this is an htmlized version!
The original is here, and the conversion rules are here. |
** This file: ** https://anggtwu.net/2025-modern/00-try-this.html ** https://anggtwu.net/2025-modern/00-try-this ** (find-angg "2025-modern/00-try-this") ** Author: Eduardo Ochs <eduardoochs@gmail.com> * * *** 0. Preparation: (down)load some files *** ===================================== *** We are in "00-try-this". *** * (emacs-lisp-mode) * (eepitch-shell) * (eepitch-kill) * (eepitch-shell) rm -Rv /tmp/2025-modern/ mkdir /tmp/2025-modern/ cd /tmp/2025-modern/ wget -nc https://anggtwu.net/2025-modern/00-try-this wget -nc https://anggtwu.net/2025-modern/01-base.el wget -nc https://anggtwu.net/2025-modern/02-lambda-vector-like.el wget -nc https://anggtwu.net/2025-modern/03-lambda-old-style.el wget -nc https://anggtwu.net/2025-modern/04-lambda-named-plist.el * * (code-c-d "modern" "/tmp/2025-modern/" :anchor) * (find-2a nil '(find-modern "01-base.el" "2a")) * (load "/tmp/2025-modern/01-base.el") * * *** 1. Understanding advice - *** basic definitions (boring) *** ========================== *** * (defun adt-insert (o) (insert (format "\n;; --> %S" o))) * (defun adt-1 () (adt-insert 1)) * (defun adt-2 () (adt-insert 2)) * (defun adt-3 () (adt-insert 3)) * * (find-eoutput-2a '(adt-insert 42)) * (find-eoutput-2a '(adt-1)) * (find-eoutput-2a '(adt-2)) * (find-eoutput-2a '(adt-3)) * * *** 2. What happens when we modify `adt-2' by adding and removing advices? *** (Run this several times, watching the window at the right) *** ========================================================== *** * (find-eoutput-2a '(adt-2)) * (advice-add 'adt-2 :before 'adt-1) * (find-eoutput-2a '(adt-2)) * (advice-add 'adt-2 :after 'adt-3) * (find-eoutput-2a '(adt-2)) * (advice-remove 'adt-2 'adt-1) * (find-eoutput-2a '(adt-2)) * (advice-remove 'adt-2 'adt-3) * (find-eoutput-2a '(adt-2)) * * *** 3. Understanding advice - the "internal view" *** Add exactly two advices to `adt-2', and inspect it *** ================================================== *** * (symbol-function 'adt-2) * (find-epp-2a (symbol-function 'adt-2)) * (advice-remove 'adt-2 'adt-1) * (advice-remove 'adt-2 'adt-3) * (advice-add 'adt-2 :before 'adt-1) * (advice-add 'adt-2 :after 'adt-3) * * (find-epp-2a (symbol-function 'adt-2)) * (find-clprin1-2a (symbol-function 'adt-2)) * (find-clprin2-2a (symbol-function 'adt-2)) * * * *** 4. Switch between three ways of printing lambdas *** ================================================ * * (defun foo (a b) "Docstr" (interactive (list 2 3)) a (+ a b)) * (setq o (symbol-function 'foo)) * * (find-clprin2-2a o) * (load "/tmp/2025-modern/02-lambda-vector-like.el") (find-clprin2-2a o) * (load "/tmp/2025-modern/03-lambda-old-style.el") (find-clprin2-2a o) * (load "/tmp/2025-modern/04-lambda-named-plist.el") (find-clprin2-2a o) * (load "/tmp/2025-modern/02-lambda-vector-like.el") (find-clprin2-2a o) * * ** The details are here: * (find-2a nil '(find-modern "02-lambda-vector-like.el")) * (find-2a nil '(find-modern "03-lambda-old-style.el")) * (find-2a nil '(find-modern "04-lambda-named-plist.el")) * * * *** 5. Buttons: preparation *** ======================= *** You need a "*Help*" buffer with buttons, *** and you need to go to that buffer and run *** `M-x ee-set-button' on one of its buttons. *** * (cl-defstruct myabc a b c) * (find-2a nil '(find-etypedescr 'myabc)) * * * *** 6. Buttons: displaying information *** ================================== *** The tests below act on `ee-button', and they use *** the functions and macros defined in: *** *** (find-2a nil '(find-modern "01-base.el" "button-macro")) *** * (ee-let*-macro-button ee-button b) * (ee-let*-macro-button ee-button buf) * (ee-let*-macro-button ee-button pos) * (ee-let*-macro-button ee-button cat) * (ee-with-button cat) * (find-3h '(find-epp (ee-with-button cat))) * (find-3h '(ee-with-button (find-epp cat))) * (find-epp-3hb 'b) * (find-epp-3hb 'buf) * (find-epp-3hb 'pos) * (find-epp-3hb 'cat) * (find-epp-3hb 'catp) * (find-epp-3hb 'props0) * (find-eppp-3hb 'props1) * (find-eppp-3hb 'props2) * (find-eppp-3hb 'props3) * (find-epp-3hb 'helpfun) * (find-epp-3hb 'helpargs) * (find-epp-3hb 'helpargsq) * (find-epp-3hb 'helpcall) *** *** What was your reaction to that? *** if it was more "wow" than "blergh" then you might like *** the last part of this video that I recorded in march... *** *** Play: (find-2025modernvideo "16:11") *** HSubs: (find-2025modernhsubs "16:11") *** LSubs: (find-2025modernlsubs "16:11")