1

Recently my TAB key started acting very strange. At the left end of the line it indents my code normally, which it should also do if I hit TAB anywhere in the line. But now, if I'm in the middle of the line it tries to do a TAGS search. I don't have a tags file and I don't want one, thank you very much. I'm using Prelude and believe it has to do with Projectile, which I've never used. When I ask emacs what the keybinding of the TAB key is with C-h k, it lies and says:

It is bound to TAB.

(indent-for-tab-command &optional ARG)

When I saw this last week I disabled Projectile mode and that helped but now it doesn't seem to help. How can I find out what's binding this key and get rid of it?

  • 1
    Does it happen in all major modes? To see exactly what keys you are hitting, reproduce that problem and immediately hit C-h l or M-x view-lossage. That will show you your last 300 key presses. – Kaushal Modi Oct 3 '15 at 2:14
  • 1
    Too many unknowns. Did you change Emacs builds? Clearly you are using Projectile. Start with emacs -Q. If that doesn't show the behavior then recursively bisect your init file to find the culprit code or setting. If you don't know what code you are using then how can we? Use M-x comment-region to comment out 1/2, then 3/4, 5/6,... of your init file, to find the cause. – Drew Oct 3 '15 at 3:12
1

indent-for-tab-command is a dispatcher for other functions. TAB can still be bound to that and not do what you were expecting.

If you read the help, it tells you:

The function called to actually indent the line or insert a tab is given by the variable indent-line-function.

(assuming no active region or prefix argument, as also covered in the help.)

Without looking at the value of that variable, you (and we) can't know what's actually happening.

If it's still a mystery, then figure out which tags function is being called, trigger the debugger on that (using M-x debug-on-entry), and take a look at the stack trace when it gets called.

Use M-x cancel-debug-on-entry once you no longer need it.

  • Ah yes, web-mode-indent-line. – chetstone Oct 3 '15 at 17:46
  • Hm. StackExchange saved that comment before I was finished with it and then cut me off when I tried to edit saying comments can only be edited for 5 minutes. Anyway, I didn't see anything in web-mode-indent-line that looked like it was invoking TAGS. Stepping through it in the debugger, it eventually got to TAG invocation but I didn't see how it got there. Then I decided to quit and restart emacs and that fixed it. :-{} – chetstone Oct 3 '15 at 18:04

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.