From mboxrd@z Thu Jan 1 00:00:00 1970 Path: main.gmane.org!not-for-mail From: Juri Linkov Newsgroups: gmane.emacs.devel Subject: Re: Dired changes Date: Wed, 31 Mar 2004 23:59:38 +0300 Organization: JURTA Sender: emacs-devel-bounces+emacs-devel=quimby.gnus.org@gnu.org Message-ID: <87r7v8eidb.fsf@mail.jurta.org> References: NNTP-Posting-Host: deer.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-Trace: sea.gmane.org 1080777756 3594 80.91.224.253 (1 Apr 2004 00:02:36 GMT) X-Complaints-To: usenet@sea.gmane.org NNTP-Posting-Date: Thu, 1 Apr 2004 00:02:36 +0000 (UTC) Cc: emacs-devel@gnu.org Original-X-From: emacs-devel-bounces+emacs-devel=quimby.gnus.org@gnu.org Thu Apr 01 02:02:30 2004 Return-path: Original-Received: from quimby.gnus.org ([80.91.224.244]) by deer.gmane.org with esmtp (Exim 3.35 #1 (Debian)) id 1B8pfC-0007Gr-00 for ; Thu, 01 Apr 2004 02:02:30 +0200 Original-Received: from monty-python.gnu.org ([199.232.76.173]) by quimby.gnus.org with esmtp (Exim 3.35 #1 (Debian)) id 1B8pfC-0004GD-00 for ; Thu, 01 Apr 2004 02:02:30 +0200 Original-Received: from localhost ([127.0.0.1] helo=monty-python.gnu.org) by monty-python.gnu.org with esmtp (Exim 4.30) id 1B8peB-0004gi-AT for emacs-devel@quimby.gnus.org; Wed, 31 Mar 2004 19:01:27 -0500 Original-Received: from list by monty-python.gnu.org with tmda-scanned (Exim 4.30) id 1B8pcJ-0003AK-Vj for emacs-devel@gnu.org; Wed, 31 Mar 2004 18:59:31 -0500 Original-Received: from mail by monty-python.gnu.org with spam-scanned (Exim 4.30) id 1B8pbW-0002Fp-Fi for emacs-devel@gnu.org; Wed, 31 Mar 2004 18:59:14 -0500 Original-Received: from [66.33.219.19] (helo=spoon.dreamhost.com) by monty-python.gnu.org with esmtp (Exim 4.30) id 1B8paL-0001OA-QO for emacs-devel@gnu.org; Wed, 31 Mar 2004 18:57:29 -0500 Original-Received: from mail.jurta.org (80-235-44-154-dsl.mus.estpak.ee [80.235.44.154]) by spoon.dreamhost.com (Postfix) with ESMTP id 9965013D827; Wed, 31 Mar 2004 15:57:28 -0800 (PST) Original-To: Dave Love In-Reply-To: (Dave Love's message of "Thu, 18 Mar 2004 15:42:11 +0000") User-Agent: Gnus/5.110002 (No Gnus v0.2) Emacs/21.3.50 (gnu/linux) X-BeenThere: emacs-devel@gnu.org X-Mailman-Version: 2.1.4 Precedence: list List-Id: "Emacs development discussions." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: emacs-devel-bounces+emacs-devel=quimby.gnus.org@gnu.org Xref: main.gmane.org gmane.emacs.devel:21143 X-Report-Spam: http://spam.gmane.org/gmane.emacs.devel:21143 Dave Love writes in dired.el: > +;; Fixme: This should use mailcap. > (defcustom dired-view-command-alist > '(("[.]\\(ps\\|ps_pages\\|eps\\)\\'" . "gv -spartan -color -watch %s") > ("[.]pdf\\'" . "xpdf %s") I had this feature for a long time in .emacs, and it's really a useful thing. It could be added to dired.el, but I'm not sure where to add it. One possibility is to add directly to the `dired-view-file' like: diff -u -r1.280 dired.el --- emacs/lisp/dired.el 31 Mar 2004 16:29:46 -0000 1.280 +++ emacs/lisp/dired.el 31 Mar 2004 19:34:25 -0000 @@ -1489,11 +1489,22 @@ (dolist (elt dired-view-command-alist) (if (string-match (car elt) file) (setq cmd (cdr elt)))) + (unless cmd + (require 'mailcap) + (require 'mm-decode) + (mailcap-parse-mailcaps) + (let* ((ext (file-name-extension file)) + (mime (and ext (mailcap-extension-to-mime ext))) + (info (and mime (mailcap-mime-info mime)))) + (if (stringp info) + (setq cmd (mm-mailcap-command info file (list mime)))))) (if cmd (call-process shell-file-name nil 0 nil "-c" But it may be undesirable to call external programs for some system-wide defined extensions. Perhaps it's better to make a separate command `dired-view-file-externally' and to bind it, for example, to V. Or to add this code to the `dired-guess-shell-command' from dired-x.el. -- Juri Linkov http://www.jurta.org/emacs/