Code Monkey home page Code Monkey logo

macrostep's People

Contributors

duianto avatar fice-t avatar georgek avatar joddie avatar jwiegley avatar luismbo avatar tarsius avatar xuchunyang avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

macrostep's Issues

...is not a macro form

Just recently I'm getting (iter ...) is not a macro form when running macrostep-expand. This only happens on macros which are imported from a different package than the one the file is in. slime-macroexpand-1 and friends all work as expected.

`macrostep-expand` fails with error on erroneous macros

(defmacro my-bad ()
  `(1+ ,(/ 1 0)))

(my-bad)

Using macrostep-expand on the last form results in an arithmetic error. I'm not sure whether that's intended behaviour, but I'd expect a preview of the code instead. Any thoughts on this?

Should expand autoloaded macros

macrostep-expand should detect the case where a macro is autoloaded, but not yet loaded, and load the macro's file if necessary.

For instance, in emacs -Q:

(symbol-function 'define-minor-mode) => (autoload "easy-mmode" 947743 nil t)

If the 5th element of the list is either t or macro, then it is indeed an autoloaded macro and should be loaded.

Use keywords for define-minor-mode

Hi @joddie,

When I start Emacs , I got this warning.
Can you update to use keywords rather than positional arguments?

/.emacs.d/lib/macrostep/macrostep.el: Warning: Use keywords rather than deprecated positional arguments to `define-minor-mode'

Emacs 28.1

makefile macrostepper

Hi, I figured I would link this macrostepper for makefiles, since I find that I use it all the time for expanding makefile variables. It will get confused by various complications but I find it useful enough for my purposes. You mentioned on the previous julia macrostepper you'd
be interested some sort of linkage between extensions, so I figure I would throw it
out there. Unfortunately I havent used julia in some time so haven't looked at that
one in ages.

New failures with native-compilation on emacs-next-minimal-30.0.50-1.9d27b95

Native-compiled on guix with the emacs indicated in the title. The package builds, but three tests fail.

Test macrostep-expand-macrolet-in-separate-buffer backtrace:
  error("(%s ...) is not a macro form" dummy-macro-2)
  (if (consp sexp) (error "(%s ...) is not a macro form" (car sexp)) (
  (condition-case nil (macrostep-next-macro) (error (if (consp sexp) (
  (if (funcall macrostep-macro-form-p-function sexp env) nil (conditio
  (let ((sexp (funcall macrostep-sexp-at-point-function)) (env (funcal
  (save-excursion (if (not (looking-at "[(`]")) (backward-up-list 1)) 
  macrostep-sexp-bounds()
  funcall(macrostep-sexp-bounds)
  (let* ((end (funcall macrostep-sexp-bounds-function)) (start (if end
  macrostep-expand()
  (let ((original-buffer (current-buffer))) (macrostep-goto "(dummy-ma
  (let ((print-level nil) (print-length nil) (standard-output (current
  (progn (emacs-lisp-mode) (let ((print-level nil) (print-length nil) 
  (unwind-protect (progn (emacs-lisp-mode) (let ((print-level nil) (pr
  (save-current-buffer (set-buffer temp-buffer) (unwind-protect (progn
  (let ((temp-buffer (generate-new-buffer " *temp*" t))) (save-current
  (let ((macrostep-expand-in-separate-buffer t)) (let ((temp-buffer (g
  (closure (t) nil (let ((macrostep-expand-in-separate-buffer t)) (let
  ert--run-test-internal(#s(ert--test-execution-info :test #s(ert-test
  ert-run-test(#s(ert-test :name macrostep-expand-macrolet-in-separate
  ert-run-or-rerun-test(#s(ert--stats :selector "^macrostep" :tests ..
  ert-run-tests("^macrostep" #f(compiled-function (event-type &rest ev
  ert-run-tests-batch("^macrostep")
  (let ((stats (ert-run-tests-batch "^macrostep"))) (if noninteractive
  (progn (load-file (expand-file-name "macrostep.el" (file-name-direct
  (if noninteractive (progn (load-file (expand-file-name "macrostep.el
  load-with-code-conversion("/tmp/guix-build-emacs-macrostep-0.9.2.drv
  command-line-1(("-L" "." "-l" "macrostep-test.el" "-f" "ert-run-test
  command-line()
  normal-top-level()
Test macrostep-expand-macrolet-in-separate-buffer condition:
    (error "(dummy-macro-2 ...) is not a macro form")
   FAILED  11/15  macrostep-expand-macrolet-in-separate-buffer (0.000447 sec) at macrostep-test.el:324
Entering macro stepper mode. Use e to expand, c to collapse, q to exit.
Entering macro stepper mode. Use e to expand, c to collapse, q to exit.
   passed  12/15  macrostep-expand-shadowed-macrolet (0.000703 sec)
Entering macro stepper mode. Use e to expand, c to collapse, q to exit.
Test macrostep-fontify-compiler-macros backtrace:
  ert-fail(((should (eq (get-char-property (1+ (point)) 'font-lock-fac
  (if (unwind-protect (setq value-233 (apply fn-231 args-232)) (setq f
  (let (form-description-235) (if (unwind-protect (setq value-233 (app
  (let ((value-233 'ert-form-evaluation-aborted-234)) (let (form-descr
  (let* ((fn-231 #'eq) (args-232 (condition-case err (let ((signal-hoo
  (let ((print-level nil) (print-length nil) (standard-output (current
  (progn (emacs-lisp-mode) (let ((print-level nil) (print-length nil) 
  (unwind-protect (progn (emacs-lisp-mode) (let ((print-level nil) (pr
  (save-current-buffer (set-buffer temp-buffer) (unwind-protect (progn
  (let ((temp-buffer (generate-new-buffer " *temp*" t))) (save-current
  (closure (t) nil (defalias 'macrostep-dummy-macro (cons 'macro #'(la
  ert--run-test-internal(#s(ert--test-execution-info :test #s(ert-test
  ert-run-test(#s(ert-test :name macrostep-fontify-compiler-macros :do
  ert-run-or-rerun-test(#s(ert--stats :selector "^macrostep" :tests ..
  ert-run-tests("^macrostep" #f(compiled-function (event-type &rest ev
  ert-run-tests-batch("^macrostep")
  (let ((stats (ert-run-tests-batch "^macrostep"))) (if noninteractive
  (progn (load-file (expand-file-name "macrostep.el" (file-name-direct
  (if noninteractive (progn (load-file (expand-file-name "macrostep.el
  load-with-code-conversion("/tmp/guix-build-emacs-macrostep-0.9.2.drv
  command-line-1(("-L" "." "-l" "macrostep-test.el" "-f" "ert-run-test
  command-line()
  normal-top-level()
Test macrostep-fontify-compiler-macros condition:
    (ert-test-failed
     ((should
       (eq (get-char-property ... ...) 'macrostep-compiler-macro-face))
      :form (eq nil macrostep-compiler-macro-face) :value nil))
   FAILED  13/15  macrostep-fontify-compiler-macros (0.000288 sec) at macrostep-test.el:367
Test macrostep-pp-macrolet-environment backtrace:
  ert-fail(((should (eq (get-char-property (point) 'font-lock-face) 'm
  (if (unwind-protect (setq value-169 (apply fn-167 args-168)) (setq f
  (let (form-description-171) (if (unwind-protect (setq value-169 (app
  (let ((value-169 'ert-form-evaluation-aborted-170)) (let (form-descr
  (let* ((fn-167 #'eq) (args-168 (condition-case err (let ((signal-hoo
  (progn (funcall --cl-search-- "(some-macro (&rest") (let* ((fn-162 #
  (let* ((--cl-search-- #'(lambda (text) (progn (macrostep-goto text t
  (progn (emacs-lisp-mode) (macrostep-pp '(cl-macrolet ((some-macro (&
  (unwind-protect (progn (emacs-lisp-mode) (macrostep-pp '(cl-macrolet
  (save-current-buffer (set-buffer temp-buffer) (unwind-protect (progn
  (let ((temp-buffer (generate-new-buffer " *temp*" t))) (save-current
  (closure (t) nil (let ((temp-buffer (generate-new-buffer " *temp*" t
  ert--run-test-internal(#s(ert--test-execution-info :test #s(ert-test
  ert-run-test(#s(ert-test :name macrostep-pp-macrolet-environment :do
  ert-run-or-rerun-test(#s(ert--stats :selector "^macrostep" :tests ..
  ert-run-tests("^macrostep" #f(compiled-function (event-type &rest ev
  ert-run-tests-batch("^macrostep")
  (let ((stats (ert-run-tests-batch "^macrostep"))) (if noninteractive
  (progn (load-file (expand-file-name "macrostep.el" (file-name-direct
  (if noninteractive (progn (load-file (expand-file-name "macrostep.el
  load-with-code-conversion("/tmp/guix-build-emacs-macrostep-0.9.2.drv
  command-line-1(("-L" "." "-l" "macrostep-test.el" "-f" "ert-run-test
  command-line()
  normal-top-level()
Test macrostep-pp-macrolet-environment condition:
    (ert-test-failed
     ((should (eq (get-char-property ... ...) 'macrostep-macro-face))
      :form (eq nil macrostep-macro-face) :value nil))
   FAILED  14/15  macrostep-pp-macrolet-environment (0.000374 sec) at macrostep-test.el:260
   passed  15/15  macrostep-print-sexp (0.000138 sec)

Ran 15 tests, 12 results as expected, 3 unexpected (2023-09-27 12:07:41+0000, 0.558410 sec)

3 unexpected results:
   FAILED  macrostep-expand-macrolet-in-separate-buffer
   FAILED  macrostep-fontify-compiler-macros
   FAILED  macrostep-pp-macrolet-environment


when expansion value is "", the original macro isn't reinserted on quit

This isn't a problem in elisp since empty macros are replaced with nil, but I just made an extension for makefiles, https://github.com/nverno/macrostep-make, and noticed that when a macro's
definition hasn't been defined, eg.
CC =
then, when
${CC}
is expanded, it is blank but doesn't replace with ${CC} upon exit from macroexpansion.
A workaround is to expand with " " instead of "". I don't know if this is something to fix on
this end, but thought I would mention it.

THanks

Expand macro in another buffer

Is there a way to expand the macro in another buffer, like slime or imacroexpand do, and continue the expansions there?

Two motivations:

  • Not messing with the original buffer,
  • Being able to see the original code being macrostepped.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.