Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
emacs function to execute a shell command with the current buffer filename as an argument
;; eg when in a text file, (execute-shell-command-on-buffer "p4 edit %s") will check out the file in perforce
(defun execute-shell-command-on-buffer (shell-command-text)
(interactive "MShell command:")
(shell-command (format shell-command-text (shell-quote-argument buffer-file-name)))
)
@tenpn

This comment has been minimized.

Copy link
Owner Author

commented Apr 12, 2012

In partial answer to my own stack overflow question:
http://stackoverflow.com/q/10121944/11801

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.