diff options
| author | Mark Oteiza | 2016-03-31 19:34:05 -0400 |
|---|---|---|
| committer | Mark Oteiza | 2016-03-31 19:34:05 -0400 |
| commit | a3daa34336da158555d96d670077eedb9eaeeb9c (patch) | |
| tree | 8ad1456db0ee56b721cb759d6ae65c68ef998143 | |
| parent | e30c3e9a9cca3ae84d4da132f334f1b8b6df45ac (diff) | |
| download | emacs-a3daa34336da158555d96d670077eedb9eaeeb9c.tar.gz emacs-a3daa34336da158555d96d670077eedb9eaeeb9c.zip | |
Teach M-x disassemble a default argument.
Adopts default argument in the same way as `describe-function'.
* lisp/emacs-lisp/disass.el (disassemble): Default to function at point,
if any.
| -rw-r--r-- | lisp/emacs-lisp/disass.el | 10 |
1 files changed, 7 insertions, 3 deletions
diff --git a/lisp/emacs-lisp/disass.el b/lisp/emacs-lisp/disass.el index e67b0220e14..8506ed69669 100644 --- a/lisp/emacs-lisp/disass.el +++ b/lisp/emacs-lisp/disass.el | |||
| @@ -54,9 +54,13 @@ OBJECT can be a symbol defined as a function, or a function itself | |||
| 54 | \(a lambda expression or a compiled-function object). | 54 | \(a lambda expression or a compiled-function object). |
| 55 | If OBJECT is not already compiled, we compile it, but do not | 55 | If OBJECT is not already compiled, we compile it, but do not |
| 56 | redefine OBJECT if it is a symbol." | 56 | redefine OBJECT if it is a symbol." |
| 57 | (interactive (list (intern (completing-read "Disassemble function: " | 57 | (interactive |
| 58 | obarray 'fboundp t)) | 58 | (let* ((fn (function-called-at-point)) |
| 59 | nil 0 t)) | 59 | (prompt (if fn (format "Disassemble function (default %s): " fn) |
| 60 | "Disassemble function: ")) | ||
| 61 | (def (and fn (symbol-name fn)))) | ||
| 62 | (list (intern (completing-read prompt obarray 'fboundp t nil nil def)) | ||
| 63 | nil 0 t))) | ||
| 60 | (if (and (consp object) (not (functionp object))) | 64 | (if (and (consp object) (not (functionp object))) |
| 61 | (setq object `(lambda () ,object))) | 65 | (setq object `(lambda () ,object))) |
| 62 | (or indent (setq indent 0)) ;Default indent to zero | 66 | (or indent (setq indent 0)) ;Default indent to zero |