[slime-cvs] CVS update: slime/swank.lisp slime/swank-backend.lisp slime/slime.el
Luke Gorrie
lgorrie at common-lisp.net
Sun Jul 4 03:21:43 UTC 2004
Update of /project/slime/cvsroot/slime
In directory common-lisp.net:/tmp/cvs-serv24608
Modified Files:
swank.lisp swank-backend.lisp slime.el
Log Message:
Added a new backend function `buffer-first-change' which is called via
Emacs's `first-change-hook' in slime-mode buffers. This gives Lisp a
chance to do something with source files before you change them on
disk.
Date: Sat Jul 3 20:21:43 2004
Author: lgorrie
Index: slime/swank.lisp
diff -u slime/swank.lisp:1.208 slime/swank.lisp:1.209
--- slime/swank.lisp:1.208 Sat Jul 3 17:20:36 2004
+++ slime/swank.lisp Sat Jul 3 20:21:43 2004
@@ -30,6 +30,7 @@
#:*readtable-alist*
#:*globally-redirect-io*
;; These are re-exported directly from the backend:
+ #:buffer-first-change
#:frame-source-location-for-emacs
#:restart-frame
#:sldb-step
Index: slime/swank-backend.lisp
diff -u slime/swank-backend.lisp:1.60 slime/swank-backend.lisp:1.61
--- slime/swank-backend.lisp:1.60 Sat Jul 3 17:19:07 2004
+++ slime/swank-backend.lisp Sat Jul 3 20:21:43 2004
@@ -440,6 +440,10 @@
LOCATION is the source location for the definition.")
+(definterface buffer-first-change (filename)
+ "Called for effect the first time FILENAME's buffer is modified."
+ nil)
+
;;;; XREF
Index: slime/slime.el
diff -u slime/slime.el:1.355 slime/slime.el:1.356
--- slime/slime.el:1.355 Fri Jul 2 17:01:40 2004
+++ slime/slime.el Sat Jul 3 20:21:43 2004
@@ -4536,6 +4536,22 @@
name
(slime-buffer-package)))
+;;;;; first-change-hook
+
+(defun slime-first-change-hook ()
+ "Notify Lisp that a source file's buffer has been modified."
+ (when (and (buffer-file-name)
+ (slime-connected-p))
+ (let ((filename (slime-to-lisp-filename (buffer-file-name))))
+ (slime-eval-async `(swank:buffer-first-change ,filename)
+ nil (lambda (v) nil)))))
+
+(defun slime-setup-first-change-hook ()
+ (add-hook (make-local-variable 'first-change-hook)
+ 'slime-first-change-hook))
+
+(add-hook 'slime-mode-hook 'slime-setup-first-change-hook)
+
;;; `ED'
More information about the slime-cvs
mailing list