Subject: bug#76974: 31.0.50; [wishlist] Add global key binding for tramp-revert-buffer-with-sudo

From: Michael Albinus <[email-masked]>
Date: Wed, 12 Mar 2025 13:16:50 +0100

Sean Whitton <[email-masked]> writes:

> Hello,

Hi Sean,

> Yes, when I saw this my first thought was the C-x x keymap.  I think
> using one of TRAMP's commonly-used characters would be good, so:
>
>     C-x x @
> or  C-x x :
> or  C-x x |
> or  C-x x /
>
> I would suggest avoiding '|' because we might want to use it later for
> something pipe-related.

Welcome to our funny bikeshedding :-)

'@' is already used for indication of remoteness, see mode-line-remote.
And again, I prefer to use the same key in ctl-x-x-map and dired-mode-map.

> We would want it to be easy to customise this for specific systems so
> that the new binding always gets you root access, on systems that use
> doas or su instead of sudo.
> I see that there is already tramp-file-name-with-method for configuring
> this.

Yes. This must be improved, I guess.

> Have you considered renaming the command to something like
> tramp-revert-buffer-obtain-root ?  Adding a global binding seems like a
> nice opportunity for a rename.

Yes, I did. Neither tramp-revert-buffer-with-sudo nor
tramp-revert-buffer-obtain-root are a perfect name. We don't know for
sure, that the method will be "sudo", nor that the user will be
"root". On my QNAP NAS, the root user is called "admin".

And using a Tramp specific name for a global bound command doesn't seem
to be proper as well.

I was thinking to introduce a new command
'revert-buffer-<something-better-than-sudo-or-root>', which will be an
alias of tramp-revert-buffer-with-sudo. But I'm bad with proper names.

This is a minor issue; we can find the best command name as long as
Emacs 31 is under development.

Best regards, Michael.