Function: disassemble

disassemble is an autoloaded, interactive and byte-compiled function defined in disass.el.gz.

Signature

(disassemble OBJECT &optional BUFFER INDENT INTERACTIVE-P)

Documentation

Print disassembled code for OBJECT in (optional) BUFFER.

OBJECT can be a symbol defined as a function, or a function itself
(a lambda expression or a byte-code-function object).
If OBJECT is not already compiled, we compile it, but do not redefine OBJECT if it is a symbol.

View in manual

Probably introduced at or before Emacs version 18.

Key Bindings

Source Code

;; Defined in /usr/src/emacs/lisp/emacs-lisp/disass.el.gz
;;;###autoload
(defun disassemble (object &optional buffer indent interactive-p)
  "Print disassembled code for OBJECT in (optional) BUFFER.
OBJECT can be a symbol defined as a function, or a function itself
\(a lambda expression or a byte-code-function object).
If OBJECT is not already compiled, we compile it, but do not
redefine OBJECT if it is a symbol."
  (interactive
   (let* ((fn (function-called-at-point))
          (def (and fn (symbol-name fn))))
     (list (intern (completing-read (format-prompt "Disassemble function" fn)
                                    obarray 'fboundp t nil nil def))
           nil 0 t)))
  (let ((lb lexical-binding))
    (when (and (consp object) (not (eq (car object) 'lambda)))
      (setq object
            (if (eq (car object) 'byte-code)
                (apply #'make-byte-code 0 (cdr object))
              `(lambda () ,object))))
    (or indent (setq indent 0))		;Default indent to zero
    (save-excursion
      (if (or interactive-p (null buffer))
	  (with-output-to-temp-buffer "*Disassemble*"
	    (set-buffer standard-output)
            (let ((lexical-binding lb))
	      (disassemble-internal object indent (not interactive-p))))
        (set-buffer buffer)
        (let ((lexical-binding lb))
          (disassemble-internal object indent nil)))))
  nil)