; Clarify documentation of 'file-modes-number-to-symbolic'

* doc/lispref/files.texi (Changing Files):
* lisp/files.el (file-modes-number-to-symbolic): Clarify the
confusion with "symbolic" forms of file modes.  (Bug#61709)
This commit is contained in:
Eli Zaretskii 2023-02-23 17:45:52 +02:00
parent 5c2be6a263
commit a0b273ef30
2 changed files with 12 additions and 5 deletions

View file

@ -1985,7 +1985,11 @@ all.
@defun file-modes-number-to-symbolic modes @defun file-modes-number-to-symbolic modes
This function converts a numeric file mode specification in This function converts a numeric file mode specification in
@var{modes} into the equivalent symbolic form. @var{modes} into the equivalent string form. The string which this
function returns is in the same format produced by the shell command
@kbd{ls -l} and by @code{file-attributes}, @emph{not} the symbolic
form accepted by @code{file-modes-symbolic-to-number} and the
@command{chmod} shell command.
@end defun @end defun
@defun set-file-times filename &optional time flag @defun set-file-times filename &optional time flag

View file

@ -8391,11 +8391,14 @@ as in \"og+rX-w\"."
num-rights)) num-rights))
(defun file-modes-number-to-symbolic (mode &optional filetype) (defun file-modes-number-to-symbolic (mode &optional filetype)
"Return a string describing a file's MODE. "Return a description of a file's MODE as a string of 10 letters and dashes.
The returned string is like the mode description produced by \"ls -l\".
For instance, if MODE is #o700, then it produces `-rwx------'. For instance, if MODE is #o700, then it produces `-rwx------'.
FILETYPE if provided should be a character denoting the type of file, Note that this is NOT the same as the \"chmod\" style symbolic description
such as `?d' for a directory, or `?l' for a symbolic link and will override accepted by `file-modes-symbolic-to-number'.
the leading `-' char." FILETYPE, if provided, should be a character denoting the type of file,
such as `?d' for a directory, or `?l' for a symbolic link, and will override
the leading `-' character."
(string (string
(or filetype (or filetype
(pcase (ash mode -12) (pcase (ash mode -12)