I would agree if this problem with indirect buffers was a major
problem, but is it really that?
Please report the problem with the make-indirect-buffer and the hook
as a bug in Emacs. I am afraid I do not understand exactly why it is
implemented as it is, but I am sure there are others that do.
On Thu, Apr 16, 2009 at 4:14 PM, <klaus.berndl@...> wrote:
> No, IMHO this isn't good enough - not every one upgrades his Emacs to the newest one immediately after the new release - this is not what i understand under the term "compatibility", when cedet only works with newest(!) GNU(!) Emacs(!)....
> Apart from that you are right, there is no other way to reach the goal unless to advice clone-indirect-buffer which would not so bad - advices are a powerful and save tool - a small after-advice would be easily to implement...
> But there is another drawback - independ if using the new hook or an advice: there is also the command make-indirect-buffer (internaly used by clone-indirect-buffer) which doesn't call the new hook clone-indirect-buffer-hook (IMHO a bug in Emacs because if there is such a hook, then it shpuld be used by both of them - at ist best only by make-indirect-buffer (because this command is called by clone-indirect-buffer) and then the new hook should be named make-indirect-buffer-hook....
> Anyway: cause of this there is only one chance: advicing make-indirect-buffer with an after-advice - unfortunatelly this function is defined in C-code anhd i'm not a big fan of advicing c-code routines..... But in general it is possible - maybe woth giving it a trey....
> Or are there other solutions?
> -----Ursprüngliche Nachricht-----
> Von: Lennart Borgman [mailto:lennart.borgman@...]
> Gesendet: Donnerstag, 16. April 2009 16:02
> An: Eric M. Ludlam
> Cc: Berndl, Klaus; cedet-devel@...
> Betreff: Re: [CEDET-devel] Is Semantic able to work with indirect buffers? -some more findings and a solution idea
> There is no easy way (except to advice clone-indirect-buffer), but isn't it good enough that it will work in Emacs 23 (which is in pretest currently)?
> On Thu, Apr 16, 2009 at 3:55 PM, Eric M. Ludlam <eric@...> wrote:
>> Ah. I'm using Emacs 23 from CVS. I guess that hook doesn't exist
>> Is there a way to do something similar in Emacs 22? (I don't have a
>>>>> <klaus.berndl@...> seems to think that:
>>>Hmmmm, thanks for a patch but what is
>>>`clone-indirect-buffer-hook'???? My Emacs doesn't have anything like
>>>this (Gnu Emacs 22.3.1)!
>>>Von: Eric M. Ludlam [mailto:eric@...]
>>>Gesendet: Donnerstag, 16. April 2009 14:32
>>>An: Berndl, Klaus
>>>Cc: lennart.borgman@...; cedet-devel@...
>>>Betreff: Re: AW: [CEDET-devel] Is Semantic able to work with
>>>indirect buffers? -some more findings and a solution idea
>>>When you edit a buffer, Semantic will reparse only the local area. It will recycle the overlay, and splice the new tags into the existing tags list. Since the existing tags-list and overlays are all still from the old buffer, you will get some mysterious behavior as everything is now mixed.
>>>I think you will find that forcing a reparse of the entire indirect buffer will also fix the editing case, as the two tag streams will now be independent.
>>>Here is a patch you can try:
>>>*** semantic.el.~1.212.~ 2009-03-18 20:46:39.000000000 -0400
>>>--- semantic.el 2009-04-16 08:29:37.000000000 -0400
>>>*** 299,304 ****
>>>--- 299,309 ----
>>> (not (semantic-active-p))
>>> (not (run-hook-with-args-until-success
>>>+ ;; Make sure that if this buffer is cloned, our tags and
>>>+ ;; don't go along for the ride.
>>>+ (add-hook 'clone-indirect-buffer-hook
>>>+ nil t)
>>> ;; Specify that this function has done it's work. At this point
>>> ;; we can consider that semantic is active in this buffer.
>>> (setq semantic-new-buffer-fcn-was-run t)
>>>This adds a hook to clear the cache when something is cloned. Please give it a try and let me know how it works. I don't know if this is really the right thing or not.
>>>>>> <klaus.berndl@...> seems to think that:
>>>>Hmm, sound senseful - al least at first glance...
>>>>On a second glance i want to point to the most recent posting i sent
>>>>to you - this one, where i describe what happens after editing tags
>>>>in the *indirect-buffer*... How does this behavior match your
>>>>findings you describe below?!
>>>>But maybe you are right and fixing one small underlying
>>>>problem-source in semantic fixes all other misbehaviors too.. But
>>>>currently i'm slightly pessimistic ;-)
>>>>Von: Eric M. Ludlam [mailto:eric@...]
>>>>Gesendet: Donnerstag, 16. April 2009 13:21
>>>>An: Lennart Borgman
>>>>Cc: Berndl, Klaus; cedet-devel@...
>>>>Betreff: Re: [CEDET-devel] Is Semantic able to work with indirect
>>>>buffers? -some more findings and a solution idea
>>>>>>> Lennart Borgman <lennart.borgman@...> seems to think that:
>>>>>On Thu, Apr 16, 2009 at 10:29 AM, <klaus.berndl@...> wrote:
>>>>>> A) Ensure that the overlays (at least the semantic related) of an indirect-buffer contain the buffer-object of the indirect-buffer and not the base-buffer... If Emacs does this not automatically (which could be a bug) then maybe semantic could do this itself, e.g. by advicing make-indirect-buffer and rebuilding all semantic-overlays so afterwards the correct buffer is returned by overlay-buffer... Maybe this needs more digging...
>>>>>I have no idea how this work, but it sounds that there are some
>>>>>properties on the overlays that points to position in a buffer. I
>>>>>guess these are markers. Then maybe a check if the marker points to
>>>>>the base buffer could be made just before use? Or perhaps that will be too slow?
>>>> [ ... ]
>>>>I did an experiment. I pulled up a simple C++ file, and cloned it. I examined the tag, and the tag in the cloned buffer was `eq' the tag in base buffer.
>>>>I then ran:
>>>>C-u M-x bovinate RET
>>>>to reparse. Now this throws away all the tag information, and reparses. The new tag was not `eq', and also did not have buffer file names associated with it.
>>>>I suspect the "fix" is going to be easy. First, we need to detect when the clone is made, then mark the entire new buffer as needing a full reparse. Semantic will take care of the rest later, and have all the tags marked correctly. I don't think an unlink/link pass would work since the raw tag data is shared at first.
>>>>There is a spiffy keybinding in senator:
>>>>C-c , /
>>>>which will show you details of the tag under point in the data-debugger so you can navigate the structure. It is very helpful for stuff like this.
>> -------- Stay on top of everything new and different, both inside and
>> around Java (TM) technology - register by April 22, and save $200 on
>> the JavaOne (SM) conference, June 2-5, 2009, San Francisco.
>> 300 plus technical and hands-on sessions. Register today.
>> Use priority code J9JMT32. http://p.sf.net/sfu/p
>> Cedet-devel mailing list