From 8e399682a1f6298e1315cf799f30335abac78e4a Mon Sep 17 00:00:00 2001 From: Stefan Monnier Date: Wed, 29 May 2013 11:17:12 -0400 Subject: [PATCH] * lisp/emacs-lisp/trace.el (trace--read-args): Provide a default. --- lisp/ChangeLog | 2 ++ lisp/emacs-lisp/trace.el | 12 +++++++++++- 2 files changed, 13 insertions(+), 1 deletion(-) diff --git a/lisp/ChangeLog b/lisp/ChangeLog index 9c050fa5a01..e4708639514 100644 --- a/lisp/ChangeLog +++ b/lisp/ChangeLog @@ -1,5 +1,7 @@ 2013-05-29 Stefan Monnier + * emacs-lisp/trace.el (trace--read-args): Provide a default. + * emacs-lisp/lisp-mode.el (lisp-mode-shared-map): Inherit from prog-mode-map. diff --git a/lisp/emacs-lisp/trace.el b/lisp/emacs-lisp/trace.el index 42643bf2317..f605c2865c0 100644 --- a/lisp/emacs-lisp/trace.el +++ b/lisp/emacs-lisp/trace.el @@ -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) -- 2.39.2