2

I am using Dave Love's noweb-mode to edit a file that is a mix of LaTeX and C code. Love's mode uses his multi-mode to switch back and forth between modes. This switching is accomplished via indirect buffers.

In Emacs 21, the mode appears to work well. But a forced upgrade to Emacs 23 has revealed problems:

  1. When making a transition between modes, mark is lost.

  2. When viewing the same buffer in two different visible windows, movement in window A occasionally causes movement in window B, and it will also cause window B's point to move.

I'm trying to diagnose and repair these faults. I managed to work around problem 1 by turning off all buffer/mode switching while (region-active-p). But problem 2 has me completely stumped. I don't even know how to diagnose it.

I am looking for any help, but especially answers to either of these two questions:

  • How should I try to diagnose this problem?

  • Where can I find a clear and more complete explanation of the semantics of indirect buffers? The GNU Emacs Lisp Reference Manual does not say much, and I'm not sure reading the source code is the best next step.

Norman Ramsey
  • 198,648
  • 61
  • 360
  • 533
  • On the offchance that it resolves the issues, I would suggest trying Emacs 24, which has just been officially released. – phils Jun 15 '12 at 11:58
  • @phils I'm waiting for it to be added to Debian – Norman Ramsey Jun 15 '12 at 15:23
  • In that case all I can suggest is `M-x report-emacs-bug` if you conclude that it's a issue with the indirect buffer mechanism itself. A recipe for replicating the problem from `emacs -Q` would definitely be useful. – phils Jun 15 '12 at 23:01

1 Answers1

3

Semantics and Emacs are two very separate worlds, as you might imagine. Similarly there are no "clear and complete explanations", sadly. Basically indirect buffers share their buffer text, text-properties, as well as some internal variables, while they keep separate buffer-local variables, and separate overlays. The division between what is shared and what isn't is largely arbitrary. To make things worse, indirect buffers are rarely used, so bugs and unwarranted assumptions inevitably creep in. To track down your problems, the best approach is first to come up with reliably reproducible recipes. I can reproduce some weird behavior w.r.t the mark where the base buffer's mark ends up being a marker in the indirect buffer, so that looks like a plain bug somewhere (and that doesn't seem to be fixed in 24.1, sadly). Please M-x report-emacs-bug.

Stefan
  • 27,908
  • 4
  • 53
  • 82