Hi Jean Louis, Can you test the code below? It's a prototype based on the ideas that we were discussing in private... Cheers, E. =)
;; Tests: ;; (ee-button-sexp-text nil nil) ;; (ee-button-sexp-text nil "foo") ;; (ee-button-sexp-text '(+ 1 2) nil) ;; (ee-button-sexp-text '(+ 1 2) "foo") ;; (defun ee-button-sexp-text (sexp text) (if sexp (if text "ok" ; if sexp and text (setq text (ee-S sexp))) ; if sexp and (not text) (if text (setq sexp (read text)) ; if (not sexp) and text (setq sexp nil text " "))) ; if (not sexp) and (not text) (list sexp text)) ;; See: (find-kla-intro "9. `cl-defun'") ;; (cl-defun ee-makebutton (&key sexp text help-echo) (let ((st (ee-button-sexp-text sexp text))) (setq sexp (car st)) (setq text (cadr st))) (let ((callback `(lambda (_) ,sexp))) (buttonize text callback nil help-echo))) ;; Tests: ;; (find-eemakebutton :sexp '(message "foo") :text "Foo") ;; (find-eemakebutton :sexp '(find-efunctiondescr 'car)) ;; (find-eemakebutton :sexp '(find-efunctiondescr 'car) :help-echo "HELP") ;; (defun find-eemakebutton (&rest rest) (find-estring (apply 'ee-makebutton rest))) (defun ee-B (sexp) (ee-H (ee-makebutton :sexp sexp))) ;; The sexp below is commented out with a "'". ;; To test it go to its last line and type `M-e'. ;; ' (find-elinks `((foo) (bar) (find-efunctiondescr 'car) ,(ee-H "plic") ,(ee-H (ee-makebutton :sexp '(+ 1 2))) ,(ee-H (ee-makebutton :sexp '(find-efunctiondescr 'car))) "" (find-efunctiondescr 'car) ,(ee-B '(find-efunctiondescr 'car)) ))