Package: emacs-goodies-el
Version: 31.5
Severity: normal
Tags: patch
File: /usr/share/emacs/site-lisp/emacs-goodies-el/perldoc.el

perldoc has a bit of trouble if it's run in a buffer where
default-directory is a non-existent directory.  Eg.

    emacs -q /tmp/no/such/dir/foo.pl
    M-x perldoc

    => shell-command: Setting current directory: no such file or directory, 
/tmp/no/such/dir/

This tends to happen when starting a new file in a new directory and you
haven't yet done an M-x make-directory, but a leftover buffer where the
directory has been removed is quite possible too.

If perldoc doesn't use default-directory it'd be good if it made itself
independent of the value there, perhaps along the lines below.


--- perldoc.el.orig	2010-03-20 04:47:16.000000000 +1100
+++ perldoc.el	2010-03-20 05:32:32.000000000 +1100
@@ -117,7 +117,8 @@
           (case-fold-search nil))
       (set-buffer tmp-buffer)
       (erase-buffer)
-      (shell-command "perldoc -u perlfunc" t)
+      (let ((default-directory "/")) ;; in case current doesn't exist
+        (shell-command "perldoc -u perlfunc" t))
       (goto-char (point-min))
       (cond
        ((search-forward "Alphabetical Listing of Perl Functions" nil t)
@@ -150,7 +151,8 @@
 	  (perldoc-inc nil))
       (set-buffer tmp-buffer)
       (erase-buffer)
-      (shell-command "perl -e 'print \"@INC\"'" t)
+      (let ((default-directory "/")) ;; in case current doesn't exist
+        (shell-command "perl -e 'print \"@INC\"'" t))
       (goto-char (point-min))
       (while (re-search-forward "\\(/[^ ]*\\)" nil t)
 	(let ((libdir (match-string 1)))
@@ -160,7 +162,11 @@
 	(let (modules (list))
 	  (when (file-readable-p dir)
 	    (erase-buffer)
-	    (shell-command (concat "find -L " dir " -name '[A-Z]*.pm'") t)
+            ;; use "/" in case default-directory doesn't exist
+            ;; perldoc-inc doesn't contain "." or other relative dirs, so
+            ;; this setting doesn't make "find" traverse the whole of "/"
+            (let ((default-directory "/"))
+              (shell-command (concat "find -L " dir " -name '[A-Z]*.pm'") t))
 	    (goto-char (point-min))
 	    (while (re-search-forward (concat "^" (regexp-quote dir) "/\\(.*\\).pm$") nil t)
 	      (let ((entry (list (replace-regexp-in-string "/" "::" (match-string 1)))))
@@ -220,7 +226,8 @@
     (text-mode)
     (message "Loading documentation ..")
     (set-process-sentinel
-     (apply 'start-process args)
+     (let ((default-directory "/")) ;; in case current doesn't exist
+       (apply 'start-process args))
      'perldoc-sentinel)))
 
 (defun perldoc-function (function)


-- System Information:
Debian Release: squeeze/sid
  APT prefers unstable
  APT policy: (500, 'unstable')
Architecture: i386 (i586)

Kernel: Linux 2.6.30-1-486
Locale: LANG=en_AU, LC_CTYPE=en_AU (charmap=ISO-8859-1)
Shell: /bin/sh linked to /bin/dash

Versions of packages emacs-goodies-el depends on:
ii  bash                      4.0-7          The GNU Bourne Again SHell
ii  dpkg                      1.15.5.6       Debian package management system
ii  emacs21 [emacsen]         21.4a+1-5.7    The GNU Emacs editor
ii  emacs22-gtk [emacsen]     22.3+1-1.2     The GNU Emacs editor (with GTK use
ii  emacs23 [emacsen]         23.1+1-4       The GNU Emacs editor (with GTK+ us
ii  install-info              4.13a.dfsg.1-5 Manage installed documentation in 
ii  xemacs21-mule [emacsen]   21.4.22-2      highly customizable text editor --

Versions of packages emacs-goodies-el recommends:
ii  dict                       1.11.2+dfsg-2 dictionary client
ii  perl-doc                   5.10.1-2      Perl documentation
ii  wget                       1.12-1.1      retrieves files from the web

emacs-goodies-el suggests no packages.

-- no debconf information

Reply via email to