unofficial mirror of help-gnu-emacs@gnu.org
 help / color / mirror / Atom feed
From: Uday S Reddy <uDOTsDOTreddy@cs.bham.ac.uk>
To: help-gnu-emacs@gnu.org
Subject: Re: viewing MS powerpoint files from dired
Date: Thu, 15 Jul 2010 09:00:22 +0100	[thread overview]
Message-ID: <i1mf68$97u$1@north.jnrs.ja.net> (raw)
In-Reply-To: <b51cb54f-abc6-4870-8d81-1b6bff01e8ba@u26g2000yqu.googlegroups.com>

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


  parent reply	other threads:[~2010-07-15  8:00 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-07-13 16:50 viewing MS powerpoint files from dired Mirko
2010-07-14  8:36 ` Jean Magnan de Bornier
2010-07-14 14:08   ` Mirko
2010-07-15  8:00 ` Uday S Reddy [this message]
2010-07-18  8:29   ` Tim X

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://www.gnu.org/software/emacs/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to='i1mf68$97u$1@north.jnrs.ja.net' \
    --to=udotsdotreddy@cs.bham.ac.uk \
    --cc=help-gnu-emacs@gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).