Open a files in emacs-wiki with external applications

classic Classic list List threaded Threaded
3 messages Options
Reply | Threaded
Open this post in threaded view
|

Open a files in emacs-wiki with external applications

Pál Csányi
Hello!

Is it possible to open a file clicking on a link in emacs-wiki
mode with approppriate applications?

Say one want to open a PDF file but with evince, or file.sch with
gschem application. Can one open these files with evince and gschem
respectively?

Any advices will be appreciated!

--
Regards, Paul Csanyi
http://www.freewebs.com/csanyi-pal/index.htm



_______________________________________________
emacs-wiki-discuss mailing list
[hidden email]
http://lists.nongnu.org/mailman/listinfo/emacs-wiki-discuss
Reply | Threaded
Open this post in threaded view
|

Re: Open a files in emacs-wiki with external applications

Stéfan van der Walt
Hi Csanyi

2008/7/30 Csanyi Pal <[hidden email]>:

> Hello!
>
> Is it possible to open a file clicking on a link in emacs-wiki
> mode with approppriate applications?
>
> Say one want to open a PDF file but with evince, or file.sch with
> gschem application. Can one open these files with evince and gschem
> respectively?
>
> Any advices will be appreciated!

Here is what I use:

; Opening other kinds of files
; http://www.emacswiki.org/cgi-bin/wiki/TrivialMode
; by Cyprian Laskowski
; Modified to make buffer read only and to suppress output of command
(defun define-trivial-mode(mode-prefix file-regexp &optional command)
  (or command (setq command mode-prefix))
  (let ((mode-command (intern (concat mode-prefix "-mode"))))
    (fset mode-command
          `(lambda ()
             (interactive)
             (toggle-read-only t)
             (start-process ,mode-prefix nil
                            ,command (buffer-file-name))
             (kill-buffer (current-buffer))))
    (add-to-list 'auto-mode-alist (cons file-regexp mode-command)))
  )

(define-trivial-mode "gv" "\\.ps$")
(define-trivial-mode "evince" "\\.pdf$")

Alternatively:

;; This is how you would do it by hand
;; (defun view-pdf ()
;;   "Use evince to view PDFs."
;;   (interactive)
;;   (progn
;;     (toggle-read-only t)
;;     (start-process "pdf" nil
;;                    "evince" (buffer-file-name)))
;; )
;; (add-to-list 'auto-mode-alist '("\\.pdf\\'" . view-pdf))

Hope that helps!

Cheers
Stéfan


_______________________________________________
emacs-wiki-discuss mailing list
[hidden email]
http://lists.nongnu.org/mailman/listinfo/emacs-wiki-discuss
Reply | Threaded
Open this post in threaded view
|

Re: Open a files in emacs-wiki with external applications

Pál Csányi
"Stéfan van der Walt" <[hidden email]> writes:

Hi Stéfan

> Hi Csanyi
>
> 2008/7/30 Csanyi Pal <[hidden email]>:

>> Is it possible to open a file clicking on a link in emacs-wiki
>> mode with approppriate applications?

> Here is what I use:

> (define-trivial-mode "gv" "\\.ps$")
> (define-trivial-mode "evince" "\\.pdf$")

I added a line:

(define-trivial-mode "gschem" "\\.sch$")

and now I can to open file.sch with gschem too. :)

Thanks!

--
Regards, Paul Csanyi
http://www.freewebs.com/csanyi-pal/index.htm



_______________________________________________
emacs-wiki-discuss mailing list
[hidden email]
http://lists.nongnu.org/mailman/listinfo/emacs-wiki-discuss