emacs-devel
[Top][All Lists]
Advanced

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

Re: INSIDE_EMACS and Tramp


From: Federico Tedin
Subject: Re: INSIDE_EMACS and Tramp
Date: Fri, 17 Apr 2020 22:16:36 +0200
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/26.3 (gnu/linux)

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



reply via email to

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