aboutsummaryrefslogtreecommitdiffstats
path: root/doc
diff options
context:
space:
mode:
authorJim Porter2023-01-10 15:35:18 -0800
committerJim Porter2023-01-16 17:11:02 -0800
commit0bb8a011d57cb55c16ff502125b60e8e3bb3d5aa (patch)
tree4756c74e355419d4f14f569f0aa50ea2f13b6a49 /doc
parentbcaa63ac506dc070b29db13326801ff978e8b00d (diff)
downloademacs-0bb8a011d57cb55c16ff502125b60e8e3bb3d5aa.tar.gz
emacs-0bb8a011d57cb55c16ff502125b60e8e3bb3d5aa.zip
Add 'file-user-uid' to get the connection-local effective UID
In particular, this lets Eshell show a "#" root prompt sigil when the user has sudo'ed via "cd /sudo::" (bug#60722). * lisp/simple.el (file-user-uid): New function. * lisp/net/tramp.el (tramp-file-name-for-operation): Add 'file-user-uid'. (tramp-handle-file-user-uid): New function. * lisp/net/tramp-adb.el (tramp-adb-file-name-handler-alist): * lisp/net/tramp-crypt.el (tramp-crypt-file-name-handler-alist): * lisp/net/tramp-gvfs.el (tramp-gvfs-file-name-handler-alist): * lisp/net/tramp-rclone.el (tramp-rclone-file-name-handler-alist): * lisp/net/tramp-sh.el (tramp-sh-file-name-handler-alist): * lisp/net/tramp-smb.el (tramp-smb-file-name-handler-alist): * lisp/net/tramp-sshfs.el (tramp-sshfs-file-name-handler-alist): * lisp/net/tramp-sudoedit.el (tramp-sudoedit-file-name-handler-alist): Add 'file-user-uid'. * lisp/net/tramp-archive.el (tramp-archive-handle-file-user-uid): New function... (tramp-archive-file-name-handler-alist): ... use it. * lisp/eshell/em-prompt.el (eshell-prompt-function): Use 'file-user-uid'. * lisp/eshell/esh-var.el (eshell-variable-aliases-list): Add '$UID'. * test/lisp/eshell/esh-var-tests.el (esh-var-test/uid-var): New test. * doc/lispref/os.texi (User Identification): Document 'file-user-uid'. * doc/lispref/files.texi (Magic File Names): Mention 'file-user-uid'. * doc/misc/eshell.texi (Variables): Document '$UID'. Add a missing index entry for '$INSIDE_EMACS'. * etc/NEWS: Announce 'file-user-uid'.
Diffstat (limited to 'doc')
-rw-r--r--doc/lispref/files.texi6
-rw-r--r--doc/lispref/os.texi10
-rw-r--r--doc/misc/eshell.texi8
3 files changed, 22 insertions, 2 deletions
diff --git a/doc/lispref/files.texi b/doc/lispref/files.texi
index 5cc4c1e7ddf..ad01e0f2886 100644
--- a/doc/lispref/files.texi
+++ b/doc/lispref/files.texi
@@ -3390,7 +3390,8 @@ first, before handlers for jobs such as remote file access.
3390@code{file-readable-p}, @code{file-regular-p}, 3390@code{file-readable-p}, @code{file-regular-p},
3391@code{file-remote-p}, @code{file-selinux-context}, 3391@code{file-remote-p}, @code{file-selinux-context},
3392@code{file-symlink-p}, @code{file-system-info}, 3392@code{file-symlink-p}, @code{file-system-info},
3393@code{file-truename}, @code{file-writable-p}, 3393@code{file-truename}, @code{file-user-uid},
3394@code{file-writable-p},
3394@code{find-backup-file-name},@* 3395@code{find-backup-file-name},@*
3395@code{get-file-buffer}, 3396@code{get-file-buffer},
3396@code{insert-directory}, 3397@code{insert-directory},
@@ -3451,7 +3452,8 @@ first, before handlers for jobs such as remote file access.
3451@code{file-readable-p}, @code{file-regular-p}, 3452@code{file-readable-p}, @code{file-regular-p},
3452@code{file-remote-p}, @code{file-selinux-context}, 3453@code{file-remote-p}, @code{file-selinux-context},
3453@code{file-symlink-p}, @code{file-system-info}, 3454@code{file-symlink-p}, @code{file-system-info},
3454@code{file-truename}, @code{file-writable-p}, 3455@code{file-truename}, @code{file-user-uid},
3456@code{file-writable-p},
3455@code{find-backup-file-name}, 3457@code{find-backup-file-name},
3456@code{get-file-buffer}, 3458@code{get-file-buffer},
3457@code{insert-directory}, 3459@code{insert-directory},
diff --git a/doc/lispref/os.texi b/doc/lispref/os.texi
index 3be7036f637..bca62a7a8de 100644
--- a/doc/lispref/os.texi
+++ b/doc/lispref/os.texi
@@ -1277,6 +1277,16 @@ This function returns the real @acronym{UID} of the user.
1277This function returns the effective @acronym{UID} of the user. 1277This function returns the effective @acronym{UID} of the user.
1278@end defun 1278@end defun
1279 1279
1280@defun file-user-uid
1281This function returns the connection-local value for the user's
1282effective @acronym{UID}. If @code{default-directory} is local, this
1283is equivalent to @code{user-uid}, but for remote files (@pxref{Remote
1284Files, , , emacs, The GNU Emacs Manual}), it will return the
1285@acronym{UID} for the user associated with that remote connection; if
1286the remote connection has no associated user, it will instead return
1287-1.
1288@end defun
1289
1280@cindex GID 1290@cindex GID
1281@defun group-gid 1291@defun group-gid
1282This function returns the effective @acronym{GID} of the Emacs process. 1292This function returns the effective @acronym{GID} of the Emacs process.
diff --git a/doc/misc/eshell.texi b/doc/misc/eshell.texi
index fc7d52eb711..c40ff58f42c 100644
--- a/doc/misc/eshell.texi
+++ b/doc/misc/eshell.texi
@@ -983,6 +983,13 @@ whenever you change the current directory to a different host
983the value will automatically update to reflect the search path on that 983the value will automatically update to reflect the search path on that
984host. 984host.
985 985
986@vindex $UID
987@item $UID
988This returns the effective @acronym{UID} for the current user. This
989variable is connection-aware, so when the current directory is remote,
990its value will be @acronym{UID} for the user associated with that
991remote connection.
992
986@vindex $_ 993@vindex $_
987@item $_ 994@item $_
988This refers to the last argument of the last command. With a 995This refers to the last argument of the last command. With a
@@ -1014,6 +1021,7 @@ that are currently visible in the Eshell window. They are both
1014copied to the environment, so external commands invoked from 1021copied to the environment, so external commands invoked from
1015Eshell can consult them to do the right thing. 1022Eshell can consult them to do the right thing.
1016 1023
1024@vindex $INSIDE_EMACS
1017@item $INSIDE_EMACS 1025@item $INSIDE_EMACS
1018This variable indicates to external commands that they are being 1026This variable indicates to external commands that they are being
1019invoked from within Emacs so they can adjust their behavior if 1027invoked from within Emacs so they can adjust their behavior if