[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: dired-man can't deal with compressed pages
From: |
Juri Linkov |
Subject: |
Re: dired-man can't deal with compressed pages |
Date: |
Sun, 22 Feb 2004 21:03:02 +0200 |
User-agent: |
Gnus/5.110002 (No Gnus v0.2) Emacs/21.3.50 (gnu/linux) |
Eli Zaretskii <address@hidden> 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/
- dired-man can't deal with compressed pages, Juri Linkov, 2004/02/21
- Re: dired-man can't deal with compressed pages, Eli Zaretskii, 2004/02/22
- Re: dired-man can't deal with compressed pages,
Juri Linkov <=
- Re: dired-man can't deal with compressed pages, Eli Zaretskii, 2004/02/22
- Re: dired-man can't deal with compressed pages, Juri Linkov, 2004/02/22
- Re: dired-man can't deal with compressed pages, Eli Zaretskii, 2004/02/23
- Re: dired-man can't deal with compressed pages, Kevin Rodgers, 2004/02/23
- Re: dired-man can't deal with compressed pages, Eli Zaretskii, 2004/02/23
- Re: dired-man can't deal with compressed pages, Juri Linkov, 2004/02/22
- Re: dired-man can't deal with compressed pages, Eli Zaretskii, 2004/02/23
- Re: dired-man can't deal with compressed pages, Richard Stallman, 2004/02/23
- Re: dired-man can't deal with compressed pages, Stefan Monnier, 2004/02/23
- Re: dired-man can't deal with compressed pages, Eli Zaretskii, 2004/02/23