From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!.POSTED.blaine.gmane.org!not-for-mail From: Bruno Barbier Newsgroups: gmane.emacs.help Subject: Re: How to let tramp be aware the virtualenv? Date: Tue, 16 Jul 2019 21:22:50 +0200 Message-ID: <5d2e15b2.1c69fb81.02bd.de51@mx.google.com> References: Mime-Version: 1.0 Content-Type: text/plain Injection-Info: blaine.gmane.org; posting-host="blaine.gmane.org:195.159.176.226"; logging-data="24880"; mail-complaints-to="usenet@blaine.gmane.org" To: Zhongwei Yao , help-gnu-emacs@gnu.org Original-X-From: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Tue Jul 16 20:21:47 2019 Return-path: Envelope-to: geh-help-gnu-emacs@m.gmane.org Original-Received: from lists.gnu.org ([209.51.188.17]) by blaine.gmane.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.89) (envelope-from ) id 1hnS5C-0006Ol-Rb for geh-help-gnu-emacs@m.gmane.org; Tue, 16 Jul 2019 20:21:47 +0200 Original-Received: from localhost ([::1]:51586 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.86_2) (envelope-from ) id 1hnS5B-0002nV-QL for geh-help-gnu-emacs@m.gmane.org; Tue, 16 Jul 2019 14:21:45 -0400 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]:57093) by lists.gnu.org with esmtp (Exim 4.86_2) (envelope-from ) id 1hnS58-0002nO-Bx for help-gnu-emacs@gnu.org; Tue, 16 Jul 2019 14:21:43 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1hnS57-0000sr-Cm for help-gnu-emacs@gnu.org; Tue, 16 Jul 2019 14:21:42 -0400 Original-Received: from mail-wr1-x431.google.com ([2a00:1450:4864:20::431]:37394) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1hnS57-0000sE-3d for help-gnu-emacs@gnu.org; Tue, 16 Jul 2019 14:21:41 -0400 Original-Received: by mail-wr1-x431.google.com with SMTP id n9so22007716wrr.4 for ; Tue, 16 Jul 2019 11:21:40 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=message-id:from:to:subject:in-reply-to:references:date:mime-version; bh=Fs5nCU4Ix791fTAKOTfDL0opJaVkTY/oqzlmQLeFwU8=; b=kXll/4j0Kng9OBHqHmdp+XP7sDH1eWZHNohJCjV03CMcnbJHfqo3LUbrrd+hw3LVbo drmLDxqAdtWMQgsNfk4/75Udxn1C+6yduY/o3B6itO4aGFcP5aYW8J6tI/xgu/vTilJT q8/0oULmqlSnJjTze4ay2nod2YyH7FoXNpTkT5S6kIspdmGE6MOoeogeH+1fp4mSG8DG HRKh539PIfeYAVIlGEVTAJFbyUQnzkjjVyEn0p4yLNCmNL5qRglzYYuxBEgDxzBM7HKk vY2qaRH5WzUdFdQnfBrO2KOIplUmjRthf5rnsaINUGF6BKR8OjRM3DNWMkNVsqsow2Zz v07A== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:message-id:from:to:subject:in-reply-to :references:date:mime-version; bh=Fs5nCU4Ix791fTAKOTfDL0opJaVkTY/oqzlmQLeFwU8=; b=tpoH1hQS5n1TNl9SjA2aNB66wxudwy+6ut/KuVnI6jNcv/1zX2zKjxr/I6Up16GGJt PMDOpjRM9f1qx43axujOXrjMC0rDQSd1uLRV+8Mp5PEA1zcrVHxzMwqTg7BKd0LMNTpI zy3PnKW5uFvQRXdQXuFYl4KaPvuKTCxV5TYpPTIzwFQocEFJdH7mG3n9ii2LSv0G2SNN pDSF2K7TwziqyVGad5rNZIc/XiM9fstAYymz7diQiILK2q6fLx3R/c3hDv/y+NkF9uQS 8IJCvwrg/c73mbboPpemD/c6ueLDCLmX0H82RxGmXD+K4pWfxlnbYSsJ4oI72h+ZeBWo fRUw== X-Gm-Message-State: APjAAAV/uM1ZS+Sahmvcb0Afi0SdvmgG+QZK9hvY0oN0JobqzX3Q9qJP Rf0K7g4xIKoKAV7foXzhiek= X-Google-Smtp-Source: APXvYqwgtG4yhALEgVe7Pga3bO1VATfaZdeadSZ9nYQhlhx/oSB0ltyX5X9e39E4myu4ewBaAKyq0g== X-Received: by 2002:a5d:6949:: with SMTP id r9mr35341555wrw.73.1563301299099; Tue, 16 Jul 2019 11:21:39 -0700 (PDT) Original-Received: from tosh-laptop ([2a01:e0a:77:5500:198:efdf:4d36:80dc]) by smtp.gmail.com with ESMTPSA id e6sm22178004wrw.23.2019.07.16.11.21.36 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Tue, 16 Jul 2019 11:21:38 -0700 (PDT) Original-Received: by tosh-laptop (sSMTP sendmail emulation); Tue, 16 Jul 2019 21:22:50 +0200 In-Reply-To: X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 2a00:1450:4864:20::431 X-BeenThere: help-gnu-emacs@gnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: Users list for the GNU Emacs text editor List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Original-Sender: "help-gnu-emacs" Xref: news.gmane.org gmane.emacs.help:121181 Archived-At: Hi Zhongwei, Zhongwei Yao writes: > Hi, all, > I try to use tramp on a remote project directory and run "M-x compile". The > command requires to know which the python virtualenv is active. > > I try to let tramp be ware of which virtualenv is active by adding a line > to the remote $HOME/.profile like (because it seems tramp will run the > compilation command by the remote /bin/sh): > > source my/python/virtualenv/bin/activate. > > But tramp seems doesn't read that line at all. The virtualenv is not > activated. > > So how can I make tramp aware of which virtualenv is enabled? > > Thanks! > Zhongwei Are you using SSH to connect ? If so, you might be able to configure SSH to do it. In your ~/.ssh/config (or where your ssh config is), add something like this: Host a-nice-and-very-short-name HostName 169.254.1.2 RequestTTy force RemoteCommand sh -c 'source my/python/virtualenv/bin/activate; bash -l' Then, using tramp, it should just work: /ssh:a-nice-and-very-short-name:/path/to/your-project Bruno