help-gnu-emacs
[Top][All Lists]
Advanced

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

Re: How to reliably edit a file from within Emacs Lisp and return a stri


From: Jean Louis
Subject: Re: How to reliably edit a file from within Emacs Lisp and return a string?
Date: Sat, 24 Aug 2019 14:24:05 +0200
User-agent: Mutt/1.10.1 (2018-07-13)

* Robert Pluim <rpluim@gmail.com> [2019-08-23 16:15]:
> >>>>> On Fri, 23 Aug 2019 16:01:45 +0200, Jean Louis <bugs@gnu.support> said:
>     Jean> I would be happy if I can do something like:
> 
>     Jean> (defun emacsclient-edit (file)
>     Jean>   (shell-command (format "emacsclient %s " file))
>     Jean>   (file-to-string file))
> 
>     Jean> But that does not work within Emacs itself. Would that work, I 
> would be fine.
> 
>     Jean> It is somehow strange that I can run emacsclient from outside
>     Jean> Emacs and edit file and know that emacsclient finished its job,
>     Jean> and read the string from file, and that I cannot do the same from
>     Jean> Emacs.
> 
> Iʼd investigate the 'with-editor' package, which lets you use
> emacsclient to talk back to the emacs itʼs run from.

I tried it, as I understand that package is preparing the environment
$EDITOR for shell commands, so that it is ensured that editor will
communicate to current Emacs instance. For example launching external
mail reader that uses $EDITOR variable would use existing Emacs
instance with emacsclient

Jean




reply via email to

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