Function: ibuffer-do-shell-command-file

ibuffer-do-shell-command-file is an autoloaded, interactive and byte-compiled function defined in ibuf-ext.el.gz.

Signature

(ibuffer-do-shell-command-file COMMAND)

Documentation

Run shell command COMMAND separately on files of marked buffers.

Key Bindings

Source Code

;; Defined in /usr/src/emacs/lisp/ibuf-ext.el.gz
;;;###autoload (autoload 'ibuffer-do-shell-command-file "ibuf-ext")
(define-ibuffer-op shell-command-file (command)
  "Run shell command COMMAND separately on files of marked buffers."
  (:interactive "sShell command on buffer's file: "
   :opstring "Shell command executed on"
   :before (ibuffer--maybe-erase-shell-cmd-output)
   :modifier-p nil)
  (let ((file (and (not (buffer-modified-p))
                   buffer-file-name))
        (out-buf (get-buffer-create shell-command-buffer-name)))
    (unless (and file (file-exists-p file))
      (setq file
            (make-temp-file
             (substring
              (buffer-name) 0
              (min 10 (length (buffer-name))))))
      (write-region nil nil file nil 0))
    (with-current-buffer out-buf (goto-char (point-max)))
    (call-process-shell-command
     (format "%s %s"
             command
             (shell-quote-argument file))
     nil out-buf nil)))