emacs-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: INSIDE_EMACS and Tramp


From: Michael Albinus
Subject: Re: INSIDE_EMACS and Tramp
Date: Sun, 03 May 2020 14:33:02 +0200
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/28.0.50 (gnu/linux)

Stefan Monnier <address@hidden> writes:

>> +(defvar inside-emacs-functions nil
> [...]
>> +(defun inside-emacs (&optional context)
>> +  "Return the string to be set in environment variable INSIDE_EMACS.
>> +CONTEXT could be a string which is added."
>> +  (mapconcat
>> +   #'identity
>> +   (delq nil (append `(,emacs-version
>> +                   ,(and (stringp context) context))
>> +                 (mapcar #'funcall inside-emacs-functions)))
>> +   ","))
>
> Any chance we could live without `inside-emacs-functions` and instead do:
>
>     (defun inside-emacs (&optional context)
>       "Return the string to be set in environment variable INSIDE_EMACS.
>     CONTEXT could be a string which is added."
>       (let ((base (or (getenv "INSIDE_EMACS") emacs-version)))
>         (if context (concat case "," context) base)))

No. The point is that it is dynamic, whether Tramp needs to add a
substring to INSIDE_EMACS, or not. Compare

--8<---------------cut here---------------start------------->8---
(let ((default-directory "/"))
  (inside-emacs "foo"))

=> "28.0.50,foo"
--8<---------------cut here---------------end--------------->8---

--8<---------------cut here---------------start------------->8---
(let ((default-directory "/ssh::/"))
  (inside-emacs "foo"))

=> "28.0.50,foo,tramp:2.5.0-pre"
--8<---------------cut here---------------end--------------->8---

> -- Stefan

Best regards, Michael.



reply via email to

[Prev in Thread] Current Thread [Next in Thread]