From 99c50bebb576d8e45484e0b106b8e592f60a15a6 Mon Sep 17 00:00:00 2001 From: Chris Hanson Date: Mon, 11 Oct 1993 11:37:49 +0000 Subject: [PATCH] Implement SAVE-EXCURSION. --- v7/src/edwin/curren.scm | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) 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 -- 2.25.1