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

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

Re: I'am root user, but 'emacs /etc/sudoers' still report Buffer is read


From: Emanuel Berg
Subject: Re: I'am root user, but 'emacs /etc/sudoers' still report Buffer is read-only: #<buffer sudoers> in modeline
Date: Wed, 29 Apr 2015 22:29:33 +0200
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/24.4 (gnu/linux)

Emanuel Berg <embe8573@student.uu.se> writes:

> However then be aware that all tildes (~) in USER's
> configs won't be /home/USER, so those have to be
> changed to explicit paths unless there is yet
> another way around it.
>
> Perhaps the `user-login-name' or
> `user-real-login-name' could be experimented with...

Yes. I just came up with it but it makes sense (I
think).

For /etc/sudoers use:

    sudo LOGNAME=USER EDITOR='/usr/bin/emacs' visudo

Note that -u USER is isn't necessary with LOGNAME.

Tildes (~) in config files have to be replaced with
(user-login-name), e.g.:

    (setq load-path
      (append load-path
        `(,(format "/home/%s/.emacs.d/emacs-init/"      (user-login-name))
          ,(format "/home/%s/.emacs.d/emacs-init/w3m/"  (user-login-name))
          ,(format "/home/%s/.emacs.d/emacs-init/gnus/" (user-login-name))
         )))

`user-login-name' will report the (correct) user even
without the LOGNAME set (however not in sudo
invocation, which is why LOGNAME *is* set there) so it
will work transparently, is the thought.

-- 
underground experts united
http://user.it.uu.se/~embe8573


reply via email to

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