From mboxrd@z Thu Jan 1 00:00:00 1970 Path: main.gmane.org!not-for-mail From: "Stefan Monnier" Newsgroups: gmane.emacs.devel Subject: Re: popup menu support for smerge-mode Date: 19 Sep 2003 11:57:47 -0400 Sender: emacs-devel-bounces+emacs-devel=quimby.gnus.org@gnu.org Message-ID: References: <200308241442.h7OEgcxV020578@rum.cs.yale.edu> <20030918.175404.163031143.jet@gyve.org> <20030919.182502.242160171.jet@gyve.org> NNTP-Posting-Host: deer.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-Trace: sea.gmane.org 1063987203 16361 80.91.224.253 (19 Sep 2003 16:00:03 GMT) X-Complaints-To: usenet@sea.gmane.org NNTP-Posting-Date: Fri, 19 Sep 2003 16:00:03 +0000 (UTC) Cc: emacs-devel@gnu.org, monnier+gnu/emacs@cs.yale.edu, monnier+gnu/emacs@rum.cs.yale.edu Original-X-From: emacs-devel-bounces+emacs-devel=quimby.gnus.org@gnu.org Fri Sep 19 18:00:01 2003 Return-path: Original-Received: from quimby.gnus.org ([80.91.224.244]) by deer.gmane.org with esmtp (Exim 3.35 #1 (Debian)) id 1A0Nfs-0000bO-00 for ; Fri, 19 Sep 2003 18:00:00 +0200 Original-Received: from monty-python.gnu.org ([199.232.76.173]) by quimby.gnus.org with esmtp (Exim 3.35 #1 (Debian)) id 1A0NkO-0005qV-00 for ; Fri, 19 Sep 2003 18:04:40 +0200 Original-Received: from localhost ([127.0.0.1] helo=monty-python.gnu.org) by monty-python.gnu.org with esmtp (Exim 4.22) id 1A0NeO-00014M-Sz for emacs-devel@quimby.gnus.org; Fri, 19 Sep 2003 11:58:28 -0400 Original-Received: from list by monty-python.gnu.org with tmda-scanned (Exim 4.22) id 1A0Ne3-000147-6N for emacs-devel@gnu.org; Fri, 19 Sep 2003 11:58:07 -0400 Original-Received: from mail by monty-python.gnu.org with spam-scanned (Exim 4.22) id 1A0Ne1-00013W-Eh for emacs-devel@gnu.org; Fri, 19 Sep 2003 11:58:06 -0400 Original-Received: from [132.204.24.67] (helo=mercure.iro.umontreal.ca) by monty-python.gnu.org with esmtp (Exim 4.22) id 1A0Ne1-00013L-4C for emacs-devel@gnu.org; Fri, 19 Sep 2003 11:58:05 -0400 Original-Received: from vor.iro.umontreal.ca (vor.iro.umontreal.ca [132.204.24.42]) by mercure.iro.umontreal.ca (8.12.9/8.12.9) with ESMTP id h8JFvmHD022834; Fri, 19 Sep 2003 11:57:48 -0400 Original-Received: by vor.iro.umontreal.ca (Postfix, from userid 20848) id 288D23C547; Fri, 19 Sep 2003 11:57:48 -0400 (EDT) Original-To: Masatake YAMATO In-Reply-To: <20030919.182502.242160171.jet@gyve.org> Original-Lines: 72 User-Agent: Gnus/5.09 (Gnus v5.9.0) Emacs/21.3.50 X-MailScanner-DIRO: Found to be clean X-BeenThere: emacs-devel@gnu.org X-Mailman-Version: 2.1.2 Precedence: list List-Id: Emacs development discussions. List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: emacs-devel-bounces+emacs-devel=quimby.gnus.org@gnu.org Xref: main.gmane.org gmane.emacs.devel:16493 X-Report-Spam: http://spam.gmane.org/gmane.emacs.devel:16493 >>>> 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