Subject: bug#8789: 23.3; debug backtrace buffer changes window on step-through

From: "Drew Adams" <[email-masked]>
Date: Thu, 20 Sep 2012 14:33:00 -0700

> > 3. But I also think that it should be enough, for this problematic
> > mode line enhancement, to simply call a duplicate of `file-remote-p'
> > and not `file-remote-p' itself, which is used by all kinds of code.
> >
> > If that duplicate (e.g., `mode-line-file-remote-p') is 
> > called only by the mode-line code then that should greatly reduce,
> > if not eliminate, this problem for the debugger.
> 
> But do you really think that this is the right approach?  E.g. in
> dired+, we use (:eval ...) in the dired mode-string.  It's not very
> useful to create a duplicate of all lisp functions we call in 
> this form only because of the fact that they are used for the mode-line.

Again, if you have an elegant, general solution, I'm all ears.

We are confronted with a particular regression, caused by the new occurrence of
calling `file-remote-p' when updating the mode line.  Why not fix that?

> And, in the case of `file-remote-p', it wouldn't even be enough to
> duplicate just this function.  We would have to duplicate any 
> function that could be called by `file-remote-p' as well.

No, sorry, I don't see that.  The problem is only calls to `file-remote-p', not
also calls to `find-file-name-handler' (which is called by `file-remote-p') or
calls to `if' or `funcall' (also called by `file-remote-p').  

AFAICT, it does not matter that `mode-line-file-remote-p' would call
`find-file-name-handler' or `if' or `funcall'.  `M-x debug-on-entry
file-remote-p', or adding `debug' to your (non mode-line) code that calls
`file-remote-p', would not cause the debugger to open when
`mode-line-file-remote-p' is called or when any of the functions it calls is
called.

But perhaps I'm missing something?