]> git.eshelyaron.com Git - emacs.git/commitdiff
* lisp/emacs-lisp/trace.el (trace--read-args): Provide a default.
authorStefan Monnier <monnier@iro.umontreal.ca>
Wed, 29 May 2013 15:17:12 +0000 (11:17 -0400)
committerStefan Monnier <monnier@iro.umontreal.ca>
Wed, 29 May 2013 15:17:12 +0000 (11:17 -0400)
lisp/ChangeLog
lisp/emacs-lisp/trace.el

index 9c050fa5a0151dede41a542812755da1ef0bb1b3..e4708639514bf3a6b5488060d98d91b96deebf93 100644 (file)
@@ -1,5 +1,7 @@
 2013-05-29  Stefan Monnier  <monnier@iro.umontreal.ca>
 
+       * emacs-lisp/trace.el (trace--read-args): Provide a default.
+
        * emacs-lisp/lisp-mode.el (lisp-mode-shared-map): Inherit from
        prog-mode-map.
 
index 42643bf23172fec684c4c480009e4e97c09646a6..f605c2865c00cf80be8401ded83da98aa585e09b 100644 (file)
@@ -262,7 +262,17 @@ be printed along with the arguments in the trace."
 
 (defun trace--read-args (prompt)
   (cons
-   (intern (completing-read prompt obarray 'fboundp t))
+   (let ((default (function-called-at-point))
+         (beg (string-match ":[ \t]*\\'" prompt)))
+     (intern (completing-read (if default
+                                  (format
+                                   "%s (default %s)%s"
+                                   (substring prompt 0 beg)
+                                   default
+                                   (if beg (substring prompt beg) ": "))
+                                prompt)
+                              obarray 'fboundp t nil nil
+                              (if default (symbol-name default)))))
    (when current-prefix-arg
      (list
       (read-buffer "Output to buffer: " trace-buffer)