emacs-elpa-diffs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[elpa] externals/org ff6fd93 2/3: ob-tangle: Check that integer file mod


From: ELPA Syncer
Subject: [elpa] externals/org ff6fd93 2/3: ob-tangle: Check that integer file modes are valid
Date: Sat, 20 Nov 2021 10:57:21 -0500 (EST)

branch: externals/org
commit ff6fd9387626258841f5d3a6a8e9fc10d02a6377
Author: TEC <tec@tecosaur.com>
Commit: TEC <tec@tecosaur.com>

    ob-tangle: Check that integer file modes are valid
    
    * lisp/ob-tangle.el (org-babel-interpret-file-mode): Check that the
    integer as an octal represents a valid file mode, and complain
    otherwise.
---
 lisp/ob-tangle.el | 6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)

diff --git a/lisp/ob-tangle.el b/lisp/ob-tangle.el
index 90c7ae5..7484ffe 100644
--- a/lisp/ob-tangle.el
+++ b/lisp/ob-tangle.el
@@ -317,7 +317,11 @@ The following forms are currently recognised:
 * The interpretation of these forms relies on `file-modes-symbolic-to-number',
   and uses `org-babel-tangle-default-mode' as the base mode."
   (cond
-   ((integerp mode) mode)
+   ((integerp mode)
+    (if (string-match-p "^[0-7][0-7][0-7]$" (format "%o" mode))
+        mode
+      (user-error "%1$o is not a valid file mode octal. \
+Did you give the decimal value %1$d by mistake?" mode)))
    ((not (stringp mode))
     (error "File mode %S not recognised as a valid format." mode))
    ((string-match-p "^o0?[0-7][0-7][0-7]$" mode)



reply via email to

[Prev in Thread] Current Thread [Next in Thread]