emacs-pretest-bug
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

woman doesn't work if current buffer's directory doesn't exist


From: Chris Moore
Subject: woman doesn't work if current buffer's directory doesn't exist
Date: Mon, 22 Jan 2007 14:49:01 +0100

In GNU Emacs 22.0.92.24 (i686-pc-linux-gnu, GTK+ Version 2.8.20)
 of 2007-01-21 on trpaslik
X server distributor `The X.Org Foundation', version 11.0.70101000
configured using `configure  '--with-gtk' '--prefix' '/usr/local' '--with-xpm' 
'--with-jpeg' '--with-png' '--with-gif''

  $ mkdir /tmp/foo
  $ cd /tmp/foo
  $ emacs -Q                            # current directory is /tmp/foo
  M-x delete-directory RET RET          # remove the current directory
  M-x woman RET ls RET                  # woman fails

***** File /usr/share/man/man1/ls.1.gz not found! *****

The error message is misleading, since the file does exist, and is
readable.

The cause of the problem is that call-process doesn't work if
default-directory doesn't exist, and jka-compr.el uses call-process in
a few places.

This should probably be fixed in call-process (I can't use
shell-command-on-region to pipe a region of a buffer through a shell
command if default-directory doesn't exist, for example, and I'd like
to be able to).  Perhaps default-directory could default to the value
of temporary-file-directory if it doesn't exist.

Alternatively, a less far-ranging fix is to modify just jka-compr.el
to bind default-directory while call-process is running:

--- lisp/old/jka-compr.el       2006-12-05 07:15:38.000000000 +0100
+++ lisp/jka-compr.el   2007-01-22 04:50:57.000000000 +0100
@@ -166,6 +166,7 @@
        ;; to discard the part we don't want.
        (let ((skip (/ beg jka-compr-dd-blocksize))
              (err-file (jka-compr-make-temp-name))
+             (default-directory (file-name-directory infile))
              count)
          ;; Update PREFIX based on the text that we won't read in.
          (setq prefix (- beg (* skip jka-compr-dd-blocksize))
@@ -204,6 +205,7 @@
 
 
 (defun jka-compr-call-process (prog message infile output temp args)
+  (let ((default-directory (file-name-directory infile)))
   (if jka-compr-use-shell
 
       (let ((err-file (jka-compr-make-temp-name))
@@ -243,6 +245,7 @@
         (with-current-buffer temp
           (write-region (point-min) (point-max) output)
           (erase-buffer)))))
+  )
 
 
 ;; Support for temp files.  Much of this was inspired if not lifted


Chris.




reply via email to

[Prev in Thread] Current Thread [Next in Thread]