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: 20 Oct 2003 17:23:19 -0400 Sender: emacs-devel-bounces+emacs-devel=quimby.gnus.org@gnu.org Message-ID: References: <20030919.182502.242160171.jet@gyve.org> <20030926.165808.260114910.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 1066685737 30686 80.91.224.253 (20 Oct 2003 21:35:37 GMT) X-Complaints-To: usenet@sea.gmane.org NNTP-Posting-Date: Mon, 20 Oct 2003 21:35:37 +0000 (UTC) Cc: monnier+gnu/emacs@rum.cs.yale.edu, monnier+gnu/emacs@cs.yale.edu, emacs-devel@gnu.org Original-X-From: emacs-devel-bounces+emacs-devel=quimby.gnus.org@gnu.org Mon Oct 20 23:35:33 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 1ABhgb-0001dt-00 for ; Mon, 20 Oct 2003 23:35:33 +0200 Original-Received: from monty-python.gnu.org ([199.232.76.173]) by quimby.gnus.org with esmtp (Exim 3.35 #1 (Debian)) id 1ABhga-00045V-00 for ; Mon, 20 Oct 2003 23:35:33 +0200 Original-Received: from localhost ([127.0.0.1] helo=monty-python.gnu.org) by monty-python.gnu.org with esmtp (Exim 4.24) id 1ABhaq-0001w0-DM for emacs-devel@quimby.gnus.org; Mon, 20 Oct 2003 17:29:36 -0400 Original-Received: from list by monty-python.gnu.org with tmda-scanned (Exim 4.24) id 1ABhXe-0000x3-GQ for emacs-devel@gnu.org; Mon, 20 Oct 2003 17:26:18 -0400 Original-Received: from mail by monty-python.gnu.org with spam-scanned (Exim 4.24) id 1ABhX8-0000r3-5J for emacs-devel@gnu.org; Mon, 20 Oct 2003 17:26:17 -0400 Original-Received: from [132.204.24.67] (helo=mercure.iro.umontreal.ca) by monty-python.gnu.org with esmtp (Exim 4.24) id 1ABhUz-0000Qp-4N for emacs-devel@gnu.org; Mon, 20 Oct 2003 17:23:33 -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 h9KLNJp3001840; Mon, 20 Oct 2003 17:23:20 -0400 Original-Received: by vor.iro.umontreal.ca (Postfix, from userid 20848) id 4E1D13C63E; Mon, 20 Oct 2003 17:23:19 -0400 (EDT) Original-To: Masatake YAMATO In-Reply-To: <20030926.165808.260114910.jet@gyve.org> Original-Lines: 55 User-Agent: Gnus/5.09 (Gnus v5.9.0) Emacs/21.3.50 X-DIRO-MailScanner: 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:17273 X-Report-Spam: http://spam.gmane.org/gmane.emacs.devel:17273 > 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