Function: backtrace--print-func-and-args
backtrace--print-func-and-args is a byte-compiled function defined in
backtrace.el.gz.
Signature
(backtrace--print-func-and-args FRAME VIEW)
Documentation
Print the function, arguments and buffer position of a backtrace FRAME.
Format it according to VIEW.
Source Code
;; Defined in /usr/src/emacs/lisp/emacs-lisp/backtrace.el.gz
(defun backtrace--print-func-and-args (frame _view)
"Print the function, arguments and buffer position of a backtrace FRAME.
Format it according to VIEW."
(let* ((beg (point))
(evald (backtrace-frame-evald frame))
(fun (backtrace-frame-fun frame))
(args (backtrace-frame-args frame))
(def (find-function-advised-original fun))
(fun-file (or (symbol-file fun 'defun)
(and (subrp def)
(not (eq 'unevalled (cdr (subr-arity def))))
(find-lisp-object-file-name fun def))))
(fun-pt (point)))
(cond
((and evald (not debugger-stack-frame-as-list))
(if (atom fun)
(funcall backtrace-print-function fun)
(insert
(backtrace--print-to-string fun (when args (/ backtrace-line-length 2)))))
(if args
(insert (backtrace--print-to-string
args (max (truncate (/ backtrace-line-length 5))
(- backtrace-line-length (- (point) beg)))))
;; The backtrace-form property is so that backtrace-multi-line
;; will find it. backtrace-multi-line doesn't do anything
;; useful with it, just being consistent.
(let ((start (point)))
(insert "()")
(put-text-property start (point) 'backtrace-form t))))
(t
(let ((fun-and-args (cons fun args)))
(insert (backtrace--print-to-string fun-and-args)))
(cl-incf fun-pt)))
(when fun-file
(make-text-button fun-pt (+ fun-pt
(length (backtrace--print-to-string fun)))
:type 'help-function-def
'help-args (list fun fun-file)))
;; After any frame that uses eval-buffer, insert a comment that
;; states the buffer position it's reading at.
(when (backtrace-frame-pos frame)
(insert " ; Reading at ")
(let ((pos (point)))
(insert (format "buffer position %d" (backtrace-frame-pos frame)))
(make-button pos (point) :type 'backtrace-buffer-pos
'backtrace-buffer (backtrace-frame-buffer frame)
'backtrace-pos (backtrace-frame-pos frame))))
(insert "\n")
(put-text-property beg (point) 'backtrace-section 'func)))