On 01 Apr 2014, at 21:07, Stephen Leake <[email protected]> wrote:
> ˝˝
>> Before I start thinking about Heisenbugs---or generate
>> false alarm, as I should note---is it possible at all
>> that the concurrent nature of the indentation work
>> and the bulk replacements can interfere?
> 
> The only thing "concurrent" is font-lock, which runs in the background.
> It does invoke parsing, but not indentation.
> 
> So as a first step, do:
> 
> M-x global-font-lock-mode

No effect. I am able to reproduce the error in GNU Emacs 24.3
on both Mac and Windows. I use the ada-mode files from the
ada-france.org repository in directory org.emacs.ada-mode,
and start

  emacs -Q -L path/to/org.emacs.ada-mode

That is, the Lisp files are not compiled, which I am guessing
may have some effects, on timing?

> 
> to turn it off, and repeat your test.
> 
> However, there is nothing in parsing that should interfere with
> find/replace.
> 

Just to make sure, I checked that I could have the replacements
correctly in text-mode and in pascal-mode. Switching back to
Ada mode brings back the phenomenon reliably; query-replace
actually skips some occurrences irrespective of whether
I request all replacements at once, or one at a time.

(The positions of point and highlighting seem to disagree
after one or two replacements; I have also seen one-off things,
such as “MHigh” being a replacement text, see below, or the
position of the second “Milli” being 326 not 325, when requesting
query-replace with point after the first occurrence of “Milli").
Trying to debug (edebug) seemed to turn up something at first,
but then ada-case-adjust-identifier was not involved, apparently.)

> ada-case-adjust-identifier does delete and insert strings; if that is
> run in parallel with find/replace it could cause your symptoms. But it
> shouldn't be. Try setting a break in that to see if it is running.

I thought I had found a possible cause, viz. `run-with-idle-timer’,
in “isearch”, but, sadly, the initial effect has worn out.

(It was in `isearch-lazy-highlight-new-loop', which `query-replace'
effectively calls at some point. When I had “disabled” timers,
things seemed back to normal, by appearance. I changed the last lines
of `isearch-lazy-highlight-new-loop’, diverting the timers:

      (unless (equal isearch-string "")
        (progn
          (setq isearch-lazy-highlight-timer
                (run-with-idle-timer lazy-highlight-initial-delay nil
                                     (lambda () )))  ;; <--
          (funcall 'isearch-lazy-highlight-update)))))

(Here, originally, 'isearch-lazy-highlight-update is passed to
run-with-idle-timer in place of (lambda ()).  With this change,
replacing works as expected again, in Ada mode.)

This is my test case. I query-replace “Milli" with “High”.
Trying this a few times, only 4 or 5 of the 7 occurrences
are replaced in ada-mode. Point is just somewhere, afterwards. 

procedure Round_Decimal is

   --  OJBECTIVE:
   --    Check that 'Round of a decimal fixed point type does round
   --    away from zero if the operand is of a decimal fixed point
   --    type with a smaller delta.

   type Milli is delta 0.001 digits 9;
   type Centi is delta 0.01 digits 9;

   function Rounded (Value : Milli) return Centi;
   --  Value, rounded using Centi'Round

   function Rounded (Value : Milli) return Centi is
   begin
      return Centi'Round (Value);
   end Rounded;

begin

   --  Operands used directly, works as expected:

   if not (Milli'Round (0.999) = Milli'(0.999)
             and
           Centi'Round (0.999) = Centi'(1.0)
             and
           Centi'Round (Milli'(0.999)) = Centi'(1.0))
   then
      raise Program_Error;
   end if;

   --  This should not fail, but currently does:

   if Rounded (Milli'(0.999)) /= Centi'(1.0) then
      raise Program_Error;
   end if;

end Round_Decimal;
_______________________________________________
Emacs-ada-mode mailing list
[email protected]
http://host114.hostmonster.com/mailman/listinfo/emacs-ada-mode_stephe-leake.org

Reply via email to