aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRichard M. Stallman1995-05-07 00:38:42 +0000
committerRichard M. Stallman1995-05-07 00:38:42 +0000
commitbf464fada915b88a6d240be8aa36a76ca85f40f9 (patch)
tree6091afa28407829e99937a0bd2bef5a6e5e3e9d6
parent2af704068fd0969014aa961925178358b1fd11db (diff)
downloademacs-bf464fada915b88a6d240be8aa36a76ca85f40f9.tar.gz
emacs-bf464fada915b88a6d240be8aa36a76ca85f40f9.zip
(pp-eval-expression): Update use of temp-buffer-show-function.
-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 a7dfefb3ba3..d6327d9a7e1 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
103value." 103value."
104 (interactive "xPp-eval: ") 104 (interactive "xPp-eval: ")
105 (setq values (cons (eval expression) values)) 105 (setq values (cons (eval expression) values))
106 (let* ((old-show-hook 106 (let* ((old-show-function temp-buffer-show-function)
107 (or (let ((sym (if (> (string-to-int emacs-version) 18) 107 ;; Use this function to display the buffer.
108 'temp-buffer-show-function 108 ;; This function either decides not to display it at all
109 'temp-buffer-show-hook))) 109 ;; or displays it in the usual way.
110 (and (boundp 'sym) (symbol-value sym))) 110 (temp-buffer-show-function
111 'display-buffer))
112 (temp-buffer-show-hook
113 (function 111 (function
114 (lambda (buf) 112 (lambda (buf)
115 (save-excursion 113 (save-excursion
@@ -118,13 +116,18 @@ value."
118 (end-of-line 1) 116 (end-of-line 1)
119 (if (or (< (1+ (point)) (point-max)) 117 (if (or (< (1+ (point)) (point-max))
120 (>= (- (point) (point-min)) (screen-width))) 118 (>= (- (point) (point-min)) (screen-width)))
121 (progn 119 (let ((temp-buffer-show-function old-show-function)
120 (old-selected (selected-window))
121 (window (display-buffer buf)))
122 (goto-char (point-min)) ; expected by some hooks ... 122 (goto-char (point-min)) ; expected by some hooks ...
123 (funcall old-show-hook buf)) 123 (make-frame-visible (window-frame window))
124 (unwind-protect
125 (progn
126 (select-window window)
127 (run-hooks 'temp-buffer-show-hook))
128 (select-window old-selected)))
124 (message "%s" (buffer-substring (point-min) (point))) 129 (message "%s" (buffer-substring (point-min) (point)))
125 (delete-windows-on buf) ; no need to kill it 130 ))))))
126 )))))
127 (temp-buffer-show-function temp-buffer-show-hook)) ; emacs19 name
128 (with-output-to-temp-buffer "*Pp Eval Output*" 131 (with-output-to-temp-buffer "*Pp Eval Output*"
129 (pp (car values))) 132 (pp (car values)))
130 (save-excursion 133 (save-excursion