summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorEric Schulte <eric.schulte@gmx.com>2012-12-11 20:20:50 -0700
committerEric Schulte <eric.schulte@gmx.com>2012-12-12 10:48:57 -0700
commit5e3b8259c7e5a8f2e09aa8e8b0769216ca9c5576 (patch)
treec295091ef8c9d099e6c418ec4a625f6eb8aac1b8
parentff0081847c81f5a2f5526da0446d34236b0424ac (diff)
downloadorg-mode-5e3b8259c7e5a8f2e09aa8e8b0769216ca9c5576.tar.gz
tangled files should not be writable
Hopefully this will help keep people from editing tangled source files by accident. * lisp/ob-tangle.el (org-babel-tangle): Tangled files should not be writable.
-rw-r--r--lisp/ob-tangle.el8
1 files changed, 6 insertions, 2 deletions
diff --git a/lisp/ob-tangle.el b/lisp/ob-tangle.el
index 697a269..1d486a8 100644
--- a/lisp/ob-tangle.el
+++ b/lisp/ob-tangle.el
@@ -259,8 +259,12 @@ exported source code blocks by language."
(goto-char (point-max))
(insert content)
(write-region nil nil file-name))))
- ;; if files contain she-bangs, then make the executable
- (when she-bang (set-file-modes file-name #o755))
+ (set-file-modes
+ file-name
+ ;; never writable (don't accidentally edit tangled files)
+ (if she-bang
+ #o555 ;; files with she-bangs should be executable
+ #o444)) ;; those without should not
;; update counter
(setq block-counter (+ 1 block-counter))
(add-to-list 'path-collector file-name)))))