2

My scenario: I am editing a file remotely when I decide to switch tasks and run mysql as a subprocess using sql-interactive mode. Tramp tries to start the mysql client from the remote machine, where its not installed.

I would like to configure emacs so it always runs certain executables, such as mysql, locally and not from the tramp remote machine. How can I do this?

benhsu
  • 5,346
  • 8
  • 39
  • 47
  • I usually just switch to some buffer, opened locally, and then Tramp gives up running things on remote computer (or, maybe I need to switch to a buffer with local shell). Anyway, this may not be the best solution, but usually isn't a problem. –  Jul 30 '13 at 15:51

1 Answers1

3

Tramp kicks in if the value of the variable default-directory (which if set becomes buffer-local) is in Tramp format. You can do something like this to ensure it gets reset to point to your local home directory wherever you need to run mysql:

(defadvice sql-mysql (around sql-mysql-around activate)
  "Reset to local home, then connect"
  (let ((default-directory "/home/me"))
    ad-do-it))

The code assumes you you use sql-mode to launch mysql.

Alex Vorobiev
  • 4,349
  • 21
  • 29