From: Andreas Gerler Date: Thu, 28 May 2015 11:30:57 +0000 (+0200) Subject: safe hash bang files executable modified to work with TRAMP. X-Git-Url: http://git.bundesbrandschatzamt.de/?a=commitdiff_plain;h=3561cc07e84caf001edf70c3593643c32f5f74bf;p=emacsconfig.git safe hash bang files executable modified to work with TRAMP. Signed-off-by: Andreas Gerler --- 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