Passing Emacs variables to minibuffer shell commands

前端 未结 6 2097
误落风尘
误落风尘 2020-12-19 06:13

I can run a shell command quickly by hitting M-!. One thing I\'d like to do is perform shell quick operations on the current file. An example would be checking th

6条回答
  •  抹茶落季
    2020-12-19 06:50

    I did roll my own elisp function, and it looks like this:

    (defun execute-shell-command-on-buffer (shell-command-text)
        (interactive "MShell command:")
        (shell-command (format shell-command-text (shell-quote-argument buffer-file-name)))
        )
    

    https://gist.github.com/2367513

    I bound it to M-", so now my example can be completed with:

    M-"p4 edit %sRET

    I won't accept this as the answer, because I did ask for solutions that don't require a function.

提交回复
热议问题