1

I am writing latex code with AUCTEX. I very often highlight text in bold or italics.

For instance, AUCTEX comes with the command C-c C-f C-e, wich can be used to emphasize text in an active marked region. That is, it would replace the marked text text with \emph{text}.

I used Aquamacs before, where I was able to hold the CMD key, and then press c, then f, then e within some reasonable time (a few seconds). Then the mode line would show that the sequence C-c C-f C-e was entered, and perform the correct command.

I switched to Gnu Emacs on MacOS recently, where this seems not to work as desired anymore. Concretely, it works only if I hold CMD, and then c,f,e extremely quickly (so quickly that I fail 50% of my attempts).

Pressing C-c, then releasing all keys, then C-f, releasing all, then C-e does not work either. Instead, the command bound to C-f is executed, ignoring the prior C-c.

Is this expected behavior of emacs?

The only non-standard keyboard configuration in my .emacs is that I have re-bound the key C-f for convenience as follows:

(global-set-key (kbd "C-f") 'isearch-forward)
(define-key isearch-mode-map "\C-f" 'isearch-repeat-forward)

However, I think this should not matter, provided that I have pressed C-c immediately before C-f?

I have tried to find a way to configure emacs to behave as described above for Aquamacs, but only found key chords, which seems to be something else. Thanks in advance for any help.

1 Answer 1

0

Try lowering the value of option echo-keystrokes to fewer seconds (e.g., 0.5).

C-h v echo-keystrokes:

echo-keystrokes is a variable defined in C source code.

Its value is 1

Documentation:

Nonzero means echo unfinished commands after this many seconds of pause.

The value may be integer or floating point. If the value is zero, don't echo at all.

You can customize this variable.

3
  • Thank you! This helped to narrow down what is happening. Unfortunately, it still does not achieve the expected behavior. When no region is active, then C-c C-f C-e works as expected, \emph{} is inserted. Good so far! But often I want to enclose already written text within an \emph{}. Then I would make a region "active" and press C-c C-f C-e. If I am not very quick, then the region becomes inactive after pressing C-c, with no other effect, and then the command bound to C-f is executed. It seems I want to configure emacs such that an active region stays active after C-c?
    – user64060
    Commented Apr 5, 2019 at 7:32
  • That sounds like a different, unrelated problem. This sounds like a bug. Typing a prefix key should not deactivate the region. The region gets deactivated after each command (typically), but not after hitting a prefix key. Do you see the same problem if you start Emacs with emacs -Q (no init file), then loading vanilla AUCTeX? If not then bisect your init file to find the cause.
    – Drew
    Commented Apr 5, 2019 at 14:54
  • Thanks! Will try that at some point, but I got used to this by now...!
    – user64060
    Commented Apr 6, 2019 at 19:38

Your Answer

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

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