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

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

RE: [h-e-w] Help with defadvice


From: Ben Key
Subject: RE: [h-e-w] Help with defadvice
Date: Wed, 18 Jun 2003 23:04:41 -0400

It will not do what I want.  I do not want to open the project file in
MSDev.  I want to use the Emacs compile functionality and compile my
project from within Emacs.  MSDev provides a method of doing builds from
the command line but the syntax is difficult to remember.  What my
function does is set the variable compile-command so that it will use
this capability of MSDev.  The problem is that I want my function to be
called as advice to the command compile.

-----Original Message-----
From: address@hidden
[mailto:address@hidden On
Behalf Of Richard M. Heiberger
Sent: Wednesday, June 18, 2003 6:49 PM
To: 'address@hidden'; Ben Key
Cc: address@hidden
Subject: RE: [h-e-w] Help with defadvice


It looks like w32-shell-execute might do what you want.
It uses the file extension associations that windows uses, and you can
add your extensions in by clicking thorugh windoes explorer.

I use C-c C-f in the dired to get the windows standard behavior. I also
have some specific extensions that I use, for example .  myfile.eps.gz
goes to ghostview, not wherever windows would send .gz files. I
constructed this based on discussion on this list:

-------------- exec.el
(require 'dired)

(defun execute-dired-find-file ()
  "In dired, run the w32-shell-execute on this file."
  (interactive)
  ;; dired-get-filename is defined in dired.el
  (w32-shell-execute nil (dos-canonical-name (dired-get-filename))))
(define-key dired-mode-map "\C-c\C-f" 'execute-dired-find-file)

(defun word-dired-find-file ()
  "In dired, run the MS Word on this file."
  (interactive)
  ;; dired-get-filename is defined in dired.el
  (w32-shell-execute nil "winword" (w32-short-file-name
(dired-get-filename)))) (define-key dired-mode-map "\C-c\C-w"
'word-dired-find-file)

(defun excel-dired-find-file ()
  "In dired, run the MS Excel on this file."
  (interactive)
  ;; dired-get-filename is defined in dired.el
  (w32-shell-execute nil "c:/progra~1/micros~2/office10/excel.exe"
                     (w32-short-file-name (dired-get-filename))))
(define-key dired-mode-map "\C-cx" 'excel-dired-find-file)

(defun wordpad-dired-find-file ()
  "In dired, run the MS wordpad on this file."
  (interactive)
  ;; dired-get-filename is defined in dired.el
  (w32-shell-execute nil "wordpad" (w32-short-file-name
(dired-get-filename)))) (define-key dired-mode-map "\C-c\C-p"
'wordpad-dired-find-file)

(defun explorer-dired-find-file ()
  "In dired, run the MS Windows Explorer on this file."
  (interactive)
  ;; dired-get-filename is defined in dired.el
  (w32-shell-execute nil "explorer" (concat "/e," (dos-canonical-name
(file-name-directory (w32-short-file-name (dired-get-filename)))))))
(define-key dired-mode-map "\C-c\C-e" 'explorer-dired-find-file)

(defun dos-canonical-name (filename)
"Canonicalize filename forcing `\\' as directory-sep-char."
  (let ((directory-sep-char ?\ ))
    (expand-file-name filename)))

(defun gsview-dired-find-file ()
  "In dired, run Ghostview on this file."
  (interactive)
  ;; dired-get-filename is defined in dired.el
  (w32-shell-execute nil "gsview32" (dired-get-filename))) (define-key
dired-mode-map "\C-c\C-g" 'gsview-dired-find-file)


----------------------- end exec.el
Rich






reply via email to

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