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: 20 Oct 2003 17:23:19 -0400
User-agent: Gnus/5.09 (Gnus v5.9.0) Emacs/21.3.50

> mine and other uses special menus. I added "Keep alternative" to the
> menus.  Other including whole uses the smerge menu appeared on the
> menu bar.

Don't forget that conflicts can have a 3-parts shape where there's not just
"mine" and "other" but also the ancestor, in which case there's no single
"Keep alternative".

> +(easy-menu-define smerge-mode-mine-popup-menu nil
> +  "Popup menu for mine area in `smerge-mode'."
> +  '(nil
> +    ["Keep This" smerge-keep-current :help "Use current (at point) version"]
> +    ;; mine <-> other
> +    ["Keep Alternative" smerge-keep-other :help "Use alternative version"] 
> +    ["Keep All" smerge-keep-all :help "Keep all three versions"]
> +    "---"
> +    ["More..." (popup-menu smerge-mode-menu) :help "Show full SMerge mode 
> menu"]
> +    ))
> +(easy-menu-define smerge-mode-other-popup-menu nil
> +  "Popup menu for other area in `smerge-mode'."
> +  '(nil
> +    ["Keep This"   smerge-keep-current :help "Use current (at point) 
> version"]
> +    ;; other <-> mine
> +    ["Keep Alternative" smerge-keep-mine :help "Use alternative version"]
> +    ["Keep All"    smerge-keep-all :help "Keep all three versions"]
> +    "---"
> +    ["More..." (popup-menu smerge-mode-menu) :help "Show full SMerge mode 
> menu"]
> +    ))

I'd rather introduce a new function smerge-keep-alternative which
will determine whether to use `other' or `mine' depending on `current'.
This way there's only one menu rather than two with the same appearance
but different behavior.

> +      (when (and b e (not (= b e)))

I think this can be simplified to `unless (eq e b)' because `e' and `b'
are either both locations or both nil.

> +     ;; Delete overlays
> +     (when (or 
> +            (not (overlay-buffer o-whole)) ;; dead
> +            (< (- (overlay-end o-whole) (overlay-start o-whole))
> +               region-whole))              ;; shrinked up
> +       (mapc 'delete-overlay (cons o-whole os-sub)))))))

I agree it's easier to remove the overlays from smerge-activate-popup-menu,
but that means they'll just never be removed if the user doesn't use
this new feature.  I think it really needs to be done somewhere else
instead (E.g. at the same place as the auto-leave code is run.  We'll
probably need to introduce a new function `smerge-post-resolution-update'
which will do the auto-leave check and will remove the overlays).


        Stefan




reply via email to

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