GNU bug report logs - #16085
24.3.50; electric-pair-mode and cua-mode clash when autowrapping region

Previous Next

Package: emacs;

Reported by: joaotavora <at> gmail.com (João Távora)

Date: Sat, 7 Dec 2013 19:29:02 UTC

Severity: normal

Found in version 24.3.50

Done: Stefan Monnier <monnier <at> iro.umontreal.ca>

Bug is archived. No further changes may be made.

To add a comment to this bug, you must first unarchive it, by sending
a message to control AT debbugs.gnu.org, with unarchive 16085 in the body.
You can then email your comments to 16085 AT debbugs.gnu.org in the normal way.

Toggle the display of automated, internal messages from the tracker.

View this report as an mbox folder, status mbox, maintainer mbox


Report forwarded to bug-gnu-emacs <at> gnu.org:
bug#16085; Package emacs. (Sat, 07 Dec 2013 19:29:02 GMT) Full text and rfc822 format available.

Acknowledgement sent to joaotavora <at> gmail.com (João Távora):
New bug report received and forwarded. Copy sent to bug-gnu-emacs <at> gnu.org. (Sat, 07 Dec 2013 19:29:02 GMT) Full text and rfc822 format available.

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

From: joaotavora <at> gmail.com (João Távora)
To: bug-gnu-emacs <at> gnu.org
Subject: 24.3.50;
 electric-pair-mode and cua-mode clash when autowrapping region
Date: Sat, 07 Dec 2013 19:26:34 +0000
Hello maintainers,

    emacs -Q
    M-x cua-mode
    M-x electric-pair-mode
    insert foo
    select region "foo"
    press "("
    should get "(foo)", get ")(" instead.

This is a problem I solved in my third-party autopair.el library using
this horrible code

    (defun autopair--should-autowrap ()
      (and autopair-mode
           (not (eq this-command 'autopair-backspace))
           (symbolp this-command)
           (string-match "^autopair" (symbol-name this-command))
           (autopair--calculate-wrap-action)))
     
    (defadvice cua--pre-command-handler-1 (around autopair-override activate)
      "Don't actually do anything if autopair is about to autowrap. "
      (unless (autopair--should-autowrap) ad-do-it))
     
    ;; aparently not needed for electric.el since it works ok with delete-selectrion-mode
    ;; 
    ;; (defadvice delete-selection-pre-hook (around autopair-override activate)
    ;;   "Don't actually do anything if autopair is  about to autowrap. "
    ;;   (unless (autopair--should-autowrap) ad-do-it))

Thanks,
João




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#16085; Package emacs. (Sun, 08 Dec 2013 06:26:01 GMT) Full text and rfc822 format available.

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

From: Stefan Monnier <monnier <at> iro.umontreal.ca>
To: joaotavora <at> gmail.com (João Távora)
Cc: 16085 <at> debbugs.gnu.org
Subject: Re: bug#16085: 24.3.50;
 electric-pair-mode and cua-mode clash when autowrapping region
Date: Sun, 08 Dec 2013 01:25:17 -0500
> Hello maintainers,
>     emacs -Q
>     M-x cua-mode
>     M-x electric-pair-mode
>     insert foo
>     select region "foo"
>     press "("
>     should get "(foo)", get ")(" instead.

> This is a problem I solved in my third-party autopair.el library using
> this horrible code

That's a problem we already solved for delete-selection-mode (see patch
below).  So we just need to port this fix to cua-mode.  Even better
is to make cua-mode use delete-selection-mode.

I installed a patch which does that.


        Stefan




bug closed, send any further explanations to 16085 <at> debbugs.gnu.org and joaotavora <at> gmail.com (João Távora) Request was from Stefan Monnier <monnier <at> iro.umontreal.ca> to control <at> debbugs.gnu.org. (Sun, 08 Dec 2013 06:49:03 GMT) Full text and rfc822 format available.

bug archived. Request was from Debbugs Internal Request <help-debbugs <at> gnu.org> to internal_control <at> debbugs.gnu.org. (Sun, 05 Jan 2014 12:24:03 GMT) Full text and rfc822 format available.

This bug report was last modified 11 years and 223 days ago.

Previous Next


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