Вы можете использовать функцию shell-command
. Например:
(defun ls ()
"Lists the contents of the current directory."
(interactive)
(shell-command "ls"))
(global-set-key (kbd "C-x :") 'ls); Or whatever key you want...
Чтобы определить команду в одном буфере, вы можете использовать local-set-key
. В Dired вы можете получить имя файла в точке, используя dired-file-name-at-point
. Итак, чтобы сделать именно то, что вы просили:
(defun cygstart-in-dired ()
"Uses the cygstart command to open the file at point."
(interactive)
(shell-command (concat "cygstart " (dired-file-name-at-point))))
(add-hook 'dired-mode-hook '(lambda ()
(local-set-key (kbd "O") 'cygstart-in-dired)))