;ELC ;;; Compiled ;;; in Emacs version 27.1 ;;; with all optimizations. ;;; This file uses dynamic docstrings, first added in Emacs 19.29. ;;; This file does not contain utf-8 non-ASCII characters, ;;; and so can be loaded in Emacs versions earlier than 23. ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; (byte-code "\300\301\302\303\304\305\306\307&\210\310\311\312\313\314DD\315\316\317%\207" [custom-declare-group trace nil "Tracing facility for Emacs Lisp functions." :prefix "trace-" :group lisp custom-declare-variable trace-buffer funcall function #[0 "\300\207" [#1="*trace-output*"] 1 #1#] "Trace output will by default go to that buffer." :type string] 8) (defvar trace-level 0) (defvar trace-advice-name 'trace-function\ ) (defvar trace-separator (byte-code "\300\301\302\303\304\"\"\207" [format "%s\n" make-string 70 61] 5)) #@51 If non-nil, all tracing is temporarily inhibited. (defvar inhibit-trace nil (#$ . 942)) #@131 Helper function to get internal values. You can call this function to add internal values in the trace buffer. (fn &rest VALUES) (defalias 'trace-values #[128 "?\205r q\210db\210\303\304\n\305$c)\207" [inhibit-trace trace-buffer trace-level trace-entry-message trace-values ""] 6 (#$ . 1037)]) #@271 Generate a string that describes that FUNCTION has been entered. LEVEL is the trace level, ARGS is the list of arguments passed to FUNCTION, and CONTEXT is a string describing the dynamic context (e.g. values of some global variables). (fn FUNCTION LEVEL ARGS CONTEXT) (defalias 'trace-entry-message #[1028 "\301\302\303\304\305\306S\307\"\310#\311V\203\310\202\312B&)\207" [print-circle t format "%s%s%d -> %S%s\n" mapconcat char-to-string make-string 124 " " 1 ""] 11 (#$ . 1343)]) #@250 Generate a string that describes that FUNCTION has exited. LEVEL is the trace level, VALUE value returned by FUNCTION, and CONTEXT is a string describing the dynamic context (e.g. values of some global variables). (fn FUNCTION LEVEL VALUE CONTEXT) (defalias 'trace-exit-message #[1028 "\301\302\303\304\305\306S\307\"\310#\311V\203\310\202\312&)\207" [print-circle t format "%s%s%d <- %s: %S%s\n" mapconcat char-to-string make-string 124 " " 1 ""] 12 (#$ . 1852)]) (defvar trace--timer nil) #@12 (fn BUF) (defalias 'trace--display-buffer #[257 "\206\301\302\"?\205\303\304\305\306\304\307\310\311!\312\"\313$#\211\207" [trace--timer get-buffer-window visible run-with-timer 0 nil make-byte-code "\302\303\300\302\304#\207" vconcat vector [trace--timer nil display-buffer 0] 4] 10 (#$ . 2367)]) #@369 Build the piece of advice to be added to trace FUNCTION. FUNCTION is the name of the traced function. BUFFER is the buffer where the trace should be printed. BACKGROUND if nil means to display BUFFER. CONTEXT if non-nil should be a function that returns extra info that should be printed along with the arguments in the trace. (fn FUNCTION BUFFER BACKGROUND CONTEXT) (defalias 'trace-make-advice #[1028 "\300\301\302\303\304$\305\"\306\307%\207" [make-byte-code 385 "\fT\306\301!\307\303 \204@rq\210\310\311!\210\312 \302\204)\313!\210db\210\f\314U\2036c\210\315\300\f$c\210)\307C\316\317\320\321\322\300\302\303$\323\"\324$\216\211\325\"C\240\210)\211\242@\262+\207" vconcat vector [trace-level deactivate-mark get-buffer-create nil make-local-variable window-point-insertion-type t trace--display-buffer 1 trace-entry-message make-byte-code 0 "\f?\205,\302 r q\210\301\204\306 !\210db\210\307\300 \303\242\203%\303\242@\202&\310$c)\262\207" vconcat vector [inhibit-trace trace-buffer trace--display-buffer trace-exit-message !non-local\ exit! trace-level] 6 apply trace-buffer inhibit-trace trace-separator] 16 "\n\n(fn BODY &rest ARGS)"] 13 (#$ . 2684)]) #@73 Add trace advice for FUNCTION. (fn FUNCTION BUFFER BACKGROUND CONTEXT) (defalias 'trace-function-internal #[1028 "\302\303\304\206\f\206\305$\306 B\307B$\207" [trace-buffer trace-advice-name advice-add :around trace-make-advice #[0 "\300\207" [#1=""] 1 #1#] name ((depth . -100))] 12 (#$ . 3894)]) #@17 (fn FUNCTION) (defalias 'trace-is-traced #[257 "\301\"\207" [trace-advice-name advice-member-p] 4 (#$ . 4212)]) #@200 Read a function name, prompting with string PROMPT. If `current-prefix-arg' is non-nil, also read a buffer and a "context" (Lisp expression). Return (FUNCTION BUFFER FUNCTION-CONTEXT). (fn PROMPT) (defalias 'trace--read-args #[257 "\305 \306\307\"\310\311\203*\312\313\314\315#\203%\314 \"\202&\316$\202+\317\320\321\211 \2059\322\n!&!\266\202 \205^\323\324\n\"\320\325\326\321\f\320\327%)\330\315\331\332\333!\334\"\335$\262DB\207" [obarray current-prefix-arg trace-buffer minibuffer-completing-symbol read-expression-map function-called-at-point string-match ":[ ]*\\'" intern completing-read format "%s (default %s)%s" substring 0 ": " fboundp t nil symbol-name read-buffer "Output to buffer: " read-from-minibuffer "Context expression: " read-expression-history make-byte-code "\302\303\304\305\300\302\"!\306Q)\207" vconcat vector [print-circle t " [" prin1-to-string eval "]"] 5] 13 (#$ . 4335)]) #@960 Trace calls to function FUNCTION. With a prefix argument, also prompt for the trace buffer (default `trace-buffer'), and a Lisp expression CONTEXT. When called from Lisp, CONTEXT should be a function of no arguments which returns a value to insert into BUFFER during the trace. Tracing a function causes every call to that function to insert into BUFFER Lisp-style trace messages that display the function's arguments and return values. It also evaluates CONTEXT, if that is non-nil, and inserts its value too. For example, you can use this to track the current buffer, or position of point. This function creates BUFFER if it does not exist. This buffer will popup whenever FUNCTION is called. Do not use this function to trace functions that switch buffers, or do any other display-oriented stuff - use `trace-function-background' instead. To stop tracing a function, use `untrace-function' or `untrace-all'. (fn FUNCTION &optional BUFFER CONTEXT) (defalias 'trace-function-foreground #[769 "\300\301$\207" [trace-function-internal nil] 8 (#$ . 5276) (trace--read-args "Trace function: ")]) #@205 Trace calls to function FUNCTION, quietly. This is like `trace-function-foreground', but without popping up the output buffer or changing the window configuration. (fn FUNCTION &optional BUFFER CONTEXT) (defalias 'trace-function-background #[769 "\300\301$\207" [trace-function-internal t] 8 (#$ . 6388) (trace--read-args "Trace function in background: ")]) (defalias 'trace-function 'trace-function-foreground) #@259 Untraces FUNCTION and possibly activates all remaining advice. Activation is performed with `ad-update', hence remaining advice will get activated only if the advice of FUNCTION is currently active. If FUNCTION was not traced this is a noop. (fn FUNCTION) (defalias 'untrace-function #[257 "\301\"\207" [trace-advice-name advice-remove] 4 (#$ . 6811) (byte-code "\301\302\303\304\305$!C\207" [obarray intern completing-read "Untrace function: " trace-is-traced t] 6)]) #@42 Untraces all currently traced functions. (defalias 'untrace-all #[0 "\300\301!\207" [mapatoms untrace-function] 2 (#$ . 7291) nil]) (provide 'trace)