My Emacs init file works fine in general. But, if I am in my home directory and if I execute:
pwd /home/pedro sudo emacs /etc/nixos/hosts.nix
For some reason, this opens vanilla Emacs without my init file being loaded. In normal situations, opening a normal file and having vanilla Emacs only happens if I do
emacs -q. For instance,
emacs -q /home/pedro/Desktop/example.txt.
This gets even weirder for my naive eyes if I change my position on the file structure. After tweaking the position, if I try to open the same file, then Emacs works as expected being loaded with the init file. To illustrate, the following works as expected:
pwd /home/pedro cd /etc/ emacs nixos/hosts.nix
Since this problem might be related to my OS, I must say that I am using NixOS. This is my configuration file.
This does not seem to be the same situation as this previous question. On the previous question, the person was unable to do a
sudo emacs. I can always do it, but in a specific case, my init file is not been loaded.
Why does this happen?
Is there some way to do
sudo emacs /etc/host being on
home and with my init file being loaded?