[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: extview.el --- open files with external viewer
From: |
spamfilteraccount |
Subject: |
Re: extview.el --- open files with external viewer |
Date: |
29 Mar 2006 02:16:34 -0800 |
User-agent: |
G2/0.2 |
Richard Stallman wrote:
>
> Have you signed a copyright assignment that gives the copyright
> to the FSF? If not, then the copyright notice should carry your
> name, not ours.
Thanks for the warning, Richard. I'm no copyright expert. Probably you
spent more time investigating this subject than I did. ;)
Here's the same version with a (hopefully) correct copyright.
/Tamas
;;; extview.el --- open files with external viewer
;; ;; Copyright (C) 2006 Tamas Patrovics
;; This file is free software; you can redistribute it and/or modify
;; it under the terms of the GNU General Public License as published by
;; the Free Software Foundation; either version 2, or (at your option)
;; any later version.
;; This file is distributed in the hope that it will be useful,
;; but WITHOUT ANY WARRANTY; without even the implied warranty of
;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
;; GNU General Public License for more details.
;; You should have received a copy of the GNU General Public License
;; along with GNU Emacs; see the file COPYING. If not, write to
;; the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
;; Boston, MA 02111-1307, USA.
;;; Commentary:
;; Load the library and try opening a file which has an associated
;; application in `extview-application-associations'.
;;; Code:
(require 'cl)
(defvar extview-application-associations
'(("\\.pdf$" . "acroread"))
"List of (REGEXP . APPLICATION) descriptors which are tested for the
file name to be opened. The first matching application is used to open
the file. If no application matches then normal `find-file' is
executed.")
(defadvice find-file (around extview-find-file
(filename &optional wildcards) activate)
"Around advice for find-file which checks if the file should be
opened with an external viewer instead of Emacs."
(interactive "FFind file: \np")
(let ((app (some (lambda (descriptor)
(if (string-match (car descriptor) filename)
(cdr descriptor)))
extview-application-associations)))
(if app
(let ((logbuffer "*extview log*"))
(start-process "extview-process" logbuffer
app (expand-file-name filename))
(message (concat "File is opened with an external viewer. "
"See buffer %s for status messages.")
logbuffer))
ad-do-it)))
(provide 'extview)
;;; extview.el ends here