Combine archive-int-to-mode and tar-grind-file-mode
Add a new function, file-modes-number-to-symbolic. Make archive-int-to-mode and obsolete alias of it; use it to define tar-grind-file-mode (Bug#27952). * lisp/files.el (file-modes-number-to-symbolic): New defun. * lisp/arc-mode.el (archive-int-to-mode): Make it an obsolete alias. * lisp/tar-mode.el (tar-grind-file-mode): Use file-modes-number-to-symbolic. * test/lisp/arc-mode-tests.el (arc-mode-test-archive-int-to-mode) * test/lisp/tar-mode-tests.el (tar-mode-test-tar-grind-file-mode): Update test. * test/lisp/files-tests.el (files-tests-file-modes-symbolic-to-number) (files-tests-file-modes-number-to-symbolic): New tests. * doc/lispref/files.texi (Changing Files): Document the new funtion. * etc/NEWS (Lisp Changes in Emacs 28.1): Announce it.
This commit is contained in:
parent
4af8b17149
commit
3a284e5786
8 changed files with 74 additions and 41 deletions
|
@ -480,23 +480,9 @@ checksum before doing the check."
|
|||
|
||||
(defun tar-grind-file-mode (mode)
|
||||
"Construct a `rw-r--r--' string indicating MODE.
|
||||
MODE should be an integer which is a file mode value."
|
||||
(string
|
||||
(if (zerop (logand 256 mode)) ?- ?r)
|
||||
(if (zerop (logand 128 mode)) ?- ?w)
|
||||
(if (zerop (logand 2048 mode))
|
||||
(if (zerop (logand 64 mode)) ?- ?x)
|
||||
(if (zerop (logand 64 mode)) ?S ?s))
|
||||
(if (zerop (logand 32 mode)) ?- ?r)
|
||||
(if (zerop (logand 16 mode)) ?- ?w)
|
||||
(if (zerop (logand 1024 mode))
|
||||
(if (zerop (logand 8 mode)) ?- ?x)
|
||||
(if (zerop (logand 8 mode)) ?S ?s))
|
||||
(if (zerop (logand 4 mode)) ?- ?r)
|
||||
(if (zerop (logand 2 mode)) ?- ?w)
|
||||
(if (zerop (logand 512 mode))
|
||||
(if (zerop (logand 1 mode)) ?- ?x)
|
||||
(if (zerop (logand 1 mode)) ?T ?t))))
|
||||
MODE should be an integer which is a file mode value.
|
||||
For instance, if mode is #o700, then it produces `rwx------'."
|
||||
(substring (file-modes-number-to-symbolic mode) 1))
|
||||
|
||||
(defun tar-header-block-summarize (tar-hblock &optional mod-p)
|
||||
"Return a line similar to the output of `tar -vtf'."
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue