|
Warning: this is an htmlized version!
The original is here, and the conversion rules are here. |
;; -*- lexical-binding: nil; -*-
;; This file:
;; https://anggtwu.net/2025-modern/01-base.el.html
;; https://anggtwu.net/2025-modern/01-base.el
;; (find-angg "2025-modern/01-base.el")
;; Author: Eduardo Ochs <eduardoochs@gmail.com>
;;
;; This is one of the files used in my talk at the EmacsConf205. It is
;; a reduced version of one of the files that I used in this longer
;; video, that I recorded in march/2025:
;; http://anggtwu.net/2025-modern.html
;; (find-1stclassvideo-links "2025modern")
;; Based on: (find-angg "ORG/2025-modern.org" "6")
;; (find-angg "elisp/2025-modern-prints.el")
;; «.2a» (to "2a")
;; «.buttons» (to "buttons")
;; «.button-macro» (to "button-macro")
;;; ____
;;; |___ \ __ _
;;; __) / _` |
;;; / __/ (_| |
;;; |_____\__,_|
;;;
;; «2a» (to ".2a")
;; See: (find-multiwindow-intro "3. High-level words")
(defun find-epp-2a (o) (find-2a nil `(find-epp ',o :end)))
(defun find-estring-elisp-2a (o) (find-2a nil `(find-estring-elisp ',o :end)))
(defun find-clprin1-2a (o) (find-2a nil `(find-clprin1 ',o :end)))
(defun find-clprin1ind-2a (o) (find-2a nil `(find-clprin1ind ',o :end)))
(defun find-clprin2-2a (o) (find-2a nil `(find-clprin2 ',o :end)))
(defun find-eoutput-2a (code) (find-2a nil `(find-eoutput-rerun "o" ',code :end)))
'("Tests:"
"Note that this block is commented out!"
* (find-estring-elisp-2a "(if t \"yes\")")
* (find-epp-2a '(if t "yes"))
* (find-clprin1-2a '(if t "yes"))
* (find-clprin1-2a (symbol-function 'find-epp-2a))
* (find-clprin1ind-2a (symbol-function 'find-epp-2a))
* (find-clprin2-2a (symbol-function 'find-epp-2a))
* (find-eoutput-2a '(insert "foo"))
)
;;; ____ _ _
;;; | __ ) _ _| |_| |_ ___ _ __ ___
;;; | _ \| | | | __| __/ _ \| '_ \/ __|
;;; | |_) | |_| | |_| || (_) | | | \__ \
;;; |____/ \__,_|\__|\__\___/|_| |_|___/
;;;
;; «buttons» (to ".buttons")
(defvar ee-button nil)
(defun ee-set-button (&optional verbose)
"Set `ee-button' to the button at point.
This function just sets `ee-button' to a marker pointing to the current
position in the current buffer - it doesn't check that it is a button."
(interactive (list t))
(setq ee-button (copy-marker (point) t))
(if verbose (message "ee-button is now %S" ee-button))
ee-button)
;; «button-macro» (to ".button-macro")
;; Skel: (find-let*-macro-links "button" "b" "buf pos bp cat catp")
(defmacro ee-let*-macro-button (b &rest code)
(declare (indent 1))
`(let* ((b ,b)
(buf (marker-buffer b))
(pos (marker-position b))
(bp (with-current-buffer buf (text-properties-at pos)))
(cat (plist-get bp 'category))
(catp (symbol-plist cat))
(props0 (append bp catp))
(props1 (cl-loop for (k v) on props0 by 'cddr
collect (list k v)))
(props2 (ee-sort-pairs props1))
(badkeys '(button evaporate face keymap mouse-face rear-nonsticky))
(props3 (cl-loop for (k v) in props2
if (not (member k badkeys))
collect (list k v)))
(helpfun (car (alist-get 'help-function props2)))
(helpargs (car (alist-get 'help-args props2)))
(helpargsq (mapcar 'ee-add-quote helpargs))
(helpcall (cons helpfun helpargsq)))
,@code))
(defmacro ee-with-button (sexp)
(declare (indent 1))
`(ee-let*-macro-button ee-button ,sexp))
(defun find-3h (sexp) (find-3a nil '(find-ebuffer "*Help*") sexp))
(defun find-epp-3hb (sexp) (find-3h `(ee-with-button (find-epp ,sexp))))
(defun find-eppp-3hb (sexp) (find-3h `(ee-with-button (find-eppp ,sexp))))
'("Tests:"
"Note that this block is commented out!"
"Preparation: run the two sexps below,"
* (cl-defstruct myabc a b c)
* (find-2a nil '(find-etypedescr 'myabc))
* (find-estring-elisp-2a "(if t \"yes\")")
* (find-epp-2a '(if t "yes"))
* (find-clprin1-2a '(if t "yes"))
* (find-clprin1-2a (symbol-function 'find-epp-2a))
* (find-clprin1ind-2a (symbol-function 'find-epp-2a))
* (find-clprin2-2a (symbol-function 'find-epp-2a))
* (find-eoutput-2a '(insert "foo"))
)
;; Local Variables:
;; coding: utf-8-unix
;; End: