8

I am using GUI emacs 28.1 on ubuntu 22.04. Emacs won't let me reset the key C-;

I want to use:

(global-set-key (kbd "C-;") 'evil-normal-state)

Resetting the key C-. won't work either. The key C-; or C-. make a little popup with the letter "e" appear (see image below). It started to happen out of the blue, and I have no idea what it is.

Does anyone know how to stop that "e" to appear and reset C-; and C-. in emacs?

enter image description here

10
  • 2
    I suspect this key isn't getting to emacs. Are you in a linux desktop environment by any chance?
    – draxil
    May 3, 2022 at 21:32
  • Yes, I am using Ubuntu.
    – Diogo
    May 3, 2022 at 21:39
  • 1
    My wild guess is that you're triggering the compose key. Check the settings of your desktop environment, which seems to be GNOME.
    – aadcg
    May 3, 2022 at 21:50
  • 5
    It is the user-hostile GNOME emoji composition key: check the 'IBus' settings. May 3, 2022 at 22:40
  • 4
    @db48x: the user-hostility is the undiscoverable nature of the bindings. It took me a day to discover that that these bindings were set by ibus. May 4, 2022 at 12:24

2 Answers 2

7

Once you disable C-; and C-. in GNOME Desktop, those keys will become available for Emacs to use.

Use GNOME to permanently disable C-; and C-. in ibus-setup

$ ibus-setup

ibus setup

ibus emoji hotkey

Use gsettings (preferably in a M-x eshell buffer) to narrow down the GNOME component of interest

~$ gsettings list-recursively  | grep '<Control>'

org.freedesktop.ibus.panel.emoji hotkey ['<Control>period', '<Control>semicolon']
org.freedesktop.ibus.panel.emoji unicode-hotkey ['<Control><Shift>u']
org.gnome.Terminal.Legacy.Keybindings close-tab '<Control><Shift>w'
org.gnome.Terminal.Legacy.Keybindings close-window '<Control><Shift>q'
org.gnome.Terminal.Legacy.Keybindings copy '<Control><Shift>c'
org.gnome.Terminal.Legacy.Keybindings find '<Control><Shift>F'
org.gnome.Terminal.Legacy.Keybindings find-clear '<Control><Shift>J'
org.gnome.Terminal.Legacy.Keybindings find-next '<Control><Shift>G'
org.gnome.Terminal.Legacy.Keybindings find-previous '<Control><Shift>H'
org.gnome.Terminal.Legacy.Keybindings move-tab-left '<Control><Shift>Page_Up'
org.gnome.Terminal.Legacy.Keybindings move-tab-right '<Control><Shift>Page_Down'
org.gnome.Terminal.Legacy.Keybindings new-tab '<Control><Shift>t'
org.gnome.Terminal.Legacy.Keybindings new-window '<Control><Shift>n'
org.gnome.Terminal.Legacy.Keybindings next-tab '<Control>Page_Down'
org.gnome.Terminal.Legacy.Keybindings paste '<Control><Shift>v'
org.gnome.Terminal.Legacy.Keybindings prev-tab '<Control>Page_Up'
org.gnome.Terminal.Legacy.Keybindings zoom-in '<Control>plus'
org.gnome.Terminal.Legacy.Keybindings zoom-normal '<Control>0'
org.gnome.Terminal.Legacy.Keybindings zoom-out '<Control>minus'
org.gnome.desktop.wm.keybindings cycle-panels ['<Control><Alt>Escape']
org.gnome.desktop.wm.keybindings cycle-panels-backward ['<Shift><Control><Alt>Escape']
org.gnome.desktop.wm.keybindings move-to-workspace-down ['<Control><Shift><Alt>Down']
org.gnome.desktop.wm.keybindings move-to-workspace-left ['<Super><Shift>Page_Up', '<Super><Shift><Alt>Left', '<Control><Shift><Alt>Left']
org.gnome.desktop.wm.keybindings move-to-workspace-right ['<Super><Shift>Page_Down', '<Super><Shift><Alt>Right', '<Control><Shift><Alt>Right']
org.gnome.desktop.wm.keybindings move-to-workspace-up ['<Control><Shift><Alt>Up']
org.gnome.desktop.wm.keybindings switch-panels ['<Control><Alt>Tab']
org.gnome.desktop.wm.keybindings switch-panels-backward ['<Shift><Control><Alt>Tab']
org.gnome.desktop.wm.keybindings switch-to-workspace-down ['<Control><Alt>Down']
org.gnome.desktop.wm.keybindings switch-to-workspace-left ['<Super>Page_Up', '<Super><Alt>Left', '<Control><Alt>Left']
org.gnome.desktop.wm.keybindings switch-to-workspace-right ['<Super>Page_Down', '<Super><Alt>Right', '<Control><Alt>Right']
org.gnome.desktop.wm.keybindings switch-to-workspace-up ['<Control><Alt>Up']
org.gnome.settings-daemon.plugins.media-keys logout ['<Control><Alt>Delete']
~$ gsettings list-recursively  | grep '<Control>' | grep period

org.freedesktop.ibus.panel.emoji hotkey ['<Control>period', '<Control>semicolon']

~$ ~$ gsettings list-recursively  | grep '<Control>' | grep semicolon

org.freedesktop.ibus.panel.emoji hotkey ['<Control>period', '<Control>semicolon']
~$  gsettings set org.freedesktop.ibus.panel.emoji hotkey  "@as []"
1

It took me a day to discover that that these bindings were set by ibus.

There were multiple instances where I ran in to the same issue ...

For the solution to original question see https://emacs.stackexchange.com/a/71640/31220.

If you are interested in chasing down the thief that stole your Emacs keys in GNOME, read on ...

Down below

The Elisp code used to generate the Table using gsettings.el --- GSettings (Gnome) helpers

Elisp code to pry keybindings out of GNOME Settings

I am not a gsettings expert. Nevertheless, the below Emacs Lisp code will take you very far ... If something is amiss, you can fix the below code and pass it on to others.

(require 'dash)
(require 'rx)
(require 'gsettings)
(with-current-buffer
    (generate-new-buffer "*Gsettings*")
  (pop-to-buffer (current-buffer))
  (org-mode)
  (let ((case-fold-search t))
    (save-excursion
      (->>
       "list-recursively"
       gsettings--run
       gsettings--split-lines
       (--map
    (cond
     ((string-match (rx-to-string
             '(and (group (one-or-more (not " ")))
                   (one-or-more " ")
                   (group (one-or-more (not " ")))
                   (one-or-more " ")
                   (group (one-or-more any))))
            it)
      (list (match-string 1 it)
        (match-string 2 it)
        (match-string 3 it)))
     (t (user-error "This shouldn't happen"))))
       (--select (and
          (let ((parsed (gvariant-parse (nth 2 it))))
            (not (and (consp parsed)
                  (eq (car parsed) 'parsec-error))))
          (or (string-match-p (rx-to-string
                       '(and "<"
                         (one-or-more any)
                         ">"))
                      (nth 2 it))
              (string-match-p (rx-to-string
                       '(and "Keybindings"))
                      (nth 0 it)))))
       (--map (let* ((bindings (gvariant-parse (nth 2 it))))
        (cond
         ((vectorp bindings)
          (let ((prefix it))
            (--map (append (list it) (butlast prefix)) bindings)))
         (t
          (list (append (list bindings) (butlast it)))))))
       (-flatten-n 1)
       (--map (cons (format "%s" (car it)) (cdr it)))
       (--tree-map (format "%s" it))
       (--map (format "| %s |\n" (mapconcat #'identity it " | ")))
       (apply #'insert))))
  (org-table-align)
  (sort-lines nil (point-min) (point-max))
  (save-excursion
    (insert (format "|%s|%s|%s|\n" "Key Binding" "Schema" "Key"))
    (insert (format "|-\n")))
  (org-table-align))

Your Answer

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.