From 2a3fa73d14ed92515d1729ef58ea49352134ce74 Mon Sep 17 00:00:00 2001 From: garlic0x1 Date: Sun, 4 Feb 2024 16:51:07 -0600 Subject: [PATCH 1/4] fc --- extensions/lisp-mode/macroexpand.lisp | 48 ++++++++++++++++----------- 1 file changed, 28 insertions(+), 20 deletions(-) diff --git a/extensions/lisp-mode/macroexpand.lisp b/extensions/lisp-mode/macroexpand.lisp index 1f58b5965..b7b1ec38b 100644 --- a/extensions/lisp-mode/macroexpand.lisp +++ b/extensions/lisp-mode/macroexpand.lisp @@ -146,7 +146,7 @@ (backward-up-list point) (skip-chars-backward point #'syntax-expr-prefix-char-p)) (values point - (form-offset (copy-point point :temporary) 1))) + (form-offset (copy-point point :temporary) 1))) (defmacro with-form-points ((start end point) &body body) (check-type start symbol) @@ -223,8 +223,8 @@ "Press \"q\" to undo. Do you want to disable this message in the future?" :gravity (make-instance 'lem/popup-window::gravity-cursor - :offset-x 1 - :offset-y 1)) + :offset-x 1 + :offset-y 1)) (lisp-macrostep-disable-help))))) (defun guard () (error 'read-only-error)) @@ -236,23 +236,31 @@ Do you want to disable this message in the future?" (orig-package-name (buffer-package (current-buffer) "CL-USER")) (p (and self (copy-point (current-point) :temporary)))) (lisp-eval-async `(,expander ,(lem-lisp-mode/internal::form-string-at-point)) - (lambda (string) - (let ((buffer (make-buffer "*lisp-macroexpand*"))) - (with-buffer-read-only buffer nil - (unless self (erase-buffer buffer)) - (change-buffer-mode buffer 'lisp-mode) - (setf (buffer-package buffer) orig-package-name) - (when self - (move-point (current-point) p) - (kill-sexp)) - (insert-string (buffer-point buffer) - string) - (indent-points (buffer-start-point buffer) - (buffer-end-point buffer)) - (with-pop-up-typeout-window (s buffer) - (declare (ignore s))) - (when self - (move-point (buffer-point buffer) p)))))))) + (lambda (string) + (let ((buffer (make-buffer "*lisp-macroexpand*"))) + (with-buffer-read-only buffer nil + (unless self (erase-buffer buffer)) + (change-buffer-mode buffer 'lisp-mode) + (setf (buffer-package buffer) orig-package-name) + (when self + (move-point (current-point) p) + (kill-sexp)) + (insert-string (buffer-point buffer) + string) + (indent-points (buffer-start-point buffer) + (buffer-end-point buffer)) + (with-pop-up-typeout-window (s buffer) + (declare (ignore s))) + (when self + (move-point (buffer-point buffer) p)))))))) + +(define-command lisp-macroexpand-in-place () () + (lisp-eval-async `(micros:swank-macroexpand-1 + (lem-lisp-mode/internal::form-string-at-point)) + (lambda (string) + (kill-sexp) + (insert-string (current-point) string) + (indent-buffer (current-buffer))))) (define-command lisp-macroexpand () () (check-connection) From a4f99cc0f41a68c817e80cc9b9e771e846f43a25 Mon Sep 17 00:00:00 2001 From: garlic0x1 Date: Sun, 4 Feb 2024 17:02:55 -0600 Subject: [PATCH 2/4] check-connection --- extensions/lisp-mode/macroexpand.lisp | 1 + 1 file changed, 1 insertion(+) diff --git a/extensions/lisp-mode/macroexpand.lisp b/extensions/lisp-mode/macroexpand.lisp index b7b1ec38b..19371b071 100644 --- a/extensions/lisp-mode/macroexpand.lisp +++ b/extensions/lisp-mode/macroexpand.lisp @@ -255,6 +255,7 @@ Do you want to disable this message in the future?" (move-point (buffer-point buffer) p)))))))) (define-command lisp-macroexpand-in-place () () + (check-connection) (lisp-eval-async `(micros:swank-macroexpand-1 (lem-lisp-mode/internal::form-string-at-point)) (lambda (string) From d568219d3c1d25eadc8fb2cdd97644080bc4fdae Mon Sep 17 00:00:00 2001 From: garlic0x1 Date: Mon, 5 Feb 2024 00:46:06 -0600 Subject: [PATCH 3/4] prettier --- extensions/lisp-mode/macroexpand.lisp | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/extensions/lisp-mode/macroexpand.lisp b/extensions/lisp-mode/macroexpand.lisp index 19371b071..ded44409c 100644 --- a/extensions/lisp-mode/macroexpand.lisp +++ b/extensions/lisp-mode/macroexpand.lisp @@ -256,12 +256,13 @@ Do you want to disable this message in the future?" (define-command lisp-macroexpand-in-place () () (check-connection) - (lisp-eval-async `(micros:swank-macroexpand-1 - (lem-lisp-mode/internal::form-string-at-point)) - (lambda (string) - (kill-sexp) - (insert-string (current-point) string) - (indent-buffer (current-buffer))))) + (lisp-eval-async + `(micros:swank-macroexpand-1 + (lem-lisp-mode/internal::form-string-at-point)) + (lambda (string) + (kill-sexp) + (insert-string (current-point) string) + (indent-buffer (current-buffer))))) (define-command lisp-macroexpand () () (check-connection) From 842df6f14d68b63c1e812001ac75ca17cdc84f5f Mon Sep 17 00:00:00 2001 From: cxxxr Date: Fri, 9 Feb 2024 22:31:05 +0900 Subject: [PATCH 4/4] fix indent --- extensions/lisp-mode/macroexpand.lisp | 40 +++++++++++++-------------- 1 file changed, 20 insertions(+), 20 deletions(-) diff --git a/extensions/lisp-mode/macroexpand.lisp b/extensions/lisp-mode/macroexpand.lisp index ded44409c..f01cc3686 100644 --- a/extensions/lisp-mode/macroexpand.lisp +++ b/extensions/lisp-mode/macroexpand.lisp @@ -146,7 +146,7 @@ (backward-up-list point) (skip-chars-backward point #'syntax-expr-prefix-char-p)) (values point - (form-offset (copy-point point :temporary) 1))) + (form-offset (copy-point point :temporary) 1))) (defmacro with-form-points ((start end point) &body body) (check-type start symbol) @@ -223,8 +223,8 @@ "Press \"q\" to undo. Do you want to disable this message in the future?" :gravity (make-instance 'lem/popup-window::gravity-cursor - :offset-x 1 - :offset-y 1)) + :offset-x 1 + :offset-y 1)) (lisp-macrostep-disable-help))))) (defun guard () (error 'read-only-error)) @@ -236,23 +236,23 @@ Do you want to disable this message in the future?" (orig-package-name (buffer-package (current-buffer) "CL-USER")) (p (and self (copy-point (current-point) :temporary)))) (lisp-eval-async `(,expander ,(lem-lisp-mode/internal::form-string-at-point)) - (lambda (string) - (let ((buffer (make-buffer "*lisp-macroexpand*"))) - (with-buffer-read-only buffer nil - (unless self (erase-buffer buffer)) - (change-buffer-mode buffer 'lisp-mode) - (setf (buffer-package buffer) orig-package-name) - (when self - (move-point (current-point) p) - (kill-sexp)) - (insert-string (buffer-point buffer) - string) - (indent-points (buffer-start-point buffer) - (buffer-end-point buffer)) - (with-pop-up-typeout-window (s buffer) - (declare (ignore s))) - (when self - (move-point (buffer-point buffer) p)))))))) + (lambda (string) + (let ((buffer (make-buffer "*lisp-macroexpand*"))) + (with-buffer-read-only buffer nil + (unless self (erase-buffer buffer)) + (change-buffer-mode buffer 'lisp-mode) + (setf (buffer-package buffer) orig-package-name) + (when self + (move-point (current-point) p) + (kill-sexp)) + (insert-string (buffer-point buffer) + string) + (indent-points (buffer-start-point buffer) + (buffer-end-point buffer)) + (with-pop-up-typeout-window (s buffer) + (declare (ignore s))) + (when self + (move-point (buffer-point buffer) p)))))))) (define-command lisp-macroexpand-in-place () () (check-connection)