-*- outline -*-

* Known Bugs and Workarounds for Proof General.

For latest, see: http://proofgeneral.inf.ed.ac.uk/trac
See also FAQ:    http://proofgeneral.inf.ed.ac.uk/FAQ

Generic bugs are listed here, which may affect all of the supported
provers.  See lego/BUGS coq/BUGS, etc, for a few specific bugs.

The bugs here are split into problems which apply for all Emacs
versions, and those which only apply to particular versions.

NB: some issues which affect PG but which are not necessarily bugs in
PG are mentioned in the FAQ.

* Reporting bugs

If you have a problem that is not mentioned here, please visit the
Trac at the address above to add a ticket.  Please describe your
problem carefully, include a short demonstration file and tell us the
exact version of Emacs and Proof General that you are using.


* Generic problems, for all Emacs versions

** Visibility control doesn't distinguish theorems with same name.

If you have more than one theorem with the same name in a buffer,
their proof visibilities are controlled together.

** If the proof assistant goes into a loop displaying lots of information

It may be difficult or impossible to interrupt it, because Emacs
doesn't get a chance to process the C-c C-c keypress or "Stop" button
push (or anything else).  In this situation, you will need to send an
interrupt to the (e.g.) Isabelle process from another shell.  If that 
doesn't stop things, you can try 'kill -FPE <emacs-pid>'.  
This problem can happen with looping rewrite rules in the Isabelle
simplifier, when tracing rewriting.  It seems to be worse on 
certain architectures, and slower machines.  Behaviour seems
better on Emacs than XEmacs.

** Glitches in display handling, esp with multiple frames

Unfortunately the handling of the display is very difficult to manage
because the API provided by Emacs is quirky, buggy, and varies between
versions.  If the eager display/tear-down of frames is annoying you,
you may customize the variable `proof-shell-fiddle-frames' to nil to
reduce it a bit.  To prevent eagerly displaying new frames at on
starting the shell, you can also add a mode hook to set
`proof-eagerly-raise' e.g.:
  
  (add-hook 'proof-goals-mode-hook 
    (lambda () (setq proof-eagerly-raise nil)))
  (add-hook 'proof-response-mode-hook 
    (lambda () (setq proof-eagerly-raise nil)))

This causes the previous behaviour as in PG 3.4: frames are only
created as text is displayed in them.  (This is the default for
the trace buffer).

Generally, the best way of working with multiple frames is to try not
to stop/start the proof assistant too much (this involves killing
buffers, which spoils the frame/buffer correspondence).

If you find other particularly annoying behaviour, please do report
it, but give a careful description of how to reproduce, what happened,
and what you expected to happen.  Probably you will just have to work
around the issue.  For future versions of PG the multiple frame
handling code will probably be custom written (rather than using
`special-display-regexps').

** Toolbar enablers unreliable on some platforms.

Occasionally the buttons are disabled/enabled when they shouldn't be.
An extra click on the toolbar may solve this.  If you have problems,
please customize `proof-toolbar-use-button-enablers' to nil to
disable the enablers. 

** Using C-g can leave script management in a mess (rare).  

The code is not fully protected from Emacs interrupts.
Workaround: Don't type C-g while script management is processing.  
If you do, use proof-restart-scripting to be sure of synchronizing.

** Outline-mode does not work in processed proof script files 

Because of read-only restrictions of the protected region.  
This is an inherent problem with outline because it works by 
modifying the buffer.
Workaround: none.  

** When proof-rsh-command is set to "ssh host", C-c C-c broken

The whole process may be killed instead of interrupted.  This isn't a
bug in Proof General, but the behaviour of ssh.  Try using rsh
instead, it is said to forward signals to the remote command.

** In tty mode, the binding C-c C-RET has no effect.  

Workaround: manually bind C-c RET to 'proof-goto-point instead.

** Multiple file scripting is slightly vulnerable.

Files are not locked when they are being read by the prover, so a long
file could be edited and saved as the prover is processing it,
resulting in a loss of synchronization between Emacs and the proof
assistant.  Files ought to be coloured red while they are being
processed, just as single lines are.   Workaround: be careful not
to edit a file as it is being read by the proof assistant!



* Problems with particular Emacs versions 

** General note:  PLEASE CHECK YOUR EMACS IS UP TO DATE

Most of the issues below relate to old Emacs versions.  Proof General
is already chock-full of patches for Emacs bugs, it's time to start
removing these kludges rather than adding more.  Feel free to report a
bug which may be Emacs-related: from now on I will add a note here
rather than try to investigate older Emacsen and add more patches 
to the code.

** XEmacs "nesting too deep for parser" warnings

This is sometimes triggered by very complex output, typically with
Isabelle's tracing messages when font-lock is called. 

XEmacs implementation of parse-partial-sexp appears at fault.  It
gives this error message when nesting depth reaches 100.  With 
GNU Emacs, a nesting depth of 40000 or more is possible.

Some error handling has been added in the code to cope with this
condition.  If you notice the disappearance of correct syntax
highlighting in the response buffer when large output with unbalanced
parentheses is produced, this error may be the cause.  You can clear
the response buffer by hitting "c" when it is selected.

** XEmacs font-lock problem in certain versions of XEmacs 21.4

When reloading (with C-x C-f) an already loaded script file that has
been changed on the file system you see the error:

 (1) (warning/warning) Error caught in `font-lock-pre-idle-hook':
 (wrong-type-argument markerp nil)

As a result fontification, etc, fails. Workaround: use C-x C-v
instead.  This problem has gone away since 21.4.12 or so.
Update: this has reappeared in version 21.4.15.

** XEmacs undo in the script buffer can edit the "uneditable region"

Test case: Insert some nonsense text after the locked region.
Kill the line. Process to the next command.
Press C-x u, nonsense text appears in locked region.
Workaround: take care with undo in XEmacs.

