Function: archive-calc-mode
archive-calc-mode is a byte-compiled function defined in
arc-mode.el.gz.
Signature
(archive-calc-mode OLDMODE NEWMODE)
Documentation
From the integer OLDMODE and the string NEWMODE calculate a new file mode.
NEWMODE may be an octal number including a leading zero in which case it will become the new mode.
NEWMODE may also be a relative specification like "og-rwx" in which case OLDMODE will be modified accordingly just like chmod(2) would have done.
Source Code
;; Defined in /usr/src/emacs/lisp/arc-mode.el.gz
(defun archive-calc-mode (oldmode newmode)
"From the integer OLDMODE and the string NEWMODE calculate a new file mode.
NEWMODE may be an octal number including a leading zero in which case it
will become the new mode.\n
NEWMODE may also be a relative specification like \"og-rwx\" in which case
OLDMODE will be modified accordingly just like chmod(2) would have done."
;; FIXME: Use `file-modes-symbolic-to-number'!
(if (string-match "\\`0[0-7]*\\'" newmode)
(logior (logand oldmode #o177000) (string-to-number newmode 8))
(file-modes-symbolic-to-number newmode oldmode)))