;;; ielm.el --- interaction mode for Emacs Lisp
-;; Copyright (C) 1994, 2001-2011 Free Software Foundation, Inc.
+;; Copyright (C) 1994, 2001-2012 Free Software Foundation, Inc.
;; Author: David Smith <maa036@lancaster.ac.uk>
;; Maintainer: FSF
wish to put something like the following in your `.emacs' file:
\(add-hook 'ielm-mode-hook
- '(lambda ()
+ (lambda ()
(define-key ielm-map \"\\C-w\" 'comint-kill-region)
(define-key ielm-map [C-S-backspace]
'comint-kill-whole-line)))
(defvar ielm-input)
-(defun ielm-input-sender (proc input)
+(defun ielm-input-sender (_proc input)
;; Just sets the variable ielm-input, which is in the scope of
;; `ielm-send-input's call.
(setq ielm-input input))
;;; Evaluation
-(defun ielm-eval-input (ielm-string)
- "Evaluate the Lisp expression IELM-STRING, and pretty-print the result."
+(defvar ielm-string)
+(defvar ielm-form)
+(defvar ielm-pos)
+(defvar ielm-result)
+(defvar ielm-error-type)
+(defvar ielm-output)
+(defvar ielm-wbuf)
+(defvar ielm-pmark)
+
+(defun ielm-eval-input (input-string)
+ "Evaluate the Lisp expression INPUT-STRING, and pretty-print the result."
;; This is the function that actually `sends' the input to the
;; `inferior Lisp process'. All comint-send-input does is works out
;; what that input is. What this function does is evaluates that
;;
;; NOTE: all temporary variables in this function will be in scope
;; during the eval, and so need to have non-clashing names.
- (let (ielm-form ; form to evaluate
+ (let ((ielm-string input-string) ; input expression, as a string
+ ielm-form ; form to evaluate
ielm-pos ; End posn of parse in string
ielm-result ; Result, or error message
ielm-error-type ; string, nil if no error
(goto-char ielm-pmark)
(unless ielm-error-type
- (condition-case err
+ (condition-case nil
;; Self-referential objects cause loops in the printer, so
;; trap quits here. May as well do errors, too
(setq ielm-output (concat ielm-output (pp-to-string ielm-result)))
;;; User command
-;;;###autoload (add-hook 'same-window-buffer-names (purecopy "*ielm*"))
-
;;;###autoload
(defun ielm nil
"Interactively evaluate Emacs Lisp expressions.
(with-current-buffer (get-buffer-create "*ielm*")
(unless (zerop (buffer-size)) (setq old-point (point)))
(inferior-emacs-lisp-mode)))
- (pop-to-buffer "*ielm*")
+ (switch-to-buffer "*ielm*")
(when old-point (push-mark old-point))))
(provide 'ielm)