[slime-devel] M-. errs on SBCL functions
Stelian Ionescu
sionescu at common-lisp.net
Fri Sep 7 02:18:17 UTC 2007
With latest slime, when doing M-.(slime-edit-definition) on SBCL
functions like SB-SYS:SERVE-EVENT I get this error message:
slime-goto-location-position: Invalid function: save-restriction-if-possible
this is because the macro `save-restriction-if-possible' is defined
after `slime-goto-location-position' and, when byte-compiling slime.el, it
breaks.
I've attached a patch that moves `save-restriction-if-possible' right
before `slime-goto-location-position'
--
Stelian Ionescu a.k.a. fe[nl]ix
Quidquid latine dictum sit, altum videtur.
-------------- next part --------------
Index: slime.el
===================================================================
RCS file: /project/slime/cvsroot/slime/slime.el,v
retrieving revision 1.851
diff -u -r1.851 slime.el
--- slime.el 6 Sep 2007 21:22:19 -0000 1.851
+++ slime.el 7 Sep 2007 01:58:16 -0000
@@ -4570,6 +4570,39 @@
(set-buffer buffer)
(goto-char (point-min))))))
+(defmacro save-restriction-if-possible (&rest body)
+ "Very similiarly to `save-restriction'. The only difference is
+that it's not enforcing the restriction as strictly: It's only
+enforced if `point' was not moved outside of the restriction
+after executing BODY.
+
+Example:
+
+ (progn (goto-line 1000)
+ (narrow-to-page)
+ (save-restriction-if-possible (widen) (goto-line 999)))
+
+ In this case, the buffer is narrowed to the current page, and
+ point is on line 999.
+
+ (progn (goto-char 1000)
+ (narrow-to-page)
+ (save-restriction-if-possible (widen) (goto-line 1)))
+
+ Whereas in this case, the buffer is widened and point is on
+ line 1."
+ (let ((gcfg (gensym "NARROWING-CFG+"))
+ (gbeg (gensym "OLDBEG+"))
+ (gend (gensym "OLDEND+")))
+ `(let ((,gcfg (slime-current-narrowing-configuration)))
+ (unwind-protect (progn , at body)
+ (let ((,gbeg (slime-narrowing-configuration.beg ,gcfg))
+ (,gend (slime-narrowing-configuration.end ,gcfg)))
+ (when (and (>= (point) ,gbeg) (<= (point) ,gend))
+ (slime-set-narrowing-configuration ,gcfg)))))))
+
+(put 'save-restriction-if-possible 'lisp-indent-function 0)
+
(defun slime-goto-location-position (position)
(save-restriction-if-possible ; try to keep restriction if possible.
(widen)
@@ -8998,39 +9031,6 @@
(total (buffer-size)))
(or (/= beg 1) (/= end (1+ total))))))
-(defmacro save-restriction-if-possible (&rest body)
- "Very similiarly to `save-restriction'. The only difference is
-that it's not enforcing the restriction as strictly: It's only
-enforced if `point' was not moved outside of the restriction
-after executing BODY.
-
-Example:
-
- (progn (goto-line 1000)
- (narrow-to-page)
- (save-restriction-if-possible (widen) (goto-line 999)))
-
- In this case, the buffer is narrowed to the current page, and
- point is on line 999.
-
- (progn (goto-char 1000)
- (narrow-to-page)
- (save-restriction-if-possible (widen) (goto-line 1)))
-
- Whereas in this case, the buffer is widened and point is on
- line 1."
- (let ((gcfg (gensym "NARROWING-CFG+"))
- (gbeg (gensym "OLDBEG+"))
- (gend (gensym "OLDEND+")))
- `(let ((,gcfg (slime-current-narrowing-configuration)))
- (unwind-protect (progn , at body)
- (let ((,gbeg (slime-narrowing-configuration.beg ,gcfg))
- (,gend (slime-narrowing-configuration.end ,gcfg)))
- (when (and (>= (point) ,gbeg) (<= (point) ,gend))
- (slime-set-narrowing-configuration ,gcfg)))))))
-
-(put 'save-restriction-if-possible 'lisp-indent-function 0)
-
;;;;; Extracting Lisp forms from the buffer or user
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 189 bytes
Desc: not available
URL: <https://mailman.common-lisp.net/pipermail/slime-devel/attachments/20070907/2cddea24/attachment.sig>
More information about the slime-devel
mailing list