views:

157

answers:

3

I have a strange interaction with tramp and cygwin-mount (I think: http://stackoverflow.com/questions/1705802/emacs-tab-completion-of-file-name-appends-an-extra-i-cygwin). Because of this, I want to disable tramp. I'm unable to find anything in my .emacs which is loading tramp explicitly. I can see "Loading tramp..." when I hit a tab in the find-file minibuffer. I'd like to figure out what package is causing the loading of tramp and disable that. How do I go about doing this? I tried searching for (require 'tramp) but couldn't find anything interesting. The only other option I can think of is to comment out bits of my .emacs one-by-one and see which one works - but this is so brute-force, I'd like a cleverer (and easier) way.

+1  A: 

Instrument find-file for debugging and/or instrument your init file for debugging. Then you can step through the loading and see where the tramp stuff is loaded.

Friedrich
This looks like what I want to do - but I don't know how to do this. Can you give me some details, please? I did some googling for instrument emacs code for debugging and it seems like you're suggesting that I use edebug-defun - is this correct? From looking at tramp.el, it doesn't look like tramp has a single entry point function I can instrument. Some more details would be really useful, considering that I'm an emacs newbie.
Rohith
Well I think pajato0 has made that unimportant. However I have written or stolen the following code:(defun find-symbol-at-point () "Find the source of either the function or variable at point." (interactive) (or (find-function-at-point) (find-variable-at-point)))I bound this to F5 and now I just go to a function type F5 and get where it was defined I then just instrument this function for debugging.
Friedrich
+8  A: 

What a great question! If only because I was not aware of the function (eval-after-load file form) which will enable you to write code like the following and put it in your .emacs file:

(eval-after-load "tramp"
  '(debug))

Which will, in brute force form, vomit a backtrace in your window and reveal the offending library.

pajato0
Neat trick, love it!
paprika
I did not know that either, seems to be exactly what Rhith was looking for.
Friedrich
Awesome, pajato0. This really helped me narrow down the problem and saved me at least a day of troubleshooting. Plus I learned a lot more about emacs in the bargain too! Thank you all for all your answers and help.
Rohith
A: 

I think you'll find that tramp is turned on by default. If you do:

M-x customize-apropos
Customize (regexp): tramp

('Customize (regexp):' is the prompt from emacs) you'll see two variables listed (at least I do in emacs 23), something like:

alt text

If you set tramp-mode to 'off', save for future sessions, and restart emacs tramp should no longer be loaded. I believe you can just turning it off in the current session should allow you to test this, but this doesn't always work with customize variables, although it should do with something like tramp that is part of the standard emacs distribution.

I don't have emacs 22 installed any more, but something similar should work for that too.

Peter Hart