]> code.delx.au - gnu-emacs/blobdiff - lisp/progmodes/xscheme.el
Sync Version: headers with -version variables
[gnu-emacs] / lisp / progmodes / xscheme.el
index 217424b9424336c982741b4b3b0a8a9841046a8d..2ad44b4b1c84647b3f6a802b43077e5d78a8cd7f 100644 (file)
@@ -1,7 +1,7 @@
 ;;; xscheme.el --- run MIT Scheme under Emacs
 
-;; Copyright (C) 1986, 1987, 1989, 1990, 2001, 2002, 2003, 2004, 2005,
-;;   2006, 2007, 2008, 2009, 2010  Free Software Foundation, Inc.
+;; Copyright (C) 1986-1987, 1989-1990, 2001-2013 Free Software
+;; Foundation, Inc.
 
 ;; Maintainer: FSF
 ;; Keywords: languages, lisp
@@ -48,7 +48,7 @@
   "Name of xscheme buffer that we're currently interacting with.")
 
 (defvar xscheme-expressions-ring-max 30
-  "*Maximum length of Scheme expressions ring.")
+  "Maximum length of Scheme expressions ring.")
 
 (defvar xscheme-expressions-ring nil
   "List of expressions recently transmitted to the Scheme process.")
@@ -74,7 +74,7 @@ by the scheme process, so additional control-g's are to be ignored.")
 
 (defconst default-xscheme-runlight
   '(": " xscheme-runlight-string)
-  "Default global (shared) xscheme-runlight modeline format.")
+  "Default global (shared) xscheme-runlight mode line format.")
 
 (defvar xscheme-runlight "")
 (defvar xscheme-runlight-string nil)
