Emacs: make shell-execute work when buffer is not visiting a file
Alan Pearce alan@alanpearce.co.uk
Tue, 28 May 2013 19:09:11 +0100
1 files changed, 3 insertions(+), 1 deletions(-)
jump to
M emacs/elisp/ap-functions.el → 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))))