From 3561cc07e84caf001edf70c3593643c32f5f74bf Mon Sep 17 00:00:00 2001 From: Andreas Gerler Date: Thu, 28 May 2015 13:30:57 +0200 Subject: [PATCH] safe hash bang files executable modified to work with TRAMP. Signed-off-by: Andreas Gerler --- bba.org | 16 ++++++++++++---- 1 file changed, 12 insertions(+), 4 deletions(-) diff --git a/bba.org b/bba.org index f0be0a75..5a46c2d7 100644 --- a/bba.org +++ b/bba.org @@ -1315,10 +1315,18 @@ safe files with #! in first line as user executable. (goto-char (point-min)) (save-match-data (looking-at "^#!")))) - (not (file-executable-p buffer-file-name)) - (shell-command (concat "chmod u+x " buffer-file-name)) - (message - (concat "Saved as script: " buffer-file-name))))) + (if (file-remote-p buffer-file-name) + (progn + (not (file-executable-p buffer-file-name)) + (shell-command (concat "chmod u+x " (file-name-nondirectory buffer-file-name))) + (message + (concat "Saved as script via tramp: " buffer-file-name)) + ) + (progn + (not (file-executable-p buffer-file-name)) + (shell-command (concat "chmod u+x " buffer-file-name)) + (message + (concat "Saved as script: " buffer-file-name))))))) #+END_SRC -- 2.47.3