[Top][All Lists]

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

CUA/delete-selection-mode and remapped keys incompatibility

From: David Reitter
Subject: CUA/delete-selection-mode and remapped keys incompatibility
Date: Thu, 8 Feb 2007 18:30:59 +0000

I noticed an incompatibility of CUA mode and some minor modes.
If the mode maps a key to a function that self-inserts the key again (it commonly does something useful in addition to that), then the CUA mode of interaction is not respected in that the text in the current region is not replaced, as it should.


(defun slime-space (n)
  (interactive "p")
  (self-insert-command n))

(global-set-key " " 'slime-space)

(cua-mode 1)

After executing the above, input arbitrary text and mark it as the region. Then hit the Space key. This will add insert a space at the point rather than replacing the region. Replacing the region would be the correct behavior in CUA mode. The same applies to delete- selection-mode.

A quick look into `delete-selection-pre-hook' shows that it expects a `delete-selection' attribute to be set for the current command, which is `slime-space' and not `self-insert-command' when it the hook function is called.

Changing the above `slime-space' to use `call-interactively' doesn't help - it seems that the pre-command-hook isn't run again in such a case.

If Emacs crashed, and you have the Emacs process in the gdb debugger,
please include the output from the following gdb commands:
    `bt full' and `xbacktrace'.
If you would like to further debug the crash, please read the file
/Applications/Aquamacs Emacs.app/Contents/Resources/etc/DEBUG for instructions.

In GNU Emacs (powerpc-apple-darwin7.9.0, Carbon Version 1.6.0)
of 2007-02-08 on rodrigues.inf.ed.ac.uk
X server distributor `Apple Computers', version 10.4.8
configured using `configure  '--without-x' '--prefix=/usr/local''

Important settings:
  value of $LC_ALL: nil
  value of $LC_COLLATE: nil
  value of $LC_CTYPE: nil
  value of $LC_MESSAGES: nil
  value of $LC_MONETARY: nil
  value of $LC_NUMERIC: nil
  value of $LC_TIME: nil
  value of $LANG: nil
  locale-coding-system: iso-8859-1
  default-enable-multibyte-characters: t

Major mode: Lisp Interaction

Minor modes in effect:
  encoded-kbd-mode: t
  cua-mode: t
  tooltip-mode: t
  mac-input-method-mode: t
  tool-bar-mode: t
  mouse-wheel-mode: t
  menu-bar-mode: t
  file-name-shadow-mode: t
  global-font-lock-mode: t
  font-lock-mode: t
  blink-cursor-mode: t
  unify-8859-on-encoding-mode: t
  utf-translate-cjk-mode: t
  auto-compression-mode: t
  line-number-mode: t
  transient-mark-mode: t

Recent input:
' s l i m e - s p a c e ) C-x C-e <up> <up> <up> <up>
a s d a s d a s d <down-mouse-1> <mouse-1> <double-down-mouse-1>
<double-mouse-1> SPC <down-mouse-1> <mouse-movement>
<drag-mouse-1> <down-mouse-1> <mouse-1> C-x C-e <down-mouse-1>
<mouse-1> <double-down-mouse-1> <mouse-movement> <double-mouse-1>
SPC <down-mouse-1> <mouse-1> <double-down-mouse-1>
<double-mouse-1> SPC <down-mouse-1> <mouse-1> <double-down-mouse-1>
<double-mouse-1> SPC <down-mouse-1> <mouse-movement>
<mouse-movement> <drag-mouse-1> SPC <down-mouse-1>
<mouse-movement> <mouse-movement> <drag-mouse-1> x
<backspace> <down-mouse-1> <mouse-1> <backspace> x
<down-mouse-1> <mouse-1> C-x C-e <down-mouse-1> <mouse-1>
<double-down-mouse-1> <double-mouse-1> x <down-mouse-1>
<mouse-movement> <mouse-movement> <mouse-movement>
<mouse-movement> <help-echo> <mouse-movement> <mouse-movement>
<down-mouse-1> <mouse-1> <help-echo> <down-mouse-1>
<mouse-movement> <mouse-movement> <drag-mouse-1> <down-mouse-1>
<mouse-1> <menu-bar> <help-menu> <report-emacs-bug

Recent messages:
(/Applications/Aquamacs Emacs.app/Contents/MacOS/Aquamacs Emacs -Q)
Loading encoded-kb...done
Mark set
Cua mode enabled
Mark set
Type C-x 1 to remove help window.
Symbol's function definition is void: slime-space
slime-space [2 times]
Loading emacsbug...done

reply via email to

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