From: Chris Hanson Date: Mon, 11 Oct 1993 11:37:49 +0000 (+0000) Subject: Implement SAVE-EXCURSION. X-Git-Tag: 20090517-FFI~7782 X-Git-Url: https://birchwood-abbey.net/git?a=commitdiff_plain;h=99c50bebb576d8e45484e0b106b8e592f60a15a6;p=mit-scheme.git Implement SAVE-EXCURSION. --- diff --git a/v7/src/edwin/curren.scm b/v7/src/edwin/curren.scm index 3180e7f1d..db970fe49 100644 --- a/v7/src/edwin/curren.scm +++ b/v7/src/edwin/curren.scm @@ -1,6 +1,6 @@ ;;; -*-Scheme-*- ;;; -;;; $Id: curren.scm,v 1.109 1993/08/16 08:04:34 cph Exp $ +;;; $Id: curren.scm,v 1.110 1993/10/11 11:37:49 cph Exp $ ;;; ;;; Copyright (c) 1986, 1989-93 Massachusetts Institute of Technology ;;; @@ -506,6 +506,16 @@ The buffer is guaranteed to be selected at that time." (define (current-column) (mark-column (current-point))) + +(define (save-excursion thunk) + (let ((point (mark-left-inserting-copy (current-point))) + (mark (mark-right-inserting-copy (current-mark)))) + (thunk) + (let ((buffer (mark-buffer point))) + (if (buffer-alive? buffer) + (begin + (set-buffer-point! buffer point) + (set-buffer-mark! buffer mark)))))) ;;;; Mark and Region