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

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

Re: viewing MS powerpoint files from dired


From: Uday S Reddy
Subject: Re: viewing MS powerpoint files from dired
Date: Wed, 08 Dec 2010 15:18:50 -0000
User-agent: Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.9.2.4) Gecko/20100608 Thunderbird/3.1

On 7/13/2010 5:50 PM, Mirko wrote:

How can I teach dired to launch powerpoint on files with extension ppt
(that is on MS Windows)?

(Writing some elisp is OK).

Here are some functions I use for Windows support in dired. They work using the "object-oriented" Windows operations, the same way as the right-mouse-button context menu. Windows takes care of figuring out the application for opening the file. So, powerpoint or not, it makes no difference.

The open function almost always works.  The others often don't.

Perhaps I should put these in Emacswiki too.  Enjoy!

Cheers,
Uday

(defun dired-w32-shell-open ()
  "Open file in Win32."
  (interactive)
  (let ((file (w32-convert-filename (dired-get-filename))))
    (w32-shell-execute "open" file)
    ))

(defun w32-convert-filename (filename)
  "Convert FILENAME to Win32 format."
  (while (string-match "/" filename)
    (setq filename (replace-match "\\" nil t filename)))
  filename)

(defun dired-w32-shell-print ()
  "Print file in Win32."
  (interactive)
  (let ((file (w32-convert-filename (dired-get-filename))))
    (w32-shell-execute "print" file)
    ))

(defun dired-w32-shell-properties ()
  "Show properties of the file."
  (interactive)
  (let ((file (w32-convert-filename (dired-get-filename))))
    (w32-shell-execute "properties" file)
    ))

(defun dired-w32-shell-execute (operation)
  "Execute the given operation in Win32."
  (interactive "M")
  (let ((file (w32-convert-filename (dired-get-filename))))
    (w32-shell-execute operation file)
    ))


reply via email to

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