From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Alan Mackenzie Newsgroups: gmane.emacs.bugs Subject: bug#21275: 24.5; Selection deleted with electric pair mode in cc mode Date: Thu, 20 Aug 2015 21:55:06 +0000 Message-ID: <20150820215506.GC3105@acm.fritz.box> References: <87a8trcqbp.fsf@moondust.localdomain> <20150818150431.42639.qmail@mail.muc.de> NNTP-Posting-Host: plane.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-Trace: ger.gmane.org 1440108508 1451 80.91.229.3 (20 Aug 2015 22:08:28 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Thu, 20 Aug 2015 22:08:28 +0000 (UTC) Cc: "N. Jackson" , 21275@debbugs.gnu.org To: Drew Adams Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Fri Aug 21 00:08:18 2015 Return-path: Envelope-to: geb-bug-gnu-emacs@m.gmane.org Original-Received: from lists.gnu.org ([208.118.235.17]) by plane.gmane.org with esmtp (Exim 4.69) (envelope-from ) id 1ZSY0N-0003Lk-I2 for geb-bug-gnu-emacs@m.gmane.org; Fri, 21 Aug 2015 00:08:15 +0200 Original-Received: from localhost ([::1]:37401 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ZSY0M-0008Hc-NE for geb-bug-gnu-emacs@m.gmane.org; Thu, 20 Aug 2015 18:08:14 -0400 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:53972) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ZSXxw-00042M-Ek for bug-gnu-emacs@gnu.org; Thu, 20 Aug 2015 18:05:47 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1ZSXni-0003Wx-9k for bug-gnu-emacs@gnu.org; Thu, 20 Aug 2015 17:55:11 -0400 Original-Received: from debbugs.gnu.org ([208.118.235.43]:41683) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ZSXna-0003Il-Hb; Thu, 20 Aug 2015 17:55:03 -0400 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.80) (envelope-from ) id 1ZSXna-0000hP-1a; Thu, 20 Aug 2015 17:55:02 -0400 X-Loop: help-debbugs@gnu.org Resent-From: Alan Mackenzie Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org, bug-cc-mode@gnu.org Resent-Date: Thu, 20 Aug 2015 21:55:01 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 21275 X-GNU-PR-Package: emacs,cc-mode X-GNU-PR-Keywords: Original-Received: via spool by 21275-submit@debbugs.gnu.org id=B21275.14401076502626 (code B ref 21275); Thu, 20 Aug 2015 21:55:01 +0000 Original-Received: (at 21275) by debbugs.gnu.org; 20 Aug 2015 21:54:10 +0000 Original-Received: from localhost ([127.0.0.1]:33893 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.80) (envelope-from ) id 1ZSXmk-0000gH-1E for submit@debbugs.gnu.org; Thu, 20 Aug 2015 17:54:10 -0400 Original-Received: from mail.muc.de ([193.149.48.3]:15487) by debbugs.gnu.org with esmtp (Exim 4.80) (envelope-from ) id 1ZSXmi-0000g9-8H for 21275@debbugs.gnu.org; Thu, 20 Aug 2015 17:54:09 -0400 Original-Received: (qmail 41447 invoked by uid 3782); 20 Aug 2015 21:54:06 -0000 Original-Received: from acm.muc.de (p548A4193.dip0.t-ipconnect.de [84.138.65.147]) by colin.muc.de (tmda-ofmipd) with ESMTP; Thu, 20 Aug 2015 23:54:05 +0200 Original-Received: (qmail 5360 invoked by uid 1000); 20 Aug 2015 21:55:06 -0000 Content-Disposition: inline In-Reply-To: User-Agent: Mutt/1.5.23 (2014-03-12) X-Delivery-Agent: TMDA/1.1.12 (Macallan) X-Primary-Address: acm@muc.de X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.15 Precedence: list X-detected-operating-system: by eggs.gnu.org: GNU/Linux 3.x X-Received-From: 208.118.235.43 X-BeenThere: bug-gnu-emacs@gnu.org List-Id: "Bug reports for GNU Emacs, the Swiss army knife of text editors" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Original-Sender: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Xref: news.gmane.org gmane.emacs.bugs:105614 Archived-At: Hello, Drew. On Thu, Aug 20, 2015 at 02:35:43PM -0700, Drew Adams wrote: > > > +(defun delete-selection-uses-region-p () > > > > The way I read it, this name says "a function which tells us if > > delete-selection uses the region". > No idea what this is all about, .... It's for when delete-selection-mode and electric-pair-mode are both enabled. What was happening (in C Mode, etc.) was that the user would mark an object and type "(", expecting e-p-m to put a pair of parens around the marked object; however d-s-m got in first, and deleted (?killed) the region before the parens were put around the now empty region. There was already a solution for this for when "(" is bound to self-insert-command - this is fairly arcane, and involves setting a particular variable to function which returns t in the pertinent circumstances. This function was previously coded as a lambda. However, I needed to use it for the pertinent CC Mode functions too, so I extracted it into a defun, giving it the name `delete-selection-uses-region-p'. The "delete-seleection" bit is the prefix, shared by the other de\(fun\|var\)s in the file. > .... but if this is for `electric-pair-mode' and not for > `delete-selection-mode' then the name should reflect that - call it > `electric-pair-SOMETHING'. It's for when BOTH minor modes are enabled, to enable them to play nicely with eachother. But it's in delsel.el, hence the prefix. > Is this something that `delete-selection-mode' needs? Or is it > for something else? See above. > > > + "Return non-nil when the current command uses the region. > What does it mean for a command to "use the region"? That isn't very good, is it? It basically means, from e-p-m's point of view "I'm going to be "using" the region, so don't you go and delete it!". > > It's not about "the current command" but about self-insert-command > > (which may be the current command or may be called by the current > > command). > What does it mean for such a command (or any other command) to > "use the region"? That info should presumably be in the doc string. I think you're right, here. I'll have another look at it. -- Alan Mackenzie (Nuremberg, Germany).