aboutsummaryrefslogtreecommitdiffstats
path: root/lisp
diff options
context:
space:
mode:
authorRichard M. Stallman <[email protected]>1995-05-07 00:38:42 +0000
committerRichard M. Stallman <[email protected]>1995-05-07 00:38:42 +0000
commitbf464fada915b88a6d240be8aa36a76ca85f40f9 (patch)
tree6091afa28407829e99937a0bd2bef5a6e5e3e9d6 /lisp
parent2af704068fd0969014aa961925178358b1fd11db (diff)
(pp-eval-expression): Update use of temp-buffer-show-function.
Diffstat (limited to 'lisp')
-rw-r--r--lisp/emacs-lisp/pp.el27
1 files changed, 15 insertions, 12 deletions
diff --git a/lisp/emacs-lisp/pp.el b/lisp/emacs-lisp/pp.el
index a7dfefb3ba..d6327d9a7e 100644
--- a/lisp/emacs-lisp/pp.el
+++ b/lisp/emacs-lisp/pp.el
@@ -103,13 +103,11 @@ instead. Value is also consed on to front of variable values 's
value."
(interactive "xPp-eval: ")
(setq values (cons (eval expression) values))
- (let* ((old-show-hook
- (or (let ((sym (if (> (string-to-int emacs-version) 18)
- 'temp-buffer-show-function
- 'temp-buffer-show-hook)))
- (and (boundp 'sym) (symbol-value sym)))
- 'display-buffer))
- (temp-buffer-show-hook
+ (let* ((old-show-function temp-buffer-show-function)
+ ;; Use this function to display the buffer.
+ ;; This function either decides not to display it at all
+ ;; or displays it in the usual way.
+ (temp-buffer-show-function
(function
(lambda (buf)
(save-excursion
@@ -118,13 +116,18 @@ value."
(end-of-line 1)
(if (or (< (1+ (point)) (point-max))
(>= (- (point) (point-min)) (screen-width)))
- (progn
+ (let ((temp-buffer-show-function old-show-function)
+ (old-selected (selected-window))
+ (window (display-buffer buf)))
(goto-char (point-min)) ; expected by some hooks ...
- (funcall old-show-hook buf))
+ (make-frame-visible (window-frame window))
+ (unwind-protect
+ (progn
+ (select-window window)
+ (run-hooks 'temp-buffer-show-hook))
+ (select-window old-selected)))
(message "%s" (buffer-substring (point-min) (point)))
- (delete-windows-on buf) ; no need to kill it
- )))))
- (temp-buffer-show-function temp-buffer-show-hook)) ; emacs19 name
+ ))))))
(with-output-to-temp-buffer "*Pp Eval Output*"
(pp (car values)))
(save-excursion