[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: |
Wed, 25 Feb 2004 00:03:32 +0200 |
User-agent: |
Gnus/5.110002 (No Gnus v0.2) Emacs/21.3.50 (gnu/linux) |
Eli Zaretskii <address@hidden> 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/
- Re: dired-man can't deal with compressed pages, (continued)
- 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
Re: dired-man can't deal with compressed pages, Juri Linkov, 2004/02/23