From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.ciao.gmane.io!not-for-mail From: Federico Tedin Newsgroups: gmane.emacs.devel Subject: Re: INSIDE_EMACS and Tramp Date: Fri, 17 Apr 2020 22:16:36 +0200 Message-ID: <87a7397tqz.fsf@gmail.com> References: <20200402230535.10490.95720@vcs0.savannah.gnu.org> <20200402230536.E0A3F20CDD@vcs0.savannah.gnu.org> <87lfndarwh.fsf_-_@gmx.de> <87blo78exg.fsf@gmx.de> <871rp357s1.fsf@gmail.com> <87lfmzg3ds.fsf@gmx.de> Mime-Version: 1.0 Content-Type: text/plain Injection-Info: ciao.gmane.io; posting-host="ciao.gmane.io:159.69.161.202"; logging-data="9721"; mail-complaints-to="usenet@ciao.gmane.io" User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/26.3 (gnu/linux) Cc: emacs-devel@gnu.org To: Michael Albinus Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane-mx.org@gnu.org Fri Apr 17 22:17:34 2020 Return-path: Envelope-to: ged-emacs-devel@m.gmane-mx.org Original-Received: from lists.gnu.org ([209.51.188.17]) by ciao.gmane.io with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1jPXQb-0002PN-G8 for ged-emacs-devel@m.gmane-mx.org; Fri, 17 Apr 2020 22:17:33 +0200 Original-Received: from localhost ([::1]:51560 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1jPXQa-00054A-Hw for ged-emacs-devel@m.gmane-mx.org; Fri, 17 Apr 2020 16:17:32 -0400 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]:50075) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1jPXPm-0004Dt-Ke for emacs-devel@gnu.org; Fri, 17 Apr 2020 16:16:43 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1jPXPl-0002Bh-IF for emacs-devel@gnu.org; Fri, 17 Apr 2020 16:16:42 -0400 Original-Received: from mail-wm1-x32a.google.com ([2a00:1450:4864:20::32a]:39439) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1jPXPl-00029G-6T for emacs-devel@gnu.org; Fri, 17 Apr 2020 16:16:41 -0400 Original-Received: by mail-wm1-x32a.google.com with SMTP id y24so4315137wma.4 for ; Fri, 17 Apr 2020 13:16:40 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:references:date:in-reply-to:message-id :user-agent:mime-version; bh=Th8FsOWeyfivDBE9AJSdnmtdGVOd6XM3gQlKCPDB6Yg=; b=i7ZXPbDdROy8HNY7wjYEHMSagDRIdtijX3LtHyKD3lDQhWJeiBaCI48h2020UaA2Rz ByamrPjijz0T1qjbkl5dDXtkYgWOC43r2l1oX819rakebyMB2pSQhl7fPSSekxyTDjUK tscyAIA8Cfr0S17YkK1g1lpJmFwZQZIPTM+tlDfVml6mp43riygx4X7ycOVXs8n/CPu+ gf8ZzSk6tEno2mhapmBz7YqBgWdAjcf9IcEppCP8eM7/kIxJF78lLT63oZi3RyvQ4wWh 5cOmMGDglq0JWgl/1Z2XBJFT+u+HlNH7Jd/1+yie9pVK7nuGv5jxiYNu8MBJG1EDkU3V Vjeg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:references:date:in-reply-to :message-id:user-agent:mime-version; bh=Th8FsOWeyfivDBE9AJSdnmtdGVOd6XM3gQlKCPDB6Yg=; b=DISjxIlCWnotWP3yuKdGVaJVfygK2zX178XgoroowElvtMVkEtv91HKYJP9Q81lE3O +3IXQoWTQouNtpIZgINCEVF0mHrT+1vGWUolLhRLwDfzqqcjw8TrQCMtDpTHGX01KqUf qj6quR1Cju4vIe8ccPtHLdOOhXRzx+wF/S/iksn3DpXrP0vWGT/7+HwOB0weOlum4BkD 8zxMsB3jNH24m3hmPCunWexm5HecKYqGG65wNjIzKBPymSFR8yWJt28U0CDBhCZQcuhz wj5kAaJv0JsdOI+tmiP+9RBnoE3GafexIXq//gbujGV3cuO4amjXfFhDl3WPTFn49LVS pi5g== X-Gm-Message-State: AGi0PubwBYdlnNfll2/YYkYEKMPg1mKKeJqfzM4xJTpmF1q0tWitXsIX PRNLJoVWW5arIRC4lnfFqgki65hg X-Google-Smtp-Source: APiQypJiEEGXA2d80A1+GeCtI/N5VC/Wl+AraRKV71CdNt1WIOrLJmMksXAIXGd7fTqN/pd9A8ENzg== X-Received: by 2002:a7b:c417:: with SMTP id k23mr5189812wmi.147.1587154599214; Fri, 17 Apr 2020 13:16:39 -0700 (PDT) Original-Received: from lead ([2a02:8109:8ac0:2ff0:7077:607d:3f1f:454e]) by smtp.gmail.com with ESMTPSA id g25sm8982570wmh.24.2020.04.17.13.16.37 (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Fri, 17 Apr 2020 13:16:38 -0700 (PDT) In-Reply-To: <87lfmzg3ds.fsf@gmx.de> (Michael Albinus's message of "Mon, 13 Apr 2020 11:07:43 +0200") X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 2a00:1450:4864:20::32a X-BeenThere: emacs-devel@gnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "Emacs development discussions." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: emacs-devel-bounces+ged-emacs-devel=m.gmane-mx.org@gnu.org Original-Sender: "Emacs-devel" Xref: news.gmane.io gmane.emacs.devel:247201 Archived-At: Hi Michael, > I don't believe a global variable would fly. In Eshell, for example, > this variable must be changed whenever the default-directory is changed > (being a local or a remote file name). Tramp is not involved, when you > change the default-directory. > > Instead, there might be a hook which is called whenever your > inside-emacs function is applied. Something like this: > > (defvar inside-emacs-hook nil) > > (defun inside-emacs (&optional context) > (mapconcat > #'identity > (delq nil `(,emacs-version > ,@(when (stringp context) (list context)) > ,(run-hook 'inside-emacs-hook))) > ",")) > > (add-hook > 'inside-emacs-hook > (lambda () > (when (file-remote-p default-directory) '("tramp:2.5.0-pre")))) > > The add-hook call would be implemented in Tramp itself. > > Best regards, Michael. OK, I see that it is more useful in this case to have a list of functions that are called rather than a fixed list of strings. However I didn't understand your use of `run-hooks' - wouldn't this function call return nil in all cases? What would be an easy way of getting the results of calling all the hooks? - Fede