6

Say I'd like to re-bind C-x 8 x to ξ. So I do:

(global-set-key (kbd "C-x 8 x") (lambda () (interactive) (insert "ξ")))

but it doesn't work: it still inserts the default x sign. Then I tried both:

(global-unset-key (kbd "C-x 8 x"))
(global-set-key (kbd "C-x 8 x") nil)

none gives any effect.

Edit:

Here's what I'm using now for Greeks:

(define-key 'iso-transl-ctl-x-8-map "a" [?α])
(define-key 'iso-transl-ctl-x-8-map "b" [?β])
(define-key 'iso-transl-ctl-x-8-map "g" [?γ])
(define-key 'iso-transl-ctl-x-8-map "d" [?δ])
(define-key 'iso-transl-ctl-x-8-map "e" [?ε])
(define-key 'iso-transl-ctl-x-8-map "z" [?ζ])
(define-key 'iso-transl-ctl-x-8-map "h" [?η])
(define-key 'iso-transl-ctl-x-8-map "o" [?θ])
(define-key 'iso-transl-ctl-x-8-map "i" [?ι])
(define-key 'iso-transl-ctl-x-8-map "k" [?κ])
(define-key 'iso-transl-ctl-x-8-map "l" [?λ])
(define-key 'iso-transl-ctl-x-8-map "m" [?μ])
(define-key 'iso-transl-ctl-x-8-map "n" [?ν])
(define-key 'iso-transl-ctl-x-8-map "x" [?ξ])
(define-key 'iso-transl-ctl-x-8-map "p" [?π])
(define-key 'iso-transl-ctl-x-8-map "r" [?ρ])
(define-key 'iso-transl-ctl-x-8-map "s" [?σ])
(define-key 'iso-transl-ctl-x-8-map (kbd "M-s") [?ς])
(define-key 'iso-transl-ctl-x-8-map "x" [?ξ])
(define-key 'iso-transl-ctl-x-8-map "t" [?τ])
(define-key 'iso-transl-ctl-x-8-map "y" [?υ])
(define-key 'iso-transl-ctl-x-8-map "f" [?φ])
(define-key 'iso-transl-ctl-x-8-map "v" [?χ])
(define-key 'iso-transl-ctl-x-8-map "j" [?ψ])
(define-key 'iso-transl-ctl-x-8-map "w" [?ω])
(define-key 'iso-transl-ctl-x-8-map "A" [?Α])
(define-key 'iso-transl-ctl-x-8-map "B" [?Β])
(define-key 'iso-transl-ctl-x-8-map "G" [?Γ])
(define-key 'iso-transl-ctl-x-8-map "D" [?Δ])
(define-key 'iso-transl-ctl-x-8-map "E" [?Ε])
(define-key 'iso-transl-ctl-x-8-map "Z" [?Ζ])
(define-key 'iso-transl-ctl-x-8-map "H" [?Η])
(define-key 'iso-transl-ctl-x-8-map "O" [?Θ])
(define-key 'iso-transl-ctl-x-8-map "I" [?Ι])
(define-key 'iso-transl-ctl-x-8-map "K" [?Κ])
(define-key 'iso-transl-ctl-x-8-map "L" [?Λ])
(define-key 'iso-transl-ctl-x-8-map "M" [?Μ])
(define-key 'iso-transl-ctl-x-8-map "N" [?Ν])
(define-key 'iso-transl-ctl-x-8-map "X" [?Ξ])
(define-key 'iso-transl-ctl-x-8-map "P" [?Π])
(define-key 'iso-transl-ctl-x-8-map "R" [?Ρ])
(define-key 'iso-transl-ctl-x-8-map "S" [?Σ])
(define-key 'iso-transl-ctl-x-8-map "T" [?Τ])
(define-key 'iso-transl-ctl-x-8-map "Y" [?Υ])
(define-key 'iso-transl-ctl-x-8-map "F" [?Φ])
(define-key 'iso-transl-ctl-x-8-map "V" [?Χ])
(define-key 'iso-transl-ctl-x-8-map "J" [?Ψ])
(define-key 'iso-transl-ctl-x-8-map "W" [?Ω])
0

2 Answers 2

6

You have to set the key in iso-transl-ctl-x-8-map. Such as:

(eval-after-load 'iso-transl
  '(define-key iso-transl-ctl-x-8-map "x" "ξ"))

That's because C-x 8 is actually defined in key-translation-map, which overrides the global map.

4
  • Doesn't work: on start up I get Symbol's value as variable is void: iso-transl-ctl-x-8-map and hence Debugger entered--Lisp error: (wrong-number-of-arguments (lambda nil (interactive) (insert "ξ")) 1) (lambda nil (interactive) (insert "ξ"))(nil) when trying to input the thing.
    – Adobe
    Sep 8, 2012 at 16:18
  • I also tried (define-key key-translation-map (kbd "<iso-transl-ctl-x-8-map> t") (lambda () (interactive) (insert "ξ"))) and (define-key key-translation-map (kbd "iso-transl-ctl-x-8-map t") (lambda () (interactive) (insert "ξ"))) -- none works.
    – Adobe
    Sep 8, 2012 at 16:19
  • sure, you need to to make sure it's loaded before you use it (by using (require 'iso-transl) first, for example). I'm modifying the snippet to delay the key definition.
    – Sigma
    Sep 8, 2012 at 16:21
  • now it doesn't complain about the map -- but still doesn't work -- when I try to insert a thing -- it still gives same error. ?
    – Adobe
    Sep 8, 2012 at 16:25
0

Oh I found another way:

(define-key 'iso-transl-ctl-x-8-map "x" [?ξ])

reference.

Your Answer

Reminder: Answers generated by Artificial Intelligence tools are not allowed on Stack Overflow. Learn more

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.