bug-gnu-emacs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

bug#16085: 24.3.50; electric-pair-mode and cua-mode clash when autowrapp


From: João Távora
Subject: bug#16085: 24.3.50; electric-pair-mode and cua-mode clash when autowrapping region
Date: Sat, 07 Dec 2013 19:26:34 +0000
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/24.3.50 (gnu/linux)

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





reply via email to

[Prev in Thread] Current Thread [Next in Thread]