auto-sudoedit icon indicating copy to clipboard operation
auto-sudoedit copied to clipboard

Is the concept corect?

Open hajosc opened this issue 4 years ago • 3 comments

My apologies, I may just not understand the idea behind auto-sudoedit, but I do have difficulties understanding the idea behind it:

  • I open a file that is rw-r--r-- root:root as user foo. Emacs opens it.
  • I try to edit it, but emacs says it's only rw for root, foo can't edit it.
  • I try to save it (without editing), emacs says "no need to save, no changes"

Shouldn't auto-sudoedit instead intercept the "find-file" function and say "hey, you won't be able to edit/save this file, do you want to open it as root via tramp instead"?

hajosc avatar Mar 19 '21 12:03 hajosc

I can open it as user root.

-rw-r--r-- 1 root root    7  3月 22 16:16 foobar.txt

So I could not understand what the problem was there. It may be because my English skills are not good enough.

ncaq avatar Mar 22 '21 07:03 ncaq

No problem, my English is also not very good :) I try again:

  1. I am user foo
  2. I open: -rw-r--r-- root root (...) /etc/hosts
  3. I can see the file contents: 127.0.0.1 localhost localhost.localdomain
  4. I want to edit the file. Emacs says: "Error! File is read only!"
  5. I want to save the file with C-x C-s. Emacs says "Error! No changes need to be saved"

How can I edit the file then? As step 3.1 I need to disable read-only-mode.

For "Auto-sudoedit", my idea was to change the algorithm:

  1. I am user foo
  2. I open: -rw-r--r-- root root (...) /etc/hosts
  3. auto-suedit checks:
    • Can foo write to the file?
    • Yes: Open it
    • No: Use tramp sudo to open it

Sorry; is it more clear now?

hajosc avatar Mar 22 '21 08:03 hajosc

For "Auto-sudoedit", my idea was to change the algorithm:

I think auto-sudoedit is currently working with that algorithm, so I don't know why it doesn't reopen.

ncaq avatar Mar 24 '21 01:03 ncaq