summary refs log tree commit diff stats
diff options
context:
space:
mode:
authorAlan Pearce2013-05-28 19:09:11 +0100
committerAlan Pearce2013-05-28 19:09:11 +0100
commit83923895305252c639019ffa2e0270f5cc54f614 (patch)
tree0fb6c97b6e64af14cb15bf7ec78ae176899681fb
parentd46e831026aeff0f6577edab0a3accfbecc68d0b (diff)
downloadnixfiles-83923895305252c639019ffa2e0270f5cc54f614.tar.lz
nixfiles-83923895305252c639019ffa2e0270f5cc54f614.tar.zst
nixfiles-83923895305252c639019ffa2e0270f5cc54f614.zip
Emacs: make shell-execute work when buffer is not visiting a file
-rw-r--r--emacs/elisp/ap-functions.el4
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))))