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 (special-form-p def))
(find-lisp-object-file-name fun def))))
(fun-beg (point))
(fun-end nil))
(cond
((and evald (not debugger-stack-frame-as-list))
(if (atom fun)
(funcall backtrace-print-function fun)
(insert
(backtrace--print-to-string
fun
(when (and args (backtrace--line-length-or-nil))
(/ backtrace-line-length 2)))))
(setq fun-end (point))
(if args
(insert (backtrace--print-to-string
args
(if (backtrace--line-length-or-nil)
(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)))
;; Skip the open-paren.
(incf fun-beg)))
(when fun-file
(make-text-button fun-beg
(or fun-end
(+ fun-beg
;; FIXME: `backtrace--print-to-string' will
;; not necessarily print FUN in the same way
;; as it did when it was in FUN-AND-ARGS!
(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)))