xemacs-devel / trace.el

Diff from to

File trace.el

 (defun trace-is-traced (function)
   (ad-find-advice function 'around trace-advice-name))
+;; shamelessly stolen from find-func
+(defun trace-function-read (prompt)
+  "Read and return an interned function symbol.
+Default to the one near point."
+  (let* ((symb (function-at-point))
+	 (enable-recursive-minibuffers t)
+	 (val (completing-read
+	       (format prompt
+		       (if symb (format " (default %s)" symb) ""))
+	       obarray 'fboundp t nil 'function-history)))
+    (if (equal val "") symb (intern val))))
 (defun trace-function (function &optional buffer)
   "Traces FUNCTION with trace output going to BUFFER.
 display oriented stuff, use `trace-function-background' instead."
-    (intern (completing-read "Trace function: " obarray 'fboundp t))
+    (trace-function-read "Trace function%s: ")
     (read-buffer "Output to buffer: " trace-buffer)))
   (trace-function-internal function buffer nil))
 the window or buffer configuration at all."
-    (intern
-     (completing-read "Trace function in background: " obarray 'fboundp t))
+    (trace-function-read "Trace function in background%s: ")
     (read-buffer "Output to buffer: " trace-buffer)))
   (trace-function-internal function buffer t))