From 598fdd8392204a4ec68984c6ddf28b5e3ff096a1 Mon Sep 17 00:00:00 2001 From: Geoff Shannon Date: Fri, 14 Sep 2018 02:23:39 -0700 Subject: [PATCH] Stop Rust source files from being made executable Rust has an unfortunate syntax for setting attributes on a module file: ```rust #![...] ``` Since this is typically put at the top of the file, that makes the shebang the first two characters, which makes the `after-save-hook` function `executable-make-buffer-file-executable-if-script-p` function change any such rust files executable. --- modules/prelude-rust.el | 2 ++ 1 file changed, 2 insertions(+) diff --git a/modules/prelude-rust.el b/modules/prelude-rust.el index 536453c..b8d5762 100644 --- a/modules/prelude-rust.el +++ b/modules/prelude-rust.el @@ -53,6 +53,8 @@ (defun prelude-rust-mode-defaults () (local-set-key (kbd "C-c C-d") 'racer-describe) + ;; Prevent #! from chmodding rust files to be executable + (remove-hook 'after-save-hook 'executable-make-buffer-file-executable-if-script-p) ;; CamelCase aware editing operations (subword-mode +1))