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: Wed, 25 Feb 2004 00:03:32 +0200 Organization: JURTA Sender: emacs-devel-bounces+emacs-devel=quimby.gnus.org@gnu.org Message-ID: <87znb89lu5.fsf@mail.jurta.org> References: <87r7wolz6u.fsf@mail.jurta.org> <874qthe5cv.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 1077660664 28812 80.91.224.253 (24 Feb 2004 22:11:04 GMT) X-Complaints-To: usenet@sea.gmane.org NNTP-Posting-Date: Tue, 24 Feb 2004 22:11:04 +0000 (UTC) Cc: jidanni@jidanni.org, emacs-devel@gnu.org Original-X-From: emacs-devel-bounces+emacs-devel=quimby.gnus.org@gnu.org Tue Feb 24 23:10:54 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 1AvklR-0003Kh-00 for ; Tue, 24 Feb 2004 23:10:53 +0100 Original-Received: from monty-python.gnu.org ([199.232.76.173]) by quimby.gnus.org with esmtp (Exim 3.35 #1 (Debian)) id 1AvklR-0003rU-00 for ; Tue, 24 Feb 2004 23:10:53 +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 1Avkki-0005yP-0j for emacs-devel@quimby.gnus.org; Tue, 24 Feb 2004 17:10:08 -0500 Original-Received: from list by monty-python.gnu.org with tmda-scanned (Exim 4.30) id 1AvkiU-0004Bf-VF for emacs-devel@gnu.org; Tue, 24 Feb 2004 17:07:51 -0500 Original-Received: from mail by monty-python.gnu.org with spam-scanned (Exim 4.30) id 1Avkhb-0002zY-FM for emacs-devel@gnu.org; Tue, 24 Feb 2004 17:07:30 -0500 Original-Received: from [66.33.219.4] (helo=spork.dreamhost.com) by monty-python.gnu.org with esmtp (Exim 4.30) id 1Avkha-0002wM-J9 for emacs-devel@gnu.org; Tue, 24 Feb 2004 17:06:54 -0500 Original-Received: from mail.jurta.org (80-235-34-199-dsl.mus.estpak.ee [80.235.34.199]) by spork.dreamhost.com (Postfix) with ESMTP id F221E11DC4A; Tue, 24 Feb 2004 14:06:45 -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:20162 X-Report-Spam: http://spam.gmane.org/gmane.emacs.devel:20162 Eli Zaretskii writes: > FWIW, I like this approach, but I suggest that "man -l" be offered > only if Emacs can tell that the -l switch is supported. Yes, it would be good: 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 24 Feb 2004 21:54:09 -0000 *************** *** 915,938 **** --- 915,982 ---- '(concat "znew" (if dired-guess-shell-gzip-quiet " -q") " " dired-guess-shell-znew-switches)) + ;; The following four extensions are useful with dired-man ("N" key) + (list "\\.[0-9]$" '(progn (require 'man) + (if (Man-support-local-filenames) + "man -l" + "cat * | tbl | nroff -man -h"))) + (list "\\.[0-9]\\.g?z$" '(progn (require 'man) + (if (Man-support-local-filenames) + "man -l" + "gunzip -qc * | tbl | nroff -man -h")) + ;; Optional decompression. + '(concat "gunzip" (if dired-guess-shell-gzip-quiet " -q"))) + (list "\\.[0-9]\\.Z$" '(progn (require 'man) + (if (Man-support-local-filenames) + "man -l" + "zcat * | tbl | nroff -man -h")) + ;; Optional conversion to gzip format. + '(concat "znew" (if dired-guess-shell-gzip-quiet " -q") + " " dired-guess-shell-znew-switches)) + '("\\.pod$" "perldoc" "pod2man * | nroff -man") + '("\\.dvi$" "xdvi" "dvips") ; preview and printing '("\\.au$" "play") ; play Sun audiofiles '("\\.mpg$" "mpeg_play") *************** *** 1278,1285 **** 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. --- 1328,1337 ---- Uses ../lisp/man.el of \\[manual-entry] fame." (interactive) (require 'man) ! (let* ((file (dired-get-filename)) ! (manual-program (replace-regexp-in-string "\\*" "%s" ! (dired-guess-shell-command ! "Man command: " (list file))))) (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 24 Feb 2004 21:54:10 -0000 *************** *** 317,322 **** --- 331,343 ---- "") "Option that indicates a specified a manual section name.") + (defvar Man-support-local-filenames 'auto-detect + "If t, `man' supports `-l' option and can interpret command + line arguments as local filenames. If nil, it don't support + `-l'. The default value of this variable is set up by + `Man-support-local-filenames' function. Use this function to + get the value of `Man-support-local-filenames' variable.") + ;; ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ ;; end user variables *************** *** 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))) --- 507,521 ---- (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))) *************** *** 555,560 **** --- 578,599 ---- slist nil)))) (concat Man-specified-section-option section " " name)))) + (defun Man-support-local-filenames () + "Check the availability of `-l' option." + (if (or (not Man-support-local-filenames) + (eq Man-support-local-filenames t)) + Man-support-local-filenames + (setq Man-support-local-filenames + (with-temp-buffer + (and (equal (condition-case nil + (call-process manual-program nil t nil "--help") + (error nil)) + 0) + (progn + (goto-char (point-min)) + (search-forward "--local-file" nil t)) + t))))) + ;; ====================================================================== ;; default man entry: get word under point -- http://www.jurta.org/emacs/