When I'm editing a file in LaTeX-mode (I guess it means AUCTeX), and the flyspell is enabled, then M-TAB is not responding. I cannot get completion of standard LaTeX commands - for example it won't complete \newc to \newcommand.

I couldn't find information about this around... I'm using Aquamacs with 23.3.1 Emacs on Mac OS X.

migrated from superuser.com Aug 19 '11 at 6:57

This question came from our site for computer enthusiasts and power users.

  • I'm not sure this should have been migrated: It's more in SU's area of competence that it is ours... – Seamus Aug 19 '11 at 8:43
  • I posted it there in the first place, about 3 months ago, after someone here suggested that this kind of question should be posted there. It wasn't helpful. I think this is an on-topic question, and that the chances it will be answered here are higher. – Dror Aug 19 '11 at 8:50
  • From my experience of emacs questions, they don't get answered much. There are only a dozen or so emacs users on here regularly and none of us is that experienced. Whether or not it is on topic is immaterial really: there are more people who know more about emacs on SU than there are here. – Seamus Aug 19 '11 at 10:52
  • As this question was there (i.e. on SU) for quite a while, I asked to try and migrate it here. In any case, if there will be enough people voting to return it to SU - it will happen :) – Dror Aug 19 '11 at 11:34

What does M-TAB do - anything? Is there a key combination mentioned in your LaTeX menu after "Complete Macro"? The lisp function which should be called is "TeX-complete-macro". Try running it manually by typing


and leave the cursor after this and do

M-x TeX-complete-macro

If this works, then you can probably just rebind the key in your .emacs with

(add-hook 'TeX-mode-hook (lambda () (define-key TeX-mode-map "<M-tab>" 'TeX-complete-macro)))

Update: It seems there is a flyspell variable which controls this: flyspell-use-meta-tab. You can probably set this to nil and it will then work.

  • For some reason I don't have M-x TeX-complete-macro. However, when typing \newc M-TAB, if flyspell-mode is disabled, then it auto completes to \newcommand. If flyspell is enabled this doesn't work, and it tries to correct the spelling. I guess there's a conflict between the key bindings which I don't know how to solve. Thanks in advance and for the answer. – Dror Oct 27 '11 at 10:26
  • This sounds to me like you dont' have AUCTeX but only some basic LaTeX mode? What happend if you do: M-x find-library and then look for auctex.el? – PLK Oct 27 '11 at 12:06
  • It seems like it opens the file auctex.el. I do think that auctex is installed as I can use features like C-C C-e to generate environment or C-c C-s to generate sectioning level. – Dror Oct 27 '11 at 13:04
  • Hmm this is sounding like you might have an old version of AUCTeX. If you do M-h v (describe variable) and then type "AUCTeX-version", what version do you see? – PLK Oct 27 '11 at 19:14
  • 2
    I just noticed that there is a variable for this in flyspell. Try to change "flyspell-use-meta-tab" to nil. C-h v flyspell-use-meta-tab will give you a link to customise this. – PLK Oct 31 '11 at 11:26

FlySpell has a variable that controls that behaviour: flyspell-use-meta-tab. The documentation says: Non-nil means that FlySpell uses M-TAB to correct word. So just put this on your .emacs file:

(setq flyspell-use-meta-tab nil)

The folks on the AUCTeX-Mailinglist ( http://www.mail-archive.com/auctex@gnu.org/info.html ) answer questions like this, usually.

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.