summaryrefslogtreecommitdiff
path: root/lisp/emacs-lisp
diff options
context:
space:
mode:
authorStefan Monnier <monnier@iro.umontreal.ca>2013-05-06 18:33:24 -0400
committerStefan Monnier <monnier@iro.umontreal.ca>2013-05-06 18:33:24 -0400
commitee6cff992302d80b9cbb0889725066c485dbf265 (patch)
treee47dad72e379c4e27f3bb6b15dae371113cc12d9 /lisp/emacs-lisp
parent32985194f2370621bc2178f94d6cae0cf01d1702 (diff)
downloademacs-ee6cff992302d80b9cbb0889725066c485dbf265.tar.gz
emacs-ee6cff992302d80b9cbb0889725066c485dbf265.tar.bz2
emacs-ee6cff992302d80b9cbb0889725066c485dbf265.zip
* lisp/emacs-lisp/trace.el (trace--display-buffer): New function.
(trace-make-advice): Use it.
Diffstat (limited to 'lisp/emacs-lisp')
-rw-r--r--lisp/emacs-lisp/trace.el24
1 files changed, 14 insertions, 10 deletions
diff --git a/lisp/emacs-lisp/trace.el b/lisp/emacs-lisp/trace.el
index fce8643923f..42643bf2317 100644
--- a/lisp/emacs-lisp/trace.el
+++ b/lisp/emacs-lisp/trace.el
@@ -200,6 +200,18 @@ some global variables)."
(defvar trace--timer nil)
+(defun trace--display-buffer (buf)
+ (unless (or trace--timer
+ (get-buffer-window buf 'visible))
+ (setq trace--timer
+ ;; Postpone the display to some later time, in case we
+ ;; can't actually do it now.
+ (run-with-timer 0 nil
+ (lambda ()
+ (setq trace--timer nil)
+ (display-buffer buf nil 0))))))
+
+
(defun trace-make-advice (function buffer background context)
"Build the piece of advice to be added to trace FUNCTION.
FUNCTION is the name of the traced function.
@@ -214,15 +226,7 @@ be printed along with the arguments in the trace."
(unless inhibit-trace
(with-current-buffer trace-buffer
(set (make-local-variable 'window-point-insertion-type) t)
- (unless (or background trace--timer
- (get-buffer-window trace-buffer 'visible))
- (setq trace--timer
- ;; Postpone the display to some later time, in case we
- ;; can't actually do it now.
- (run-with-timer 0 nil
- (lambda ()
- (setq trace--timer nil)
- (display-buffer trace-buffer)))))
+ (unless background (trace--display-buffer trace-buffer))
(goto-char (point-max))
;; Insert a separator from previous trace output:
(if (= trace-level 1) (insert trace-separator))
@@ -235,7 +239,7 @@ be printed along with the arguments in the trace."
(unless inhibit-trace
(let ((ctx (funcall context)))
(with-current-buffer trace-buffer
- (unless background (display-buffer trace-buffer))
+ (unless background (trace--display-buffer trace-buffer))
(goto-char (point-max))
(insert
(trace-exit-message