all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
* bug#16085: 24.3.50; electric-pair-mode and cua-mode clash when autowrapping region
@ 2013-12-07 19:26 João Távora
  2013-12-08  6:25 ` Stefan Monnier
  0 siblings, 1 reply; 2+ messages in thread
From: João Távora @ 2013-12-07 19:26 UTC (permalink / raw
  To: 16085

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





^ permalink raw reply	[flat|nested] 2+ messages in thread

* bug#16085: 24.3.50; electric-pair-mode and cua-mode clash when autowrapping region
  2013-12-07 19:26 bug#16085: 24.3.50; electric-pair-mode and cua-mode clash when autowrapping region João Távora
@ 2013-12-08  6:25 ` Stefan Monnier
  0 siblings, 0 replies; 2+ messages in thread
From: Stefan Monnier @ 2013-12-08  6:25 UTC (permalink / raw
  To: João Távora; +Cc: 16085

> 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





^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2013-12-08  6:25 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2013-12-07 19:26 bug#16085: 24.3.50; electric-pair-mode and cua-mode clash when autowrapping region João Távora
2013-12-08  6:25 ` Stefan Monnier

Code repositories for project(s) associated with this external index

	https://git.savannah.gnu.org/cgit/emacs.git
	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.