From f37383237627206f0c802aa4f08228d0c0424ca1 Mon Sep 17 00:00:00 2001 From: "Taylor R. Campbell" Date: Mon, 26 Mar 2007 23:33:48 +0000 Subject: [PATCH] When switching between Inferior REPL and Inferior CMDL modes, adjust the comtabs more carefully, so that only the major modes' comtabs are affected, leaving any minor modes' untouched. This allows minor modes that bind keys to be used in the REPL even after errors occur; before, the keys they bound would be forgotten after errors. Paredit Mode can be now used in the REPL as a result. --- v7/src/edwin/intmod.scm | 19 +++++++++++++++++-- 1 file changed, 17 insertions(+), 2 deletions(-) diff --git a/v7/src/edwin/intmod.scm b/v7/src/edwin/intmod.scm index 48242710e..7896ccde2 100644 --- a/v7/src/edwin/intmod.scm +++ b/v7/src/edwin/intmod.scm @@ -1,6 +1,6 @@ #| -*-Scheme-*- -$Id: intmod.scm,v 1.124 2007/01/05 21:19:23 cph Exp $ +$Id: intmod.scm,v 1.125 2007/03/26 23:33:48 riastradh Exp $ Copyright (C) 1986, 1987, 1988, 1989, 1990, 1991, 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005, @@ -261,11 +261,26 @@ evaluated in the specified inferior REPL buffer." (without-interrupts (lambda () (set-car! (buffer-modes buffer) mode) - (set-buffer-comtabs! buffer (mode-comtabs mode)))) + (switch-comtabs! buffer mode mode*))) (buffer-modeline-event! buffer 'BUFFER-MODES)) (begin (set-buffer-major-mode! buffer mode) (attach-buffer-interface-port! buffer port))))))) + +(define (switch-comtabs! buffer new-mode old-mode) + (let ((comtabs (buffer-comtabs buffer)) + (new-comtabs (mode-comtabs new-mode)) + (old-comtabs (mode-comtabs old-mode))) + (if (eq? comtabs old-comtabs) + (set-buffer-comtabs! buffer new-comtabs) + (let loop ((previous comtabs)) + (let ((comtabs (cdr previous))) + (cond ((eq? comtabs old-comtabs) + (set-cdr! previous new-comtabs)) + ((not (pair? comtabs)) + (warn ";Buffer's comtabs do not match its mode:" buffer)) + (else + (loop comtabs)))))))) (define (attach-buffer-interface-port! buffer port) (if (not (memq buffer repl-buffers)) -- 2.25.1