Skip to content

Instantly share code, notes, and snippets.

@tenpn
Created April 12, 2012 14:03
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save tenpn/2367513 to your computer and use it in GitHub Desktop.
Save tenpn/2367513 to your computer and use it in GitHub Desktop.
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
Copy link
Author

tenpn 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