[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
bug#21275: 24.5; Selection deleted with electric pair mode in cc mode
From: |
Alan Mackenzie |
Subject: |
bug#21275: 24.5; Selection deleted with electric pair mode in cc mode |
Date: |
Thu, 20 Aug 2015 21:55:06 +0000 |
User-agent: |
Mutt/1.5.23 (2014-03-12) |
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).
- bug#21275: 24.5; Selection deleted with electric pair mode in cc mode, N. Jackson, 2015/08/16
- Message not available
- bug#21275: 24.5; Selection deleted with electric pair mode in cc mode, Alan Mackenzie, 2015/08/18
- bug#21275: 24.5; Selection deleted with electric pair mode in cc mode, N. Jackson, 2015/08/18
- bug#21275: 24.5; Selection deleted with electric pair mode in cc mode, Stefan Monnier, 2015/08/20
- bug#21275: 24.5; Selection deleted with electric pair mode in cc mode, Drew Adams, 2015/08/20
- bug#21275: 24.5; Selection deleted with electric pair mode in cc mode,
Alan Mackenzie <=
- bug#21275: 24.5; Selection deleted with electric pair mode in cc mode, Drew Adams, 2015/08/21
- bug#21275: 24.5; Selection deleted with electric pair mode in cc mode, Stefan Monnier, 2015/08/21
- bug#21275: 24.5; Selection deleted with electric pair mode in cc mode, Drew Adams, 2015/08/21
Message not available