help-emacs-windows
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [h-e-w] mailcap file and filename/type associations for Windows 95


From: David Vanderschel
Subject: Re: [h-e-w] mailcap file and filename/type associations for Windows 95
Date: 05 Jan 2002 17:47:47 -0600

On Friday, January 04, "Michael R. Wolf" <address@hidden> wrote:
>Stephen Leake <address@hidden> writes:

>> Should dired refuse to launch Word on a .doc file, because
>> it might contain a virus?

>How do you get dired to launch Word?

I use the following code by Howard Melman which
someone posted on this list long ago.

______________________________________________________________________

;; 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)))

(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)))
(global-set-key [?\C-x mouse-2]
  'dired-mouse-execute-file)


(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)

______________________________________________________________________


I have seen more complex solutions; but, for my
purposes, the above seems adequate for opening any
file in accordance with its Windows file association.
Used on a directory, it allows you to switch from
dired to Windows Explorer, which can occasionally be
handy.  (Though the reverse is more often what I am
inclined to do; so, using gnuserv, I have defined a
command in my context menu for Explorer to switch to
emacs.)

Regards,
  David V.




reply via email to

[Prev in Thread] Current Thread [Next in Thread]