ob-tangle: Fix interpretation of rw-r--r-- modes

* lisp/ob-tangle.el (org-babel-interpret-file-mode): When specifying a
file mode in the "rw-r--r--" style, this is interpreted by splicing the
user, group, and other compenents into a "u=rw,g=r,o=r" style string and
applying `file-modes-symbolic-to-number`.  For correct interpretation,
we need to ensure the dashes are removed in this process.
This commit is contained in:
TEC 2023-04-13 13:34:58 +08:00
parent 5d32058bf9
commit d035cc36cd
Signed by: tec
SSH Key Fingerprint: SHA256:eobz41Mnm0/iYWBvWThftS0ElEs1ftBr6jamutnXc/A
1 changed files with 3 additions and 3 deletions

View File

@ -361,9 +361,9 @@ Did you give the decimal value %1$d by mistake?" mode)))
;; Match regexp taken from `file-modes-symbolic-to-number'.
(file-modes-symbolic-to-number mode org-babel-tangle-default-file-mode))
((string-match-p "^[r-][w-][xs-][r-][w-][xs-][r-][w-][x-]$" mode)
(file-modes-symbolic-to-number (concat "u=" (substring mode 0 3)
",g=" (substring mode 3 6)
",o=" (substring mode 6 9))
(file-modes-symbolic-to-number (concat "u=" (delete ?- (substring mode 0 3))
",g=" (delete ?- (substring mode 3 6))
",o=" (delete ?- (substring mode 6 9)))
0))
(t (error "File mode %S not recognized as a valid format. See `org-babel-interpret-file-mode'." mode))))