libjit
, lightning
— works off of Bytecode
ELISP> (functionp 5)
nil
ELISP> (functionp (lambda(x) x))
t
plus symbol-function and funcall
ELISP> (symbol-function (lambda(x) x))
(lambda (x) x)
ELISP> (setq rocky-identity (lambda(x) x))
(lambda (x) x)
ELISP> (symbol-function rocky-identity)
(lambda (x) x)
ELISP> (funcall rocky-identity 5)
5 (#o5, #x5, ?\C-e)
ELISP> (byte-compile rocky-identity)
#[(x)
"^H\207"
[x]
1]
ELISP> (aref rocky-identity 2) ;; just the byte string
"^H\207"
ELISP> (functionp rocky-identity)
t
ELISP> (funcall rocky-identity 5)
5 (#o5, #x5, ?\C-e)
ELISP> (disassemble rocky-identity)
byte code:
args: (x)
0 varref x
1 return
(fib-bug 3)
Debugger entered--Lisp error: (arith-error)
/(1 0)
(cond ((< n 1) 1) ((= fib-bug-count 0) (/ n 0)) (t (+ (fib-bug (1- n)) (fib-bug (- n 2)))))
fib-bug(1) ;; A link to the source code
(+ (fib-bug (1- n)) (fib-bug (- n 2)))
(cond ((< n 1) 1) ((= fib-bug-count 0) (/ n 0)) (t (+ (fib-bug (1- n)) (fib-bug (- n 2)))))
fib-bug(2) ;; A link to the source code
...
(fib-bug 3)
Debugger entered--Lisp error: (arith-error)
fib-bug(1)
fib-bug(2)
fib-bug(3)
eval((fib-bug 3) nil)
elisp--eval-last-sexp(nil)
...
What Emacs concepts exist for storing a location that might be useful here?
What Emacs concepts exist for storing a location in a file?
symbol-function
Revisited
ELISP> (load-file "/usr/share/emacs/25.2/lisp/files.elc")
t
ELISP> (symbol-function 'insert-file)
#[257 "\300^A\301\";"\207
[insert-file-1 insert-file-contents]
4
("/usr/share/emacs/25.2/lisp/files.elc" . 154863)
"*fInsert file: "]
Note the "doc-string" field.
More symbol-function
results:
ELISP> (symbol-function 'calendar)
#[(&optional arg)
("/usr/share/emacs/25.2/lisp/calendar/calendar.elc" . 40335)
nil 3
("/usr/share/emacs/25.2/lisp/calendar/calendar.elc" . 38677)
"P"]
The first pointer is to bytecode; the second is to docstring.
symbol-function
autoload
ELISP> (autoload 'realgud:remake "realgud.el"
"Debugger for GNU (re)make" t)
realgud:remake
ELISP> (symbol-function 'realgud:remake)
(autoload "realgud.el" "Debugger for GNU (re)make" t nil)
symbol-function
defalias
ELISP> (defalias 'remake 'realgud:remake)
remake
ELISP> (symbol-function 'remake)
realgud:remake
symbol-function
C function
ELISP> (symbol-function 'end-of-line)
#<subr end-of-line>
(/ a (/ b c))
-------
(/ a (/ b c))
-------------
0 1
01234567890123456789
(/ a (/ b c))
("tmp", "divide.el"
'(0 . (3 . 3))
(1 . (8 . 8))
(2 . (10 . 10))
(3 . (5 . 11))
(4 . (0 . 12)))
- fin