emacs-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: popup menu support for smerge-mode


From: Stefan Monnier
Subject: Re: popup menu support for smerge-mode
Date: 19 Sep 2003 11:57:47 -0400
User-agent: Gnus/5.09 (Gnus v5.9.0) Emacs/21.3.50

>>>> It's simpler to just place a single overlay over
>>>> the whole conflict (including markers).
>> 
>>> I have not done as you wrote.
>>> I expect "Keep Current" works on the region which is highlighted.
>> 
>> The highlight does not have to apply to the same region as the
>> `keymap' overlay.

> I think applying highlight and keymap to the same region is not so
> complex....probably I have not understood the intent of your
> suggestions.

You justified using 2 or 3 overlays over each alternative rather than
a single one over the whole conflict by saying that "keep current"
should work on the region which is highlighted.

What I meant to reply is that you could place a single overlay over the
whole conflict with a `keymap' property and then when mouse-3 is pressed
and you add the highlight, you can create a new overlay that covers only
the relevant alternative and place the highlight there: the highlight
and the keymap do not have to apply to the same region.

If you place the overlay over the whole conflict, then the "current"
alternative can be empty without any problem (other than the fact
that the highlighting will not aplly to any character) so you
don't need smerge-delete-current.

BTW, I don't understand this `smerge-delete-current'.  It seems to take
a conflict with a non-empty current alternative and replaces it with
a conflict with an empty current alternative, is that right ?  What I said
I need is to take a conflict where the current alternative is empty and
select that alternative (i.e. just delete the whole conflict).

> I've removed smerge-reset-all-overlays. Instead I use evaporate property
> of overlays. When an overlay is created, I put t to evaporate property of 
> the overlay. The overlay will be deleted when its region becomes empty.

I was thinking of suggesting that but wasn't sure whether it'd work.
Does it ?  If it does, it's probably the simplest alternative, indeed.

> +(defvar smerge-overlays nil "Overlays managed by smerge-mode")
> +(easy-mmode-defmap smerge-popup-menu-map
> +  `((,smerge-command-prefix . ,smerge-basic-map)

What is this line for ?

> +    ([down-mouse-3] . smerge-activate-popup-menu))
> +  "Keymap for popup menu appeared on conflicts area.")
> +(easy-menu-define smerge-mode-popup-menu smerge-popup-menu-map

This adds the popup menu inside smerge-popup-menu-map which I don't
think you want because you popup smerge-mode-popup-menu
from smerge-activate-popup-menu.  I guess it doesn't hurt because
it's placed somewhere in smerge-popup-menu-map where it has no effect ?
Or maybe it adds the popup menu in the menubar when point is in an area
covered by an overlay with the keymap property ?  Ahh... probably not
because you use a `nil' name.  In any case, you should use another name
for the popup-menu-map (or just leave it nil because you don't need it).

> +(defun smerge-reset-all-overlays ()
> +  "Delete all overlays of smerge-mode and put overlays on the all conflicts 
> again."
> +  (smerge-delete-overlays)
> +  (save-excursion 
> +    (goto-char (point-min))
> +    (while (smerge-find-conflict)
> +      (smerge-put-overlays (cddr (match-data))))))

Left over?


        Stefan




reply via email to

[Prev in Thread] Current Thread [Next in Thread]