From: Bill Dubuque

Subject: problems with editi acl-eval-defun

Date: 1996-5-31 19:26

SUMMARY: No bug, just a misunderstanding. 
	 A patch is provided for desired functionality.

  Date: Fri, 31 May 1996 14:55:25 -0700 (PDT)
  From: David Lim <ndc.com at david>

  ONE LINE SUMMARY: acl-eval-defun stops working after two commands

  I hit C-M-x on ... and I get the following in the *Lisp Log* buffer: ...

  Then I hit C-M-x on ... and get no response in the *Lisp Log* buffer. 

acl-eval-defun does not display the result of evaluating a defun
since normally one doesn't care to see it. It will however display
any output that results from evaluating the defun since this usually
indicates an error or warning, as in your first case above.

Indeed it is useful to have an analogous command that evaluates
a sexp and displays the result along with any and all output 
(vs. C-Ret which inserts such into the buffer). This functionality
is already implemented for Editi 1.4 and I've provided it as 
an Editi 1.3 patch below.

  I notice the following message comes up in the ACL/Win status bar:

  DDE command "(let ((*standard-output* ...)))"

This shouldn't be happening since Editi explictly patches ACL
DDE code to suppress this useless message. Perhaps Franz has
changed the DDE code since Editi 1.3. In any case, its harmless 
(although annoying, and it will slow down remote eval commands
slightly). Does it occur after every Editi remote eval command 
(or only after the first command)?

-Bill

This patch provides the following functionality:

C-Sh-e = acl-eval-sexp:

 Evaluate the sexp containing point. If the region is active then
 the region is used as sexp, else sexp is chosen as the innermost list
 containing point. With an argument, sexp is read from the minibuffer.
 The result and all output produced during the evaluation will be 
 inserted into the *Lisp Log* buffer and then displayed in a transient 
 popup window, whose display may be toggled on/off via the command C-*.

M-Sh-e = acl-eval-region-or-defun:

 Evaluate the toplevel form containing point (or the region if it is
 active). Any output produced during the evaluation will be inserted 
 into the *Lisp Log* buffer and then displayed in a popup window, 
 whose display may be toggled on/off via the command C-*.
 The evaluation result is not displayed. This command is usually
 employed when evaluating a top-level form whose result is not
 interesting, e.g. a defun. The popup window is not transient since
 it usually indicates an error or warning -- it would be incorrect
 for typeahead to dismiss such. You must explicitly type C-* to
 take down the *Lisp Log* output window.

Above "transient" means the popup window goes away as soon as you type
anything else. You can recall/toggle the display of the prior output
with C-* (i.e. C-Sh-8), see section [12] in the Editi README.TXT.

Additionally, this patch extends acl-macroexpand (= C-Sh-m) to also
use any region if active (vs. the sexp at point).

*** IMPORTANT ***  Apply this patch only by inserting the following
code into EVAL-ED.EL in Editi 1.3. DO NOT place this code in your 
init file or anywhere else (doing such would most likely break future
releases of Editi). The next time you load Editi it will automatically
recompile EVAL-ED.EL, or you can do this in the current session via
M-x byte-compile-and-load-file Ret editi.el Ret

;;; Replace the existing def of acl-sexp-at-point with these 2 forms.

(defun acl-sexp-at-point ()
  ;; catch "Unbalanced parentheses" error moving up-list or forward-sexp
  (condition-case ()
      (or (let ((start (zregion-beginning))
		(end   (zregion-end)))
	    (and zmacs-regions
		 (mark) 	;; when zmacs-regions, true iff region active 
		 start end
		 (buffer-substring start end)))
	  (save-excursion
	    (if (looking-at "\\s *\(")
		(goto-char (1- (match-end 0)))
	      (backward-up-list 1))
	    (buffer-substring (point)
			      (progn (forward-sexp 1)
				     (point)))))
    (error nil)))

(defun acl-eval-sexp (sexp)
  (interactive (list (acl-read-sexp-as-string "CL eval: "
					      (null current-prefix-arg))))
  (acl-symbol-operation sexp "eval"))

;;; Replace the following line in EVAL-ED.EL with these 2 forms
;;; (define-key lisp-mode-map '(control E) 'acl-eval-region-or-defun)

(define-key lisp-mode-map '(meta    E) 'acl-eval-region-or-defun)
(define-key lisp-mode-map '(control E) 'acl-eval-sexp)