-;;;; Redefine eval-region, and subroutines that use it, in Lisp
+;;; eval-reg.el --- Redefine eval-region, and subrs that use it, in Lisp
+
;; Copyright (C) 1994 Daniel LaLiberte
-;; This file is not part of GNU Emacs.
+;; Author: Daniel LaLiberte <liberte@cs.uiuc.edu>
+;; Keywords: lisp
+
+;; This file is part of GNU Emacs.
;; GNU Emacs is free software; you can redistribute it and/or modify
;; it under the terms of the GNU General Public License as published by
-;; the Free Software Foundation; either version 1, or (at your option)
+;; the Free Software Foundation; either version 2, or (at your option)
;; any later version.
;; GNU Emacs is distributed in the hope that it will be useful,
;;; that replaces Emacs Lisp subroutines with Lisp versions of the
;;; same.
-;;;; Installation
-;;; =============
-
;;; Eval-region may be installed, after loading, by calling:
-;;; (install-eval-region). Installation can be undone with:
-;;; (uninstall-eval-region).
+;;; (elisp-eval-region-install). Installation can be undone with:
+;;; (elisp-eval-region-uninstall).
'(defpackage "elisp-eval-region"
(:nicknames "elisp")
(:use "elisp")
(:export
- install-elisp-eval-region
- uninstall-elisp-eval-region
+ elisp-eval-region-install
+ elisp-eval-region-uninstall
elisp-eval-region-level
with-elisp-eval-region
+ eval-region
+ eval-buffer
+ eval-current-buffer
))
'(in-package elisp-eval-region)
(symbol-function 'eval-current-buffer)))
(defvar elisp-eval-region-level 0
- "If the value is 0, use the original version of elisp-eval-region.
-Callers of elisp-eval-region should increment elisp-eval-region-level
-while the Lisp version should be used. Installing elisp-eval-region
+ "If the value is 0, use the original version of `elisp-eval-region'.
+Callers of `elisp-eval-region' should increment `elisp-eval-region-level'
+while the Lisp version should be used. Installing `elisp-eval-region'
increments it once, and uninstalling decrements it.")
-;; These two should always be used in pairs, or just install once and
-;; never uninstall.
-(defun install-elisp-eval-region ()
+;; Installing and uninstalling should always be used in pairs,
+;; or just install once and never uninstall.
+(defun elisp-eval-region-install ()
(interactive)
(defalias 'eval-region 'elisp-eval-region)
(defalias 'eval-buffer 'elisp-eval-buffer)
(defalias 'eval-current-buffer 'elisp-eval-current-buffer)
(setq elisp-eval-region-level (1+ elisp-eval-region-level)))
-(defun uninstall-elisp-eval-region ()
+(defun elisp-eval-region-uninstall ()
(interactive)
(if (> 1 elisp-eval-region-level)
(setq elisp-eval-region-level (1- elisp-eval-region-level))
(put 'with-elisp-eval-region 'edebug-form-spec t)
(defmacro with-elisp-eval-region (flag &rest body)
- "If FLAG is nil, decrement eval-region-level while executing BODY.
+ "If FLAG is nil, decrement `eval-region-level' while executing BODY.
The effect of decrementing all the way to zero is that `eval-region'
-will use the original eval-region, which may be the Emacs subr or some
+will use the original `eval-region', which may be the Emacs subr or some
previous redefinition. Before calling this macro, this package should
-already have been installed, using `install-elisp-eval-region', which
+already have been installed, using `elisp-eval-region-install', which
increments the count once. So if another package still requires the
-elisp version of the code, the count will still be non-zero.
+Lisp version of the code, the count will still be non-zero.
The count is not bound locally by this macro, so changes by BODY to
its value will not be lost."
Programs can pass third argument PRINTFLAG which controls printing of output:
nil means discard it; anything else is stream for print.
-This version, from eval-region, allows Lisp customization of read,
+This version, from `eval-reg.el', allows Lisp customization of read,
eval, and the printer."
;; Because this doesnt narrow to the region, one other difference
Programs can pass argument PRINTFLAG which controls printing of output:
nil means discard it; anything else is stream for print.
-This version from eval-region calls `eval-region' on the whole buffer."
+This version calls `eval-region' on the whole buffer."
;; The standard eval-current-buffer doesn't use eval-region.
(interactive)
(eval-region (point-min) (point-max) elisp-output))
Programs can pass argument PRINTFLAG which controls printing of
output: nil means discard it; anything else is stream for print.
-This version from eval-region calls `eval-region' on the whole buffer."
+This version calls `eval-region' on the whole buffer."
(interactive)
(if (null elisp-bufname)
(setq elisp-bufname (current-buffer)))
(eval-region (point-min) (point-max) elisp-printflag)))
-(provide 'elisp-eval-region)
+(provide 'eval-reg)
+