GNU, linux based systems, free software and other computer related things...

Some EMACS LISP functions

;; Start a separate process and pass filename selected in dired line to command.
(defun dired-start-process (command)
"Starts a separate process using command and file pointed by dired.
An output buffer will be attached to the process."
  (interactive "scommand: ")
  (let ((shell-command (concat command " '" (dired-get-filename) "'")))
    (let ((output-buffer (generate-new-buffer shell-command)))
      (start-process "background process" output-buffer "/bin/sh" "-c" shell-command)
      (switch-to-buffer output-buffer))))

;; Start a process in background and do not attach a buffer to it.
(defun dired-start-process-without-buffer (command)
"Starts a separate process using command and file pointed by dired.
This process will not have a buffer attached to it."
  (interactive "scommand: ")
  (let ((shell-command (concat command " '" (dired-get-filename) "'")))
    (start-process "background process" nil "/bin/sh" "-c" shell-command)
    (message "com: %s" shell-command)))
  
;; Mapping two keys to previous two functions.
(define-key dired-mode-map (kbd "E") 'dired-start-process)
(define-key dired-mode-map (kbd "F") 'dired-start-process-without-buffer)
;; Start a separate process.
(defun start-process-shell (command)
  "start-process-shell function executes a command in a separate process.
This command is not attached to the file pointed by dired.
Also an output buffer is created. A way to kill this new process is to kill this output buffer."
  (interactive "scommand: ")
  (let ((shell-command command))
    (let ((output-buffer (generate-new-buffer shell-command)))
      (start-process "background process" output-buffer "/bin/sh" "-c" shell-command)
      (switch-to-buffer output-buffer))))

;; We assign <f5> key to this function.  
(define-key global-map (read-kbd-macro "<f5>") 'start-process-shell)
You can freely copy, change or create derivative works from this page contents, only requisite is adding a link to this web page.