Commit bf464fad authored by Richard M. Stallman's avatar Richard M. Stallman
Browse files

(pp-eval-expression): Update use of temp-buffer-show-function.

parent 2af70406
...@@ -103,13 +103,11 @@ instead. Value is also consed on to front of variable values 's ...@@ -103,13 +103,11 @@ instead. Value is also consed on to front of variable values 's
value." value."
(interactive "xPp-eval: ") (interactive "xPp-eval: ")
(setq values (cons (eval expression) values)) (setq values (cons (eval expression) values))
(let* ((old-show-hook (let* ((old-show-function temp-buffer-show-function)
(or (let ((sym (if (> (string-to-int emacs-version) 18) ;; Use this function to display the buffer.
'temp-buffer-show-function ;; This function either decides not to display it at all
'temp-buffer-show-hook))) ;; or displays it in the usual way.
(and (boundp 'sym) (symbol-value sym))) (temp-buffer-show-function
'display-buffer))
(temp-buffer-show-hook
(function (function
(lambda (buf) (lambda (buf)
(save-excursion (save-excursion
...@@ -118,13 +116,18 @@ value." ...@@ -118,13 +116,18 @@ value."
(end-of-line 1) (end-of-line 1)
(if (or (< (1+ (point)) (point-max)) (if (or (< (1+ (point)) (point-max))
(>= (- (point) (point-min)) (screen-width))) (>= (- (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 ... (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))) (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*" (with-output-to-temp-buffer "*Pp Eval Output*"
(pp (car values))) (pp (car values)))
(save-excursion (save-excursion
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment