From 83923895305252c639019ffa2e0270f5cc54f614 Mon Sep 17 00:00:00 2001 From: Alan Pearce Date: Tue, 28 May 2013 19:09:11 +0100 Subject: Emacs: make shell-execute work when buffer is not visiting a file --- emacs/elisp/ap-functions.el | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) (limited to 'emacs') diff --git a/emacs/elisp/ap-functions.el b/emacs/elisp/ap-functions.el index d9278fa..b699464 100644 --- a/emacs/elisp/ap-functions.el +++ b/emacs/elisp/ap-functions.el @@ -39,6 +39,8 @@ ;;;###autoload (defun shell-execute () (interactive) - (let ((file-buffer (or (file-name-nondirectory (buffer-file-name)) "")) + (let ((file-buffer (if (buffer-file-name) + (file-name-nondirectory (buffer-file-name)) + "")) (command (read-shell-command "Shell command: " nil nil nil))) (shell-command (replace-regexp-in-string "%" file-buffer command)))) -- cgit 1.4.1