[slime-devel] suggestion: make applying indent-sexp to results of macroexpansion optional

michaelawells michaelawells at gmail.com
Fri Sep 24 04:32:40 UTC 2010


In some cases, "indent-sexp" can be very slow, particularly when it is used on complex "macroexpanded" expressions.

In my case, it takes 43 seconds to apply "indent-sexp" to a buffer of ~6000 lines.  (I measured this using the elp package.  

The expression produced by SBCL and Allegro is already nicely formatted, so I would prefer not to display the result as formatted, rather than wait.

So, I suggest adding an option to slime.el called "slime-indent-sexp-after-macroexpand", which would allow "indent-sexp" to be disabled.


--- slime.el	22 Sep 2010 19:17:35 -0000	1.1340
+++ slime.el	24 Sep 2010 04:23:29 -0000
@@ -150,6 +150,13 @@
  :prefix "slime-"
  :group 'slime)

+(defcustom slime-indent-sexp-after-macroexpand t
+  "Perform 'indent-sexp' before presenting results of macroexpansion.  
+If disabled, macroexpansion will be presented as formated by the Lisp
+in use."
+  :type 'boolean
+  :group 'slime-ui)
+
(defcustom slime-truncate-lines t
  "Set `truncate-lines' in popup buffers.
This applies to buffers that present lines as rows of data, such as
@@ -4942,7 +4949,7 @@
    (erase-buffer)
    (insert expansion)
    (goto-char (point-min))
-    (indent-sexp)
+    (when slime-indent-sexp-after-macroexpand (indent-sexp))
    (font-lock-fontify-buffer)))

(defun slime-create-macroexpansion-buffer ()
@@ -4976,8 +4983,8 @@
             (goto-char start)
             (delete-region start end)
             (insert expansion)
-             (goto-char start)
-             (indent-sexp)
+             (goto-char start)            
+             (when slime-indent-sexp-after-macroexpand (indent-sexp))
             (goto-char point))))))))

(defun slime-macroexpand-1 (&optional repeatedly)





More information about the slime-devel mailing list