* lisp/emacs-lisp/trace.el (trace--read-args): Provide a default.

This commit is contained in:
Stefan Monnier 2013-05-29 11:17:12 -04:00
parent 33e249a259
commit 8e399682a1
2 changed files with 13 additions and 1 deletions

View 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.

View 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)