emacs - Elisp: make symbol-function return the source? -
here's setup:
(defun square (x) (* x x)) ;; square (symbol-function 'square) ;; (lambda (x) (* x x)) (byte-compile 'square) ;; #[(x) "\211_\207" [x] 2] (symbol-function 'square) ;; #[(x) "\211_\207" [x] 2]
is there way source (lambda (x) (* x x))
after square
has been byte-compiled?
the 2 uses can think of inlining current function call , doing debug-step-in.
i've tried messing find-definition-noselect
source, wonder if there's better way, because raises
(error "don't know ... defined")
emacs keeps track of function name defined in file (this info kept in load-history
). find definition, emacs looks in load-history
, if function listed there, looks corresponding source file , in file looks looks definition of function (using regexps). that's find-definition-noselect
does.
as source code, no in general emacs not keep source definition. if define function cl-defsubst
, source kept around, otherwise isn't. edebugging, having source wouldn't anyway (because edebug needs not source cod precise location of each sub-expression); plain debugging source not needed either (you can click on function's name jump source); inlining source not needed either (the byte-compiler can inline @ source-code level, indeed, can inline @ byte-code level).
Comments
Post a Comment