1

Related:

There is a default keybinding in ESS that I accidentally trigger periodically: C-c C-e r calls inferior-ess-reload which kills and restarts my running R process. (It is close-enough to C-c C-e w ess-execute-screen-options that my finger might tap the R key.)

I know the map to which it is assigned (https://github.com/emacs-ess/ESS/blob/master/lisp/ess-mode.el#L115). I'm trying to add an unbind to a package hook, either of

(define-key ess-extra-map "\C-c\C-er" nil)
(define-key ess-extra-map (kbd "C-c C-e r") nil)

but after running those commands, C-h b and C-h C-k C-c C-e r confirm that it is still bound.

A third option would be to just comment-out those lines in ess-mode.el, but that won't survive updates.

Is there a better way to do it?

GNU Emacs 26.2 (build 1, x86_64-w64-mingw32) of 2019-04-13
ess-version: 18.10.3snapshot [elpa: 20190814.1054] (loaded from c:/Users/r2/.emacs.d/elpa/ess-20190814.1054/)

Update 1

From Drew's suggestion, here is the relevant portion of C-h b, filtering for C-c C-e:

Key translations:
key             binding
---             -------
...
C-c C-b         ess-eval-buffer
C-c C-c         ess-eval-region-or-function-or-paragraph-and-step
C-c C-d         ess-doc-map
C-c C-e         ess-extra-map
C-c C-f         ess-eval-function
...

C-c C-e C-c     Prefix Command
C-c C-e C-d     ess-dump-object-into-edit-buffer
C-c C-e C-e     ess-execute
C-c C-e TAB     ess-install-library
C-c C-e C-l     ess-load-library
C-c C-e C-r     inferior-ess-reload
C-c C-e C-s     ess-set-style
C-c C-e C-t     ess-build-tags-for-directory
C-c C-e C-w     ess-execute-screen-options
C-c C-e /       ess-set-working-directory
C-c C-e C       Prefix Command
C-c C-e d       ess-dump-object-into-edit-buffer
C-c C-e e       ess-execute
C-c C-e i       ess-install-library
C-c C-e l       ess-load-library
C-c C-e r       inferior-ess-reload
C-c C-e s       ess-set-style
C-c C-e t       ess-build-tags-for-directory
C-c C-e w       ess-execute-screen-options

...


Global Bindings:
key             binding
---             -------

...
C-c C-e         Prefix Command
...

I'm not certain why C-c C-e is shown in both "Key translations" and "Global Bindings", is that an issue?

  • Look for a keymap on one of those prefix keys, e.g. on prefix key C-c C-e. Try using that keymap instead. – Drew Sep 20 at 18:41
  • Thanks for the hint, @Drew, edits accordingly. – r2evans Sep 20 at 18:47
  • 1
    Did you try (define-key ess-extra-map "r" nil)? C-c C-e is bound to a keymap. In that keymap, r is bound to inferior-ess-reload. – Drew Sep 20 at 20:24
  • That is exactly what I need, thanks @Drew. Answer and I'll accept. (Good perspective, in that keymap, that's what I did not have in my calculus.) – r2evans Sep 20 at 21:05
1

I think you are looking for this:

(define-key ess-extra-map "r" nil)

Not this:

(define-key ess-extra-map (kbd "C-c C-e r") nil)

C-c C-e is bound to a keymap. In that keymap, r is bound to inferior-ess-reload.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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