0

I am developing a package that works from Emacs-22 called leaf, and I'd like to use macroexpand-1 when testing it

But macroexpand-1 was not defined in Emacs-22 and Emacs-26's the code could not be defined because it depends on 'C - based' autoload-do-load function, even if I try to define it.

Is it impossible to use macroexpand-1 in Emacs-22? A hint to implement macroexpand-1 another way by Elisp is fine.

(Emacs-22 is bundled with macOS at /usr/bin/emacs)

Drew
  • 29,895
  • 7
  • 74
  • 104
Conao3
  • 171
  • 1
  • 3
  • 17

1 Answers1

0

see PR. https://github.com/conao3/leaf.el/pull/36/commits/47cf0b7c8d6b83b21800d01c594cef8e8d531e57

(when (not (fboundp 'autoload-do-load))
  (defun autoload-do-load (fundef &optional funname macro-only)
    (if (or (not (consp fundef)) (not (eql 'autoload (car fundef))))
        fundef
      (let ((kind (nth 4 fundef)))
        (if (and (eql macro-only 'macro)
                 (not (or (eql kind t)
                          (eql kind 'macro))))
            fundef)
        (if purify-flag
            (error "Attempt to autoload %s while preparing to dump" (symbol-name funnname)))
        (unwind-protect
            (let ((ignore-errors (if (or (eql kind t) (eql kind 'macro)) nil macro_only)))
              (load (cadr fundef) ignore-errors t nil t))
          ;; FIXME: revert partially performed defuns
          ())
        (if (or (not funname) ignore-errors)
            nil
          (let ((fun (indirect-function funname, nil)))
            (if (equal fun fundef)
                (error "Autoloading file %s failed to define function %s"
                       (caar load-history)
                       (symbol-name funname))
              fun)))))))
Conao3
  • 171
  • 1
  • 3
  • 17