Subject: bug#6991: Please keep bytecode out of *Backtrace* buffers

From: Stefan Monnier <[email-masked]>
Date: Mon, 26 Jun 2017 00:02:17 -0400

>>> +        (when fun-file
>>> +          (make-text-button fun-pt (+ fun-pt (length (symbol-name fun)))
>>> +                            :type 'help-function-def
>>> +                            'help-args (list fun fun-file))))
>> Hmm... this looks like code which was moved from elsewhere, yet I can't
>> find this elsewhere in your patch(es).
>> I think that other code is in debugger-make-xrefs, so can't we remove
>> debugger-make-xrefs?
> I'm not sure exactly what you mean by "looks like code which was moved".

It's not functionality described as new in the commit log, so it's
presumably behavior which was earlier implemented elsewhere.

> It does replace the functionality of debugger-make-xrefs.  But
> `ert--make-xrefs-region' is still using `debugger-make-xrefs', and I
> don't quite see how to remove that usage.

I see.  Maybe we should move it to ert.el, then?

>>> +    (let ((frames (nthcdr
>>> +                   ;; Remove debug--implement-debug-on-entry and the
>>> +                   ;; advice's `apply' frame.
>>> +                   (if (eq (car args) 'debug) 3 1)
>>> +                   (backtrace-frames 'debug)))
>>> +          (print-escape-newlines t)
>>> +          (print-level 8)
>>> +          (print-length 50))
>> 
>> Why let-bind print-* here rather than inside debugger-insert-backtrace?

> I thought moving those inside might needlessly make the function less
> flexible, though nobody is currently making use of the flexibility so
> maybe it's not worth it...

Hmm... I can agree with it for level and length, but I think that the
escape-newline behavior is indispensable.

>>> +      (when (eq (car args) 'exit)
>>> +        (setf (cl-getf (nth 3 (car frames)) :debug-on-exit) nil))
>> 
>> This looks like code which was moved from elsewhere, yet I can't find
>> this elsewhere in your patch(es).  What am I missing?

> backtrace--print-frame I guess?  I haven't changed the printing for
> `backtrace', perhaps I should...

Hmm... I don't see anything that corresponds to this setf in
backtrace--print-frame.  What do the above 2 lines do, and where is the
corresponding code in the current debug.el?  Or is that a new feature in
your code?  (if so, where is it documented in the commit message?)

        Stefan