[slime-cvs] CVS slime

mkoeppe mkoeppe at common-lisp.net
Thu Dec 28 14:14:48 UTC 2006


Update of /project/slime/cvsroot/slime
In directory clnet:/tmp/cvs-serv13966

Modified Files:
	slime.el 
Log Message:
(slime-repl-mode-beginning-of-defun)
(slime-repl-mode-end-of-defun): New.
(slime-repl-mode): Use them as beginning-of-defun-function and
end-of-defun-function.
(slime-enclosing-operator-names): Bind
parse-sexp-lookup-properties to nil, don't parse more than 20000
characters before point, don't determine exact argument positions
larger than 64.  Byte-compile this function.


--- /project/slime/cvsroot/slime/slime.el	2006/12/24 13:44:11	1.725
+++ /project/slime/cvsroot/slime/slime.el	2006/12/28 14:14:46	1.726
@@ -3227,8 +3227,21 @@
   (when slime-repl-enable-presentations 
     ;; Respect the syntax text properties of presentations.
     (set (make-local-variable 'parse-sexp-lookup-properties) t))
+  ;; We only want REPL prompts as start of the "defun".
+  (set (make-local-variable 'beginning-of-defun-function) 
+       'slime-repl-mode-beginning-of-defun)
+  (set (make-local-variable 'end-of-defun-function) 
+       'slime-repl-mode-end-of-defun)
   (run-hooks 'slime-repl-mode-hook))
 
+(defun slime-repl-mode-beginning-of-defun ()
+  (slime-repl-previous-prompt)
+  t)
+
+(defun slime-repl-mode-end-of-defun ()
+  (slime-repl-next-prompt)
+  t)
+
 (defun slime-presentation-whole-p (presentation start end &optional object)
   (let ((object (or object (current-buffer))))
     (string= (etypecase object
@@ -10892,12 +10905,20 @@
 levels of parens."
   (let ((result '())
         (arg-indices '())
-        (level 1))
+        (level 1)
+        (parse-sexp-lookup-properties nil)) 
+    ;; The expensive lookup of syntax-class text properties is only
+    ;; used for interactive balancing of #<...> in presentations; we
+    ;; do not need them in navigating through the nested lists.
+    ;; This speeds up this function significantly.
     (ignore-errors
       (save-excursion
         ;; Make sure we get the whole operator name.
         (slime-end-of-symbol)
         (save-restriction
+          ;; Don't parse more than 20000 characters before point, so we don't spend
+          ;; too much time.
+          (narrow-to-region (max (point-min) (- (point) 20000)) (point-max))
           (narrow-to-region (save-excursion (beginning-of-defun) (point))
                             (min (1+ (point)) (point-max)))
           (while (or (not max-levels)
@@ -10910,8 +10931,9 @@
                   (incf arg-index))
               (ignore-errors
                 (backward-sexp 1))
-              (while (ignore-errors (backward-sexp 1) 
-                                    (> (point) (point-min)))
+              (while (and (< arg-index 64)
+                          (ignore-errors (backward-sexp 1) 
+                                         (> (point) (point-min))))
                 (incf arg-index))
               (backward-up-list 1)
               (when (member (char-syntax (char-after)) '(?\( ?')) 
@@ -11243,7 +11265,8 @@
           slime-print-apropos
           slime-show-note-counts
           slime-insert-propertized
-          slime-tree-insert)))
+          slime-tree-insert
+          slime-enclosing-operator-names)))
 
 (run-hooks 'slime-load-hook)
 




More information about the slime-cvs mailing list