diff options
author | Alan Pearce | 2013-05-28 19:09:11 +0100 |
---|---|---|
committer | Alan Pearce | 2013-05-28 19:09:11 +0100 |
commit | 83923895305252c639019ffa2e0270f5cc54f614 (patch) | |
tree | 0fb6c97b6e64af14cb15bf7ec78ae176899681fb /emacs/elisp | |
parent | d46e831026aeff0f6577edab0a3accfbecc68d0b (diff) | |
download | nixfiles-83923895305252c639019ffa2e0270f5cc54f614.tar.lz nixfiles-83923895305252c639019ffa2e0270f5cc54f614.tar.zst nixfiles-83923895305252c639019ffa2e0270f5cc54f614.zip |
Emacs: make shell-execute work when buffer is not visiting a file
Diffstat (limited to 'emacs/elisp')
-rw-r--r-- | emacs/elisp/ap-functions.el | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/emacs/elisp/ap-functions.el b/emacs/elisp/ap-functions.el index d9278fa0..b6994643 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)))) |