2011-04-17

map F5 to emacs's C-x while ignore cua-mode

if i want to set F5 to emacs's C-x and F6 to emacs's C-c, how to do that?

i know i can use key-translation-map or function-key-map, something like
(define-key key-translation-map (kbd "") "")

but i also want it so that if cua-mode is on, it unconditionally do emacs's C-x, not cut.

i thought it's something like this

(defun f5-Cx ()
"DOCSTRING"
(interactive)
(let (cuaModeState cua-mode)
(cua-mode 0)
;; type C-x here
(if cuaModeState (cua-mode 1) (cua-mode 0))
))
)

but not sure how to do the “type C-x” there. Even so, not sure the whole would work.

Thanks.

Xah

1 comment:

  1. (global-set-key (kbd "<f5>") 'Control-X-prefix)

    ReplyDelete