Anonymous avatar Anonymous committed d7217f1

Applied Christopf Wedler's patch from
<FAFE609CB754D311B60C0008C75D35563BDC72@dbwdfx14.wdf.sap-ag.de>;
with subject " trace.el: default arg for trace functions"

Comments (0)

Files changed (2)

+1998-09-28  Christoph Wedler  <wedler@fmi.uni-passau.de>
+
+	* trace.el (trace-function-read): New function.
+	(trace-function): Use it.
+	(trace-function-background): Use it.
+
 1999-05-28  Karl M. Hegbloom  <karlheg@debian.org>
 
 	* hide-copyleft.el: Get rid of `more-copylefts-to-hide', and just
 (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))))
+
+
 ;;;###autoload
 (defun trace-function (function &optional buffer)
   "Traces FUNCTION with trace output going to BUFFER.
 display oriented stuff, use `trace-function-background' instead."
   (interactive
    (list
-    (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."
   (interactive
    (list
-    (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))
 
Tip: Filter by directory path e.g. /media app.js to search for public/media/app.js.
Tip: Use camelCasing e.g. ProjME to search for ProjectModifiedEvent.java.
Tip: Filter by extension type e.g. /repo .js to search for all .js files in the /repo directory.
Tip: Separate your search with spaces e.g. /ssh pom.xml to search for src/ssh/pom.xml.
Tip: Use ↑ and ↓ arrow keys to navigate and return to view the file.
Tip: You can also navigate files with Ctrl+j (next) and Ctrl+k (previous) and view the file with Ctrl+o.
Tip: You can also navigate files with Alt+j (next) and Alt+k (previous) and view the file with Alt+o.