Domanda

In Emacs, while the major mode ESS[S] (Emacs speaks statistics) is in effect, RET is automatically bound to newline-and-ident but I would prefer it to be bound to just newline. Following the advice here, I bound RET to newline. This works for editing while in ESS, but it has the undesired effect of also affecting commands in the mini-buffer. I cannot use RET to finish commands in the mini-buffer; instead, it just inserts a new line into the mini-buffer rather than executing the command.

Is there a way to bind the key in a minor mode, but also have it not affect the mini-buffer whatsoever?

Even turning the minor-mode off doesn't seem to work and it would be cumbersome to constantly switch the minor mode on and off even if it did.

This is the relevant part of my .emacs file:

(defvar my-keys-minor-mode-map (make-keymap) "my-keys-minor-mode keymap.")

(define-key my-keys-minor-mode-map (kbd "RET") 'newline)

(define-minor-mode my-keys-minor-mode
  "A minor mode so that my key settings override annoying major modes."
  t " my-keys" 'my-keys-minor-mode-map)

(my-keys-minor-mode 1)
È stato utile?

Soluzione

You have the answer in your question:

(define-key ess-mode-map (kbd "RET") 'newline)
Autorizzato sotto: CC-BY-SA insieme a attribuzione
Non affiliato a StackOverflow
scroll top