From: Jean Louis <bugs@gnu.support>
To: Luca Ferrari <fluca1978@gmail.com>
Cc: help-gnu-emacs <help-gnu-emacs@gnu.org>
Subject: Re: emacsclient and sudo
Date: Tue, 9 Mar 2021 09:04:52 +0300 [thread overview]
Message-ID: <YEcQBGFumVpwXaki@protected.rcdrun.com> (raw)
In-Reply-To: <CAKoxK+6keFX67zh+MfOgYRZFxmBw9NvdNDdXhR6Ki8379CT+pw@mail.gmail.com>
* Luca Ferrari <fluca1978@gmail.com> [2021-03-08 18:36]:
> On Wed, Feb 24, 2021 at 6:48 PM Luca Ferrari <fluca1978@gmail.com> wrote:
> >
> > So far, I'm starting it normally (without sudo) and use tramp to edit
> > a file with sudo, but sometimes my fingers are faster than my brain
> > and I type "sudo emacs ...".
>
> Another solution I found is to export SUDO_EDITOR variable set to
> emacsclient and then use `sudo -e` to edit a file. While this works
> with regard to emacsclient, it does prevent emacs to load my .emacs
> configuration file.
>
> % export SUDO_EDITOR="emacsclient -t -a ''"
> % sudo -e /etc/fstab
>
> I would like to be able to use my customizations, any idea?
I just think that sudo will use $HOME as /root so one way could be to
provide HOME as your own one.
maybe like this:
export SUDO_EDITOR="env HOME=/home/myusername EDITOR"
but if you are using emacsclient that implies you wish to have server
running, so in that case server has to be started. As I have started
server as me, as user, this works just fine:
export SUDO_EDITOR="emacsclient -t -a ''"
on my side.
And this works as well good:
export SUDO_EDITOR="emacs -nw"
But if I would be user joe who wish to user HOME configuration of user
john, then I would be doing something like:
export SUDO_EDITOR="env HOME=/home/john emacs -nw"
provided that configuration is readable.
prev parent reply other threads:[~2021-03-09 6:04 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-02-24 17:48 emacsclient and sudo Luca Ferrari
2021-02-24 18:01 ` 2QdxY4RzWzUUiLuE
2021-03-08 15:32 ` Luca Ferrari
2021-03-09 6:04 ` Jean Louis [this message]
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=YEcQBGFumVpwXaki@protected.rcdrun.com \
--to=bugs@gnu.support \
--cc=fluca1978@gmail.com \
--cc=help-gnu-emacs@gnu.org \
/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.
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).