]> git.bundesbrandschatzamt.de Git - emacsconfig.git/commitdiff
safe hash bang files executable modified to work with TRAMP.
authorAndreas Gerler <baronNOSPAMbundesbrandschatzamt.de>
Thu, 28 May 2015 11:30:57 +0000 (13:30 +0200)
committerAndreas Gerler <baronNOSPAMbundesbrandschatzamt.de>
Thu, 28 May 2015 11:30:57 +0000 (13:30 +0200)
Signed-off-by: Andreas Gerler <baronNOSPAMbundesbrandschatzamt.de>
bba.org

diff --git a/bba.org b/bba.org
index f0be0a751c7dd67c4c2ecfd56fdf4cb95d831a5c..5a46c2d70f5f207382a42111490c4ba25b134b20 100644 (file)
--- 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