GNU bug report logs - #21275
24.5; Selection deleted with electric pair mode in cc mode

Previous Next

Packages: cc-mode, emacs;

Reported by: nljlistbox2 <at> gmail.com (N. Jackson)

Date: Sun, 16 Aug 2015 13:33:02 UTC

Severity: normal

Found in version 24.5

Done: Alan Mackenzie <acm <at> muc.de>

Bug is archived. No further changes may be made.

Full log


Message #19 received at 21275 <at> debbugs.gnu.org (full text, mbox):

From: Stefan Monnier <monnier <at> iro.umontreal.ca>
To: Alan Mackenzie <acm <at> muc.de>
Cc: "N. Jackson" <nljlistbox2 <at> gmail.com>, 21275 <at> debbugs.gnu.org
Subject: Re: bug#21275: 24.5;
 Selection deleted with electric pair mode in cc mode
Date: Wed, 19 Aug 2015 17:52:18 -0400
> +(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".

> +  "Return non-nil when the current command uses the region.

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).

> +(put 'c-electric-brace 'delete-selection 'delete-selection-uses-region-p)
> +(put 'c-electric-brace 'pending-delete 't)
> +(put 'c-electric-paren 'delete-selection 'delete-selection-uses-region-p)
> +(put 'c-electric-paren 'pending-delete 't)

An alternative would be to copy the `delete-selection' (and
`pending-delete') property of `self-insert-command'.  Probably in an
after-load, tho.


        Stefan




This bug report was last modified 10 years and 3 days ago.

Previous Next


GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997,2003 nCipher Corporation Ltd, 1994-97 Ian Jackson.