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-man can't deal with compressed pages Date: Sun, 22 Feb 2004 21:03:02 +0200 Organization: JURTA Sender: emacs-devel-bounces+emacs-devel=quimby.gnus.org@gnu.org Message-ID: <87d687vtgp.fsf@mail.jurta.org> References: <87r7wolz6u.fsf@mail.jurta.org> NNTP-Posting-Host: deer.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-Trace: sea.gmane.org 1077477634 4355 80.91.224.253 (22 Feb 2004 19:20:34 GMT) X-Complaints-To: usenet@sea.gmane.org NNTP-Posting-Date: Sun, 22 Feb 2004 19:20:34 +0000 (UTC) Cc: jidanni@jidanni.org, emacs-devel@gnu.org Original-X-From: emacs-devel-bounces+emacs-devel=quimby.gnus.org@gnu.org Sun Feb 22 20:20: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 1Auz9R-0008Jd-00 for ; Sun, 22 Feb 2004 20:20:29 +0100 Original-Received: from monty-python.gnu.org ([199.232.76.173]) by quimby.gnus.org with esmtp (Exim 3.35 #1 (Debian)) id 1Auz9R-0002fv-00 for ; Sun, 22 Feb 2004 20:20:29 +0100 Original-Received: from localhost ([127.0.0.1] helo=monty-python.gnu.org) by monty-python.gnu.org with esmtp (Exim 4.30) id 1Auyyy-0007cc-36 for emacs-devel@quimby.gnus.org; Sun, 22 Feb 2004 14:09:40 -0500 Original-Received: from list by monty-python.gnu.org with tmda-scanned (Exim 4.30) id 1Auyy3-0007Is-IU for emacs-devel@gnu.org; Sun, 22 Feb 2004 14:08:43 -0500 Original-Received: from mail by monty-python.gnu.org with spam-scanned (Exim 4.30) id 1AuyxR-00074k-CE for emacs-devel@gnu.org; Sun, 22 Feb 2004 14:08:36 -0500 Original-Received: from [199.232.41.8] (helo=mx20.gnu.org) by monty-python.gnu.org with esmtp (TLSv1:DES-CBC3-SHA:168) (Exim 4.30) id 1AuyxR-00074T-3J for emacs-devel@gnu.org; Sun, 22 Feb 2004 14:08:05 -0500 Original-Received: from [66.33.219.4] (helo=spork.dreamhost.com) by mx20.gnu.org with esmtp (Exim 4.30) id 1AuyxH-0000FL-HZ for emacs-devel@gnu.org; Sun, 22 Feb 2004 14:07:55 -0500 Original-Received: from mail.jurta.org (80-235-37-25-dsl.mus.estpak.ee [80.235.37.25]) by spork.dreamhost.com (Postfix) with ESMTP id 8B4C311DC4A; Sun, 22 Feb 2004 11:07:49 -0800 (PST) Original-To: Eli Zaretskii 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.2 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:20118 X-Report-Spam: http://spam.gmane.org/gmane.emacs.devel:20118 Eli Zaretskii writes: > I'm not sure this is the right way of solving the problem. For > starters, the "-l" switch is not portable: most versions of `man' > don't support it. And after thinking for a while, I don't see any way > of forcing those versions of `man' who don't have "-l" to format a > specific file. I presume this is the reason why dired-x runs nroff > directly. I agree that this will not work for man who don't have the -l option. On the other hand, man with the -l option should take the advantage of this option. So I think a good solution is to let users to choose the command line they want, like in the patch below. > If the only problem with the current code is that it doesn't support > compressed man pages, perhaps we could detect compressed files and > decompress them on the fly. I think it's better not to duplicate what man already does. Users can construct the command line as they want. > As for preprocessors, I don't know. If this is important, we could > blindly run the file through all of them, for example, or have a user > option to do that. Blindly running the file through all preprocessors will fail if some preprocessor is not installed. But having a user option will allow the user to specify the command line with needed preprocessors. > Yet another possible solution is to use functions from woman.el, which > IIRC has a special command to format a single file. However, I don't > remember how well it supports various preprocessors. There is already a dired binding to `W' key in woman.el. So users desiring a woman can get her with this key. Index: emacs/lisp/dired-x.el =================================================================== RCS file: /cvsroot/emacs/emacs/lisp/dired-x.el,v retrieving revision 1.52 diff -c -r1.52 dired-x.el *** emacs/lisp/dired-x.el 28 Sep 2003 09:03:45 -0000 1.52 --- emacs/lisp/dired-x.el 22 Feb 2004 18:29:00 -0000 *************** *** 1273,1285 **** ;;; Run man on files. (defun dired-man () "Run man on this file. Display old buffer if buffer name matches filename. Uses ../lisp/man.el of \\[manual-entry] fame." (interactive) (require 'man) (let ((file (dired-get-filename)) ! (manual-program "nroff -man -h")) (Man-getpage-in-background file))) ;;; Run Info on files. --- 1273,1293 ---- ;;; Run man on files. + (defvar dired-man-command "man -l" + "*Default man command. If your man don't support the -l option, + then to display compressed man files you can set this variable to + a string like \"gzip -dc %s | tbl | nroff -man -h\" where %s + is a placeholder for the man file name.") + (defun dired-man () "Run man on this file. Display old buffer if buffer name matches filename. Uses ../lisp/man.el of \\[manual-entry] fame." (interactive) (require 'man) (let ((file (dired-get-filename)) ! (manual-program (read-from-minibuffer ! "Man command: " dired-man-command nil nil ! 'dired-shell-command-history))) (Man-getpage-in-background file))) ;;; Run Info on files. Index: emacs/lisp/man.el =================================================================== RCS file: /cvsroot/emacs/emacs/lisp/man.el,v retrieving revision 1.132 diff -c -r1.132 man.el *** emacs/lisp/man.el 16 Feb 2004 18:20:31 -0000 1.132 --- emacs/lisp/man.el 22 Feb 2004 18:29:01 -0000 *************** *** 486,498 **** (defsubst Man-build-man-command () "Builds the entire background manpage and cleaning command." (let ((command (concat manual-program " " Man-switches ! ; Stock MS-DOS shells cannot redirect stderr; ! ; `call-process' below sends it to /dev/null, ! ; so we don't need `2>' even with DOS shells ! ; which do support stderr redirection. ! (if (not (fboundp 'start-process)) ! " %s" ! (concat " %s 2>" null-device)))) (flist Man-filter-list)) (while (and flist (car flist)) (let ((pcom (car (car flist))) --- 500,514 ---- (defsubst Man-build-man-command () "Builds the entire background manpage and cleaning command." (let ((command (concat manual-program " " Man-switches ! (cond ! ;; Already has %s ! ((string-match "%s" manual-program) "") ! ;; Stock MS-DOS shells cannot redirect stderr; ! ;; `call-process' below sends it to /dev/null, ! ;; so we don't need `2>' even with DOS shells ! ;; which do support stderr redirection. ! ((not (fboundp 'start-process)) " %s") ! ((concat " %s 2>" null-device))))) (flist Man-filter-list)) (while (and flist (car flist)) (let ((pcom (car (car flist))) -- http://www.jurta.org/emacs/