@@ -116,12 +116,12 @@ from being inserted into the process-buffer.")
   :group 'lisp)
 
 (defcustom scheme-band-name nil
-  "*Band loaded by the `run-scheme' command."
+  "Band loaded by the `run-scheme' command."
   :type '(choice (const nil) string)
   :group 'xscheme)
 
 (defcustom scheme-program-arguments nil
-  "*Arguments passed to the Scheme program by the `run-scheme' command."
+  "Arguments passed to the Scheme program by the `run-scheme' command."
   :type '(choice (const nil) string)
   :group 'xscheme)
 
@@ -186,8 +186,7 @@ With argument, asks for a command line."
   (setq-default xscheme-process-command-line command-line)
   (switch-to-buffer
    (xscheme-start-process command-line process-name buffer-name))
-  (make-local-variable 'xscheme-process-command-line)
-  (setq xscheme-process-command-line command-line))
+  (set (make-local-variable 'xscheme-process-command-line) command-line))
 
 (defun xscheme-read-command-line (arg)
   (let ((default
@@ -278,13 +277,11 @@ With argument, asks for a command line."
                      xscheme-buffer-name
                      t)))
   (let ((process-name (verify-xscheme-buffer buffer-name t)))
-    (make-local-variable 'xscheme-buffer-name)
-    (setq xscheme-buffer-name buffer-name)
-    (make-local-variable 'xscheme-process-name)
-    (setq xscheme-process-name process-name)
-    (make-local-variable 'xscheme-runlight)
-    (setq xscheme-runlight (with-current-buffer buffer-name
-                             xscheme-runlight))))
+    (set (make-local-variable 'xscheme-buffer-name) buffer-name)
+    (set (make-local-variable 'xscheme-process-name) process-name)
+    (set (make-local-variable 'xscheme-runlight)
+         (with-current-buffer buffer-name
+           xscheme-runlight))))
 
 (defun local-clear-scheme-interaction-buffer ()
   "Make the current buffer use the default scheme interaction buffer."
@@ -329,7 +326,7 @@ buffer is not visible at that time, the value will also be displayed
 in the minibuffer.  If an error occurs, the process buffer will
 automatically pop up to show you the error message.
 
-While the Scheme process is running, the modelines of all buffers in
+While the Scheme process is running, the mode lines of all buffers in
 scheme-mode are modified to show the state of the process.  The
 possible states and their meanings are:
 
@@ -337,7 +334,7 @@ input               waiting for input
 run            evaluating
 gc             garbage collecting
 
-The process buffer's modeline contains additional information where
+The process buffer's mode line contains additional information where
 the buffer's name is normally displayed: the command interpreter level
 and type.
 
@@ -386,21 +383,19 @@ Entry to this mode calls the value of scheme-interaction-mode-hook
 with no args, if that value is non-nil.
  Likewise with the value of scheme-mode-hook.
  scheme-interaction-mode-hook is called after scheme-mode-hook."
+  ;; FIXME: Use define-derived-mode.
   (interactive "P")
   (if (not preserve)
       (let ((previous-mode major-mode))
         (kill-all-local-variables)
-        (make-local-variable 'xscheme-previous-mode)
-        (make-local-variable 'xscheme-buffer-name)
         (make-local-variable 'xscheme-process-name)
         (make-local-variable 'xscheme-previous-process-state)
         (make-local-variable 'xscheme-runlight-string)
         (make-local-variable 'xscheme-runlight)
-        (make-local-variable 'xscheme-last-input-end)
-        (setq xscheme-previous-mode previous-mode)
+        (set (make-local-variable 'xscheme-previous-mode) previous-mode)
         (let ((buffer (current-buffer)))
-          (setq xscheme-buffer-name (buffer-name buffer))
-          (setq xscheme-last-input-end (make-marker))
+          (set (make-local-variable 'xscheme-buffer-name) (buffer-name buffer))
+          (set (make-local-variable 'xscheme-last-input-end) (make-marker))
           (let ((process (get-buffer-process buffer)))
             (if process
                 (progn
@@ -409,7 +404,7 @@ with no args, if that value is non-nil.
                         (cons (process-filter process)
                               (process-sentinel process)))
                  (xscheme-process-filter-initialize t)
-                 (xscheme-modeline-initialize xscheme-buffer-name)
+                 (xscheme-mode-line-initialize xscheme-buffer-name)
                  (set-process-sentinel process 'xscheme-process-sentinel)
                  (set-process-filter process 'xscheme-process-filter))
                 (setq xscheme-previous-process-state (cons nil nil)))))))
@@ -420,7 +415,7 @@ with no args, if that value is non-nil.
 (defun exit-scheme-interaction-mode ()
   "Take buffer out of scheme interaction mode"
   (interactive)
-  (if (not (eq major-mode 'scheme-interaction-mode))
+  (if (not (derived-mode-p 'scheme-interaction-mode))
       (error "Buffer not in scheme interaction mode"))
   (let ((previous-state xscheme-previous-process-state))
     (funcall xscheme-previous-mode)
@@ -437,7 +432,7 @@ with no args, if that value is non-nil.
 
 (defun scheme-interaction-mode-initialize ()
   (use-local-map scheme-interaction-mode-map)
-  (setq major-mode 'scheme-interaction-mode)
+  (setq major-mode 'scheme-interaction-mode) ;FIXME: Use define-derived-mode.
   (setq mode-name "Scheme Interaction"))
 
 (defun scheme-interaction-mode-commands (keymap)
@@ -469,8 +464,8 @@ with no args, if that value is non-nil.
 
 (defun xscheme-enter-interaction-mode ()
   (with-current-buffer (xscheme-process-buffer)
-    (if (not (eq major-mode 'scheme-interaction-mode))
-       (if (eq major-mode 'scheme-debugger-mode)
+    (if (not (derived-mode-p 'scheme-interaction-mode))
+       (if (derived-mode-p 'scheme-debugger-mode)
            (scheme-interaction-mode-initialize)
            (scheme-interaction-mode t)))))
 
@@ -494,7 +489,7 @@ Commands:
 
 (defun scheme-debugger-mode-initialize ()
   (use-local-map scheme-debugger-mode-map)
-  (setq major-mode 'scheme-debugger-mode)
+  (setq major-mode 'scheme-debugger-mode) ;FIXME: Use define-derived-mode.
   (setq mode-name "Scheme Debugger"))
 
 (defun scheme-debugger-mode-commands (keymap)
@@ -516,11 +511,11 @@ Commands:
   (interactive)
   (xscheme-send-char last-command-event))
 
-(defun xscheme-enter-debugger-mode (prompt-string)
+(defun xscheme-enter-debugger-mode (_prompt-string)
   (with-current-buffer (xscheme-process-buffer)
-    (if (not (eq major-mode 'scheme-debugger-mode))
+    (if (not (derived-mode-p 'scheme-debugger-mode))
        (progn
-         (if (not (eq major-mode 'scheme-interaction-mode))
+         (if (not (derived-mode-p 'scheme-interaction-mode))
              (scheme-interaction-mode t))
          (scheme-debugger-mode-initialize)))))
 
@@ -528,7 +523,7 @@ Commands:
   (let ((buffer (xscheme-process-buffer)))
     (and buffer
         (with-current-buffer buffer
-          (eq major-mode 'scheme-debugger-mode)))))
+          (derived-mode-p 'scheme-debugger-mode)))))
 \f
 ;;;; Evaluation Commands
 
@@ -550,7 +545,7 @@ The strings are concatenated and terminated by a newline."
 (defun xscheme-send-string-1 (strings)
   (let ((string (apply 'concat strings)))
     (xscheme-send-string-2 string)
-    (if (eq major-mode 'scheme-interaction-mode)
+    (if (derived-mode-p 'scheme-interaction-mode)
        (xscheme-insert-expression string))))
 
 (defun xscheme-send-string-2 (string)
@@ -822,7 +817,7 @@ Control returns to the top level rep loop."
                            xscheme-buffer-name)
                   (set-marker (process-mark process) (point-max))
                   (xscheme-process-filter-initialize t)
-                  (xscheme-modeline-initialize xscheme-buffer-name)
+                  (xscheme-mode-line-initialize xscheme-buffer-name)
                   (set-process-sentinel process 'xscheme-process-sentinel)
                   (set-process-filter process 'xscheme-process-filter)
                   (run-hooks 'xscheme-start-hook)))))
@@ -956,7 +951,7 @@ the remaining input.")
   (if running-p
       (let ((name (buffer-name (current-buffer))))
        (setq scheme-mode-line-process '(": " xscheme-runlight-string))
-       (xscheme-modeline-initialize name)
+       (xscheme-mode-line-initialize name)
        (if (equal name (default-value 'xscheme-buffer-name))
            (setq-default xscheme-runlight default-xscheme-runlight))))
   (if (or (eq xscheme-runlight default-xscheme-runlight)
@@ -1029,8 +1024,7 @@ the remaining input.")
          (xscheme-goto-output-point)
          (let ((old-point (point)))
            (while (string-match "\\(\007\\|\f\\)" string)
-             (let ((start (match-beginning 0))
-                   (end (match-end 0)))
+             (let ((start (match-beginning 0)))
                (insert-before-markers (substring string 0 start))
                (if (= ?\f (aref string start))
                    (progn
@@ -1065,7 +1059,7 @@ the remaining input.")
     (set-buffer (process-buffer process))
     (goto-char (process-mark process))))
 
-(defun xscheme-modeline-initialize (name)
+(defun xscheme-mode-line-initialize (name)
   (setq xscheme-runlight-string "")
   (if (equal name (default-value 'xscheme-buffer-name))
       (setq-default xscheme-runlight-string ""))