unofficial mirror of emacs-devel@gnu.org 
 help / color / mirror / code / Atom feed
From: Michael Albinus <michael.albinus@gmx.de>
To: Federico Tedin <federicotedin@gmail.com>
Cc: emacs-devel@gnu.org
Subject: Re: INSIDE_EMACS and Tramp
Date: Mon, 13 Apr 2020 11:07:43 +0200	[thread overview]
Message-ID: <87lfmzg3ds.fsf@gmx.de> (raw)
In-Reply-To: <871rp357s1.fsf@gmail.com> (Federico Tedin's message of "Sat, 04 Apr 2020 22:13:18 +0200")

Federico Tedin <federicotedin@gmail.com> writes:

Hi Federico,

> Aah OK, so then this mechanism for generating the value for INSIDE_EMACS
> needs to be more general. How about something like:
>
> (defvar inside-emacs-extras nil)
>
> (defun inside-emacs (&optional context)
>   (mapconcat #'identity `(,emacs-version
> 			  ,@(when context (list context))
> 			  ,@inside-emacs-extras)
> 	     ","))
>
> So in Eshell we would call (inside-emacs "eshell"), and Tramp could
> optionally add "tramp:2.5.0-pre" to inside-emacs-extras sometime before
> the function is called. Other parts of Emacs could add extras as well
> (and at some point remove them, I suppose). Do you think something like
> this would make sense given how Tramp works internally?

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:

--8<---------------cut here---------------start------------->8---
(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"))))
--8<---------------cut here---------------end--------------->8---

The add-hook call would be implemented in Tramp itself.

Best regards, Michael.



  reply	other threads:[~2020-04-13  9:07 UTC|newest]

Thread overview: 22+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <20200402230535.10490.95720@vcs0.savannah.gnu.org>
     [not found] ` <20200402230536.E0A3F20CDD@vcs0.savannah.gnu.org>
2020-04-03  8:35   ` INSIDE_EMACS and Tramp (was: master f28166d: Copy INSIDE_EMACS env variable to subprocesses in Eshell (Bug#25496)) Michael Albinus
2020-04-04 14:53     ` Federico Tedin
2020-04-04 15:10       ` INSIDE_EMACS and Tramp Michael Albinus
2020-04-04 20:13         ` Federico Tedin
2020-04-13  9:07           ` Michael Albinus [this message]
2020-04-17 20:16             ` Federico Tedin
2020-05-02 14:54               ` Michael Albinus
2020-05-02 15:39                 ` Eli Zaretskii
2020-05-02 16:04                   ` Michael Albinus
2020-05-02 16:17                     ` Eli Zaretskii
2020-05-02 16:16                 ` Eli Zaretskii
2020-05-02 17:20                 ` Stefan Monnier
2020-05-03 12:33                   ` Michael Albinus
2020-05-03 14:51                     ` Stefan Monnier
2020-05-03 16:08                       ` Michael Albinus
2020-05-03 20:54                         ` Stefan Monnier
2020-05-04  7:08                           ` Michael Albinus
2020-05-04  8:47                             ` Michael Albinus
2020-05-04 15:38                               ` Stefan Monnier
2020-05-04 16:11                                 ` Michael Albinus
2020-05-03 14:52                 ` Federico Tedin
2020-05-03 16:19                   ` Michael Albinus

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://www.gnu.org/software/emacs/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=87lfmzg3ds.fsf@gmx.de \
    --to=michael.albinus@gmx.de \
    --cc=emacs-devel@gnu.org \
    --cc=federicotedin@gmail.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).