* Fixed apropos: regexp-exec does not accept symbol arguments any more.
[bpt/guile.git] / ice-9 / emacs.scm
index d814711..850571d 100644 (file)
@@ -1,4 +1,4 @@
-;;;;   Copyright (C) 1996, 1997, 1998 Free Software Foundation, Inc.
+;;;;   Copyright (C) 1996, 1997, 1998, 1999, 2000 Free Software Foundation, Inc.
 ;;;; 
 ;;;; This program is free software; you can redistribute it and/or modify
 ;;;; it under the terms of the GNU General Public License as published by
@@ -32,7 +32,8 @@
 (define-module (ice-9 emacs)
   :use-module (ice-9 debug)
   :use-module (ice-9 threads)
-  :use-module (ice-9 session))
+  :use-module (ice-9 session)
+  :no-backtrace)
 
 (define emacs-escape-character #\sub)
 
                                 (result-to-emacs result)))))
                        (loop (flush-whitespace %%load-port)))
                      (begin
-                       (load-acknowledge))))
-               )
+                       (load-acknowledge)))
+                 (set-port-filename! %%load-port #f))) ;reset port filename
              (lambda (key . args)
+               (set-port-filename! %%load-port #f)
                (cond ((eq? key 'end-of-chunk)
                       (fluid-set! the-last-stack #f)
                       (set! stack-saved? #t)
                       (apply throw key args))))))
 
 (define (emacs-eval-request form)
-  (result-to-emacs (eval form)))
+  (result-to-emacs (eval form (interaction-environment))))
 
 ;;*fixme* Not necessary to use flags no-stack and no-source
 (define (get-frame-source frame)
 
 (define (format template . rest)
   (let loop ((chars (string->list template))
-            (result '()))
+            (result '())
+            (rest rest))
     (cond ((null? chars) (list->string (reverse result)))
          ((char=? (car chars) #\%)
           (loop (cddr chars)
                           (case (cadr chars)
                             ((#\S) (object->string (car rest)))
                             ((#\s) (object->string (car rest) display)))))
-                        result)))
-         (else (loop (cdr chars) (cons (car chars) result))))))
+                        result)
+                (cdr rest)))
+         (else (loop (cdr chars) (cons (car chars) result) rest)))))
 
 (define (error-args->string args)
   (let ((msg (apply format (caddr args) (cadddr args))))
 
 (define (emacs-symdoc symbol)
   (if (or (not (module-bound? (current-module) symbol))
-         (not (procedure? (eval symbol))))
+         (not (procedure? (eval symbol (interaction-environment)))))
       'nil
-      (procedure-documentation (eval symbol))))
+      (procedure-documentation (eval symbol (interaction-environment)))))
 
 ;;; A fix to get the emacs interface to work together with the module system.
 ;;;