[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [h-e-w] Customizing run-shell-command
From: |
David Vanderschel |
Subject: |
Re: [h-e-w] Customizing run-shell-command |
Date: |
17 Dec 2004 13:18:18 -0600 |
On Thursday, December 16, "Henrik Andersson" <address@hidden> wrote:
>How can I change run-shell-command (X in Dired) to run acrord32 instead
>of xpdf on .pdf for instance or even better the program which is
>associated with the extension in windows?
I know this is getting a bit old; but, by far, the
simplest solution I have seen to this problem was
contributed by Howard Melman (and I think he deserves
some credit for it):
______________________________________________________________________
;; dired stuff to open files a la Windows from Howard Melman
(defun dired-execute-file (&optional arg)
(interactive "P")
(mapcar #'(lambda (file)
(w32-shell-execute "open" (convert-standard-filename file)))
(dired-get-marked-files nil arg)))
______________________________________________________________________
He also offered the following to allow access to the
function via a mouse click:
______________________________________________________________________
(defun dired-mouse-execute-file (event)
"In dired, execute the file or goto directory name you click on."
(interactive "e")
(set-buffer (window-buffer (posn-window (event-end event))))
(goto-char (posn-point (event-end event)))
(if (file-directory-p (dired-get-filename))
(dired-find-file)
(dired-execute-file)))
______________________________________________________________________
Finally, here is a suggestion about how to bind them:
______________________________________________________________________
(defun hrm-dired-mode-hook ()
"Hook run when entering dired-mode."
(define-key dired-mode-map "X" 'dired-execute-file)
(define-key dired-mode-map [M-down-mouse-1] 'dired-mouse-mark-file))
(add-hook 'dired-mode-hook 'hrm-dired-mode-hook)
______________________________________________________________________
As far as I can recall, "X" was never bound in dired
until after I had added Melman's code to my
initialization - so I am wondering what bound "X" in
Henrik's installation.
Regards,
David V.