[slime-cvs] CVS slime/contrib

CVS User trittweiler trittweiler at common-lisp.net
Sat Jul 4 09:54:17 UTC 2009


Update of /project/slime/cvsroot/slime/contrib
In directory cl-net:/tmp/cvs-serv24282/contrib

Modified Files:
	ChangeLog slime-fontifying-fu.el 
Log Message:
	Fix font-lock magic for s-code.lisp in the series package.

	* slime-fontifying-fu.el (slime-beginning-of-tlf): Use
	`syntax-ppss-toplevel-pos' on GNU Emacs. Old definition is
	retained for systems where it's not available. Also wrap an
	`ignore-errors' around the call to `up-list' in the old definition
	to guard against unbalanced parentheses.

	Reported by Stelian Ionescu, Raymond Toy.


--- /project/slime/cvsroot/slime/contrib/ChangeLog	2009/07/02 17:00:25	1.221
+++ /project/slime/cvsroot/slime/contrib/ChangeLog	2009/07/04 09:54:16	1.222
@@ -1,3 +1,15 @@
+2009-07-04  Tobias C. Rittweiler  <tcr at freebits.de>
+
+	Fix font-lock magic for s-code.lisp in the series package.
+
+	* slime-fontifying-fu.el (slime-beginning-of-tlf): Use
+	`syntax-ppss-toplevel-pos' on GNU Emacs. Old definition is
+	retained for systems where it's not available. Also wrap an
+	`ignore-errors' around the call to `up-list' in the old definition
+	to guard against unbalanced parentheses.
+
+	Reported by Stelian Ionescu, Raymond Toy.
+
 2009-07-02  Stas Boukarev  <stassats at gmail.com>
 
 	* slime-repl.el (slime-repl-delete-current-input): Make it interactive.
--- /project/slime/cvsroot/slime/contrib/slime-fontifying-fu.el	2009/06/21 12:18:25	1.13
+++ /project/slime/cvsroot/slime/contrib/slime-fontifying-fu.el	2009/07/04 09:54:16	1.14
@@ -145,19 +145,25 @@
                 "Further: font-lock-beg=%d, font-lock-end=%d.")
         c font-lock-beg font-lock-end)))))
 
-(defun slime-beginning-of-tlf ()
-  (let* ((state (slime-current-parser-state))
-         (comment-start (nth 8 state)))
-    (when comment-start                 ; or string
-      (goto-char comment-start)
-      (setq state (slime-current-parser-state)))
-    (let ((depth (nth 0 state)))
-      (if (plusp depth)
-          (up-list (- depth))
-          (when-let (upper-pt (nth 1 state)) 
-            (goto-char upper-pt)
-            (while (when-let (upper-pt (nth 1 (slime-current-parser-state)))
-                     (goto-char upper-pt))))))))
+(when (fboundp 'syntax-ppss-toplevel-pos)
+  (defun slime-beginning-of-tlf ()
+    (when-let (pos (syntax-ppss-toplevel-pos (slime-current-parser-state)))
+      (goto-char pos))))
+
+(unless (fboundp 'syntax-ppss-toplevel-pos)
+  (defun slime-beginning-of-tlf ()
+    (let* ((state (slime-current-parser-state))
+           (comment-start (nth 8 state)))
+      (when comment-start               ; or string
+        (goto-char comment-start)
+        (setq state (slime-current-parser-state)))
+      (let ((depth (nth 0 state)))
+        (when (plusp depth)
+          (ignore-errors (up-list (- depth)))) ; ignore unbalanced parentheses
+        (when-let (upper-pt (nth 1 state)) 
+          (goto-char upper-pt)
+          (while (when-let (upper-pt (nth 1 (slime-current-parser-state)))
+                   (goto-char upper-pt))))))))
 
 (defun slime-compute-region-for-font-lock (orig-beg orig-end)
   (let ((beg orig-beg)
@@ -175,8 +181,6 @@
                            (point)))))
     (values (or (/= beg orig-beg) (/= end orig-end)) beg end)))
 
-
-
 
 
 (defun slime-activate-font-lock-magic ()





More information about the slime-cvs mailing